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

Function SiteBuiltInRoles

coderd/rbac/roles.go:903–913  ·  view source on GitHub ↗

SiteBuiltInRoles lists all roles that can be applied to a user. This is the list of available roles, and not specific to a user This should be a list in a database, but until then we build the list from the builtins.

()

Source from the content-addressed store, hash-verified

901// This should be a list in a database, but until then we build
902// the list from the builtins.
903func SiteBuiltInRoles() []Role {
904 var roles []Role
905 for _, roleF := range builtInRoles {
906 // Must provide some non-nil uuid to filter out org roles.
907 role := roleF(uuid.New())
908 if !role.Identifier.IsOrgRole() {
909 roles = append(roles, role)
910 }
911 }
912 return roles
913}
914
915// ChangeRoleSet is a helper function that finds the difference of 2 sets of
916// roles. When setting a user's new roles, it is equivalent to adding and

Callers 3

AssignableSiteRolesMethod · 0.92
TestBuiltInRolesFunction · 0.92
TestListRolesFunction · 0.92

Calls 2

IsOrgRoleMethod · 0.80
NewMethod · 0.65

Tested by 2

TestBuiltInRolesFunction · 0.74
TestListRolesFunction · 0.74