mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-05 08:05:12 +00:00
21 lines
606 B
Go
21 lines
606 B
Go
package adminaccess
|
|
|
|
import "testing"
|
|
|
|
func TestScopedPermissionCatalogRequiresExplicitGrant(t *testing.T) {
|
|
for _, id := range []string{"accounts.identity.read", "accounts.usage.read", "accounts.options.write", "accounts.rate.write", "groups.list.read", "groups.capacity.read", "openai.tokens.refresh"} {
|
|
found := false
|
|
for _, entry := range PermissionCatalog() {
|
|
if entry.ID == id {
|
|
found = true
|
|
}
|
|
}
|
|
if !found {
|
|
t.Errorf("权限未登记: %s", id)
|
|
}
|
|
}
|
|
if RouteAllowed(Policy{}, "POST", "/api/v1/admin/openai/refresh-token") {
|
|
t.Fatal("旧策略不得继承新增权限")
|
|
}
|
|
}
|