- Add list/create/revoke/scopes handlers, validation, and soft revoke - Regenerate admin OpenAPI and TS types; inventory and conformance cases - Add server-side api_tokens phrase keys (en/pl) Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
765 B
Go
28 lines
765 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 = insertAPIToken(db, ownerID, "test", scopes, expiresAt)
|
|
return plain, err
|
|
}
|