mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: create type for unique role names (#13506)
* chore: create type for unique role names Using `string` was confusing when something should be combined with org context, and when not to. Naming this new name, "RoleIdentifier"
This commit is contained in:
+3
-3
@@ -133,12 +133,12 @@ func assignableRoles(actorRoles rbac.ExpandableRoles, roles []rbac.Role, customR
|
||||
// The member role is implied, and not assignable.
|
||||
// If there is no display name, then the role is also unassigned.
|
||||
// This is not the ideal logic, but works for now.
|
||||
if role.Name == rbac.RoleMember() || (role.DisplayName == "") {
|
||||
if role.Identifier == rbac.RoleMember() || (role.DisplayName == "") {
|
||||
continue
|
||||
}
|
||||
assignable = append(assignable, codersdk.AssignableRoles{
|
||||
Role: db2sdk.RBACRole(role),
|
||||
Assignable: rbac.CanAssignRole(actorRoles, role.Name),
|
||||
Assignable: rbac.CanAssignRole(actorRoles, role.Identifier),
|
||||
BuiltIn: true,
|
||||
})
|
||||
}
|
||||
@@ -146,7 +146,7 @@ func assignableRoles(actorRoles rbac.ExpandableRoles, roles []rbac.Role, customR
|
||||
for _, role := range customRoles {
|
||||
assignable = append(assignable, codersdk.AssignableRoles{
|
||||
Role: db2sdk.Role(role),
|
||||
Assignable: rbac.CanAssignRole(actorRoles, role.Name),
|
||||
Assignable: rbac.CanAssignRole(actorRoles, role.RoleIdentifier()),
|
||||
BuiltIn: false,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user