Feat v0.5.2 chat surface (#32)
All checks were successful
All checks were successful
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #32.
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
@@ -191,7 +192,21 @@ func installBundledPackage(pkgPath, packagesDir string, stores store.Stores, run
|
||||
|
||||
// Sync permissions — use a minimal gin.Context for the functions that need it
|
||||
fakeCtx := newBackgroundGinContext()
|
||||
SyncManifestPermissions(fakeCtx, stores, pkgID, manifest)
|
||||
declaredPerms := SyncManifestPermissions(fakeCtx, stores, pkgID, manifest)
|
||||
|
||||
// Bundled packages are trusted — auto-grant all declared permissions
|
||||
// and restore active status (SyncManifestPermissions sets pending_review).
|
||||
// Use direct SQL with NULL granted_by to satisfy FK constraint on users(id).
|
||||
if len(declaredPerms) > 0 {
|
||||
now := time.Now().UTC().Format(time.RFC3339)
|
||||
_, err := database.DB.ExecContext(ctx,
|
||||
`UPDATE extension_permissions SET granted = 1, granted_by = NULL, granted_at = ? WHERE package_id = ? AND granted = 0`,
|
||||
now, pkgID)
|
||||
if err != nil {
|
||||
log.Printf("[bundled] Failed to auto-grant permissions for %s: %v", pkgID, err)
|
||||
}
|
||||
_ = stores.Packages.SetStatus(ctx, pkgID, "active")
|
||||
}
|
||||
|
||||
// Sync triggers from manifest
|
||||
SyncManifestTriggers(ctx, stores, triggers.GlobalEngine(), pkgID, manifest)
|
||||
|
||||
Reference in New Issue
Block a user