Co-authored-by: gobha <jasafpro@gmail.com> Co-committed-by: gobha <jasafpro@gmail.com>
67 lines
2.5 KiB
Go
67 lines
2.5 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
// ── Package Status Constants ─────────────────
|
|
|
|
const (
|
|
// PackageStatusActive means the package is running normally.
|
|
PackageStatusActive = "active"
|
|
|
|
// PackageStatusPendingReview means the package declared permissions
|
|
// that require admin approval before activation.
|
|
PackageStatusPendingReview = "pending_review"
|
|
|
|
// PackageStatusSuspended means an admin has suspended the package.
|
|
PackageStatusSuspended = "suspended"
|
|
)
|
|
|
|
// ValidPackageStatuses is the set of valid package status values.
|
|
var ValidPackageStatuses = map[string]bool{
|
|
PackageStatusActive: true,
|
|
PackageStatusPendingReview: true,
|
|
PackageStatusSuspended: true,
|
|
}
|
|
|
|
// ── Extension Permission Constants ───────────
|
|
|
|
const (
|
|
ExtPermSecretsRead = "secrets.read"
|
|
ExtPermNotificationsSend = "notifications.send"
|
|
ExtPermFiltersPreCompletion = "filters.pre_completion"
|
|
ExtPermDBRead = "db.read"
|
|
ExtPermDBWrite = "db.write"
|
|
ExtPermAPIHTTP = "api.http"
|
|
ExtPermProviderComplete = "provider.complete" // v0.29.1: LLM completion calls
|
|
ExtPermFormValidate = "forms.validate" // v0.29.3: form validation hooks
|
|
ExtPermWorkflowAccess = "workflow.access" // v0.30.2: workflow definition + stage data access
|
|
ExtPermConnectionsRead = "connections.read" // v0.38.1: extension connection resolution
|
|
)
|
|
|
|
// ValidExtensionPermissions is the set of recognized permission keys.
|
|
var ValidExtensionPermissions = map[string]bool{
|
|
ExtPermSecretsRead: true,
|
|
ExtPermNotificationsSend: true,
|
|
ExtPermFiltersPreCompletion: true,
|
|
ExtPermDBRead: true,
|
|
ExtPermDBWrite: true,
|
|
ExtPermAPIHTTP: true,
|
|
ExtPermProviderComplete: true,
|
|
ExtPermFormValidate: true,
|
|
ExtPermWorkflowAccess: true,
|
|
ExtPermConnectionsRead: true,
|
|
}
|
|
|
|
// ── Extension Permission Model ───────────────
|
|
|
|
// ExtensionPermission represents a declared/granted capability for a package.
|
|
type ExtensionPermission struct {
|
|
ID string `json:"id" db:"id"`
|
|
PackageID string `json:"package_id" db:"package_id"`
|
|
Permission string `json:"permission" db:"permission"`
|
|
Granted bool `json:"granted" db:"granted"`
|
|
GrantedBy *string `json:"granted_by,omitempty" db:"granted_by"`
|
|
GrantedAt *time.Time `json:"granted_at,omitempty" db:"granted_at"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
}
|