Commit f969ffd

Eric Bower  ·  2026-03-05 20:33:25 -0500 EST
parent 45aaf05
chore(pgs): setting acl is pico+ only
2 files changed,  +19, -0
+15, -0
......@@ -5,6 +5,7 @@ import (
55 "fmt"
66 "slices"
77 "strings"
8+ "time"
89
910 pgsdb "github.com/picosh/pico/pkg/apps/pgs/db"
1011 "github.com/picosh/pico/pkg/db"
......@@ -236,6 +237,20 @@ func Middleware(handler *UploadAssetHandler) pssh.SSHServerMiddleware {
236237 return err
237238 }
238239
240+ hasPicoPlus := false
241+ ff, _ := dbpool.FindFeature(user.ID, "plus")
242+ if ff != nil {
243+ if ff.ExpiresAt.After(time.Now()) {
244+ hasPicoPlus = true
245+ }
246+ }
247+
248+ if !hasPicoPlus {
249+ err = fmt.Errorf("setting acl on a project requires pico+")
250+ opts.bail(err)
251+ return err
252+ }
253+
239254 if pgsdb.IsProjectPrivate(projectName) {
240255 err = fmt.Errorf("projects prefixed with `private-` can *never* have their access changed; however you can symlink to it")
241256 opts.bail(err)
+4, -0
......@@ -336,6 +336,10 @@ func (h *UploadAssetHandler) Write(s *pssh.SSHServerConnSession, entry *sendutil
336336 }
337337
338338 featureFlag := findPlusFF(h.Cfg.DB, h.Cfg, user.ID)
339+ if !featureFlag.IsValid() && pgsdb.IsProjectPrivate(projectName) {
340+ return "", fmt.Errorf("private projects are only allowed for pico+ users")
341+ }
342+
339343 // calculate the filsize difference between the same file already
340344 // stored and the updated file being uploaded
341345 assetFilename := shared.GetAssetFileName(entry)