Files
summercms/modules/cabana/export_test.go
Jakub Zych b9273c1da7 feat(16.3-01): tracer — g15_ token scopes through composite backend guard
- Add pact.TokenScope/HasTokenScopes and bouncer.ScopeLimit on Principal
- Append backend_api_tokens migration; Allows evaluates scope before superuser
- Composite guard routes Bearer g15_… to token lookup; smoke tests cover path

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-11 01:46:32 +02:00

28 lines
764 B
Go

package cabana
import (
"time"
"gorm.io/gorm"
)
// AdminAPIRoutes exposes the admin API route inventory (method plus
// prefix-relative path) to the external conformance test.
func AdminAPIRoutes() []string {
out := make([]string, 0, len(phase09Routes))
for _, route := range phase09Routes {
if !route.spa {
out = append(out, route.key)
}
}
return out
}
// IssueTestAPIToken mints a personal API token for ownerID with the given
// scopes and optional expiry. Used by external Postgres smoke tests before
// the HTTP create route exists.
func IssueTestAPIToken(db *gorm.DB, ownerID uint, scopes []string, expiresAt *time.Time) (plain string, err error) {
plain, _, err = issueAPIToken(db, ownerID, "test", scopes, expiresAt)
return plain, err
}