MCPcopy Index your code
hub / github.com/coder/coder / Permissions

Function Permissions

coderd/rbac/roles.go:928–944  ·  view source on GitHub ↗

Permissions is just a helper function to make building roles that list out resources and actions a bit easier.

(perms map[string][]policy.Action)

Source from the content-addressed store, hash-verified

926// Permissions is just a helper function to make building roles that list out resources
927// and actions a bit easier.
928func Permissions(perms map[string][]policy.Action) []Permission {
929 list := make([]Permission, 0, len(perms))
930 for k, actions := range perms {
931 for _, act := range actions {
932 list = append(list, Permission{
933 Negate: false,
934 ResourceType: k,
935 Action: act,
936 })
937 }
938 }
939 // Deterministic ordering of permissions
940 sort.Slice(list, func(i, j int) bool {
941 return list[i].ResourceType < list[j].ResourceType
942 })
943 return list
944}
945
946// DeduplicatePermissions removes duplicate Permission entries while preserving
947// the original order of the first occurrence for deterministic evaluation.

Callers 11

TestInsertCustomRolesFunction · 0.92
TestSystemRolesFunction · 0.92
dbauthz.goFile · 0.92
testDBAuthzRoleFunction · 0.92
pgcoord.goFile · 0.92
scopes.goFile · 0.85
CompositeSitePermissionsFunction · 0.85
ReloadBuiltinRolesFunction · 0.85
OrgMemberPermissionsFunction · 0.85
TestAuthorizeScopeFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestInsertCustomRolesFunction · 0.74
TestSystemRolesFunction · 0.74
testDBAuthzRoleFunction · 0.74
TestAuthorizeScopeFunction · 0.68