graph: Allow to disable the default role assignment on user creation
Introduces a switch ('GRAPH_ASSIGN_DEFAULT_USER_ROLE') to allow to disable the assignment of the default role "User" to newly created users.
This will be used for setups where the role-assignments are populated either manually or during first login (e.g. from OIDC claims)
This commit is contained in:
committed by
Ralf Haferkamp
parent
b4b0f7abe7
commit
81c0f21f78
@@ -328,7 +328,7 @@ func (g Graph) PostUser(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// assign roles if possible
|
||||
if g.roleService != nil {
|
||||
if g.roleService != nil && g.config.API.AssignDefaultUserRole {
|
||||
// All users get the user role by default currently.
|
||||
// to all new users for now, as create Account request does not have any role field
|
||||
if _, err = g.roleService.AssignRoleToUser(r.Context(), &settings.AssignRoleToUserRequest{
|
||||
|
||||
Reference in New Issue
Block a user