Feat v0.7.7 api tokens ext permissions (#61)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-runners (push) Has been skipped
CI/CD / test-go-pg (push) Successful in 2m48s
CI/CD / test-sqlite (push) Successful in 2m49s
CI/CD / build-and-deploy (push) Successful in 28s
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-runners (push) Has been skipped
CI/CD / test-go-pg (push) Successful in 2m48s
CI/CD / test-sqlite (push) Successful in 2m49s
CI/CD / build-and-deploy (push) Successful in 28s
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #61.
This commit is contained in:
@@ -27,8 +27,10 @@ type ManifestInfo struct {
|
||||
HasSettings bool
|
||||
HasExports bool
|
||||
Dependencies map[string]any
|
||||
Requires []string
|
||||
Signature string // reserved for future package signing
|
||||
Requires []string
|
||||
Signature string // reserved for future package signing
|
||||
UserPermissions []string // user-facing permissions declared by the extension
|
||||
GatePermission string // if set, checks this user permission before calling on_request
|
||||
}
|
||||
|
||||
// ValidateManifest parses a manifest map and validates all required fields,
|
||||
@@ -97,6 +99,16 @@ func ValidateManifest(manifest map[string]any) (*ManifestInfo, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Extension-declared user permissions
|
||||
if ups, ok := manifest["user_permissions"].([]any); ok {
|
||||
for _, v := range ups {
|
||||
if s, ok := v.(string); ok && s != "" {
|
||||
info.UserPermissions = append(info.UserPermissions, s)
|
||||
}
|
||||
}
|
||||
}
|
||||
info.GatePermission, _ = manifest["gate_permission"].(string)
|
||||
|
||||
info.SchemaVersion = ParseSchemaVersion(manifest)
|
||||
|
||||
// ── Type-specific constraints ────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user