Merge pull request #6618 from kobergj/MoreRoleAssignerFixing

Fix OIDC Role Assigning
This commit is contained in:
kobergj
2023-06-26 10:44:51 +02:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@@ -5,3 +5,4 @@ This makes no sense as the user is supposed to have only one and the update will
We still log an error level log to make the admin aware of that.
https://github.com/owncloud/ocis/pull/6605
https://github.com/owncloud/ocis/pull/6618

View File

@@ -93,7 +93,7 @@ func (ra oidcRoleAssigner) UpdateUserRoleAssignment(ctx context.Context, user *c
}
logger.Debug().Interface("assignedRoleIds", assignedRoles).Msg("Currently assigned roles")
if len(assignedRoles) == 0 || (assignedRoles[0] != roleIDFromClaim) {
if len(assignedRoles) != 1 || (assignedRoles[0] != roleIDFromClaim) {
logger.Debug().Interface("assignedRoleIds", assignedRoles).Interface("newRoleId", roleIDFromClaim).Msg("Updating role assignment for user")
newctx, err := ra.prepareAdminContext()
if err != nil {