repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
f969ffd
parent
45aaf05
author
Eric Bower
date
2026-03-05 20:33:25 -0500 EST
chore(pgs): setting acl is pico+ only
2 files changed,  +19, -0
M pkg/apps/pgs/cli_middleware.go
+15, -0
 1@@ -5,6 +5,7 @@ import (
 2 	"fmt"
 3 	"slices"
 4 	"strings"
 5+	"time"
 6 
 7 	pgsdb "github.com/picosh/pico/pkg/apps/pgs/db"
 8 	"github.com/picosh/pico/pkg/db"
 9@@ -236,6 +237,20 @@ func Middleware(handler *UploadAssetHandler) pssh.SSHServerMiddleware {
10 					return err
11 				}
12 
13+				hasPicoPlus := false
14+				ff, _ := dbpool.FindFeature(user.ID, "plus")
15+				if ff != nil {
16+					if ff.ExpiresAt.After(time.Now()) {
17+						hasPicoPlus = true
18+					}
19+				}
20+
21+				if !hasPicoPlus {
22+					err = fmt.Errorf("setting acl on a project requires pico+")
23+					opts.bail(err)
24+					return err
25+				}
26+
27 				if pgsdb.IsProjectPrivate(projectName) {
28 					err = fmt.Errorf("projects prefixed with `private-` can *never* have their access changed; however you can symlink to it")
29 					opts.bail(err)
M pkg/apps/pgs/uploader.go
+4, -0
 1@@ -336,6 +336,10 @@ func (h *UploadAssetHandler) Write(s *pssh.SSHServerConnSession, entry *sendutil
 2 	}
 3 
 4 	featureFlag := findPlusFF(h.Cfg.DB, h.Cfg, user.ID)
 5+	if !featureFlag.IsValid() && pgsdb.IsProjectPrivate(projectName) {
 6+		return "", fmt.Errorf("private projects are only allowed for pico+ users")
 7+	}
 8+
 9 	// calculate the filsize difference between the same file already
10 	// stored and the updated file being uploaded
11 	assetFilename := shared.GetAssetFileName(entry)