Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
21 lines
585 B
Go
21 lines
585 B
Go
package authz
|
|
|
|
import "github.com/QuantumNous/new-api/common"
|
|
|
|
// resolveSubjectRoles returns the role keys assigned to a subject. The mapping
|
|
// is derived from the caller's system role.
|
|
var resolveSubjectRoles = func(userID int, systemRole int) []string {
|
|
switch {
|
|
case systemRole >= common.RoleRootUser:
|
|
return []string{BuiltInRoleRoot}
|
|
case systemRole >= common.RoleAdminUser:
|
|
return []string{BuiltInRoleAdmin}
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// managedRoleKey is the role whose baseline per-user overrides are expressed
|
|
// relative to.
|
|
const managedRoleKey = BuiltInRoleAdmin
|