small fix

This commit is contained in:
CITE\amentis 2024-09-03 10:58:37 +03:00
parent fad3f394a0
commit 3282b52b39
1 changed files with 0 additions and 4 deletions

View File

@ -337,14 +337,10 @@ public class UserServiceImpl implements UserService {
if (!model.getHasTenantAdminMode()) { if (!model.getHasTenantAdminMode()) {
this.authorizationService.authorizeForce(Permission.EditUser); this.authorizationService.authorizeForce(Permission.EditUser);
boolean foundGlobalRole = false; boolean foundGlobalRole = false;
boolean foundTenantRole = false;
for (String role: model.getRoles()) { for (String role: model.getRoles()) {
if (authorizationConfiguration.getAuthorizationProperties().getAllowedGlobalRoles().contains(role)) foundGlobalRole = true; if (authorizationConfiguration.getAuthorizationProperties().getAllowedGlobalRoles().contains(role)) foundGlobalRole = true;
if (authorizationConfiguration.getAuthorizationProperties().getAllowedTenantRoles().contains(role)) foundTenantRole = true;
} }
if (!foundGlobalRole && !foundTenantRole) throw new MyValidationException("Wrong role type");
if (!foundGlobalRole) throw new MyValidationException(this.errors.getMissingGlobalRole().getCode(), this.errors.getMissingGlobalRole().getMessage()); if (!foundGlobalRole) throw new MyValidationException(this.errors.getMissingGlobalRole().getCode(), this.errors.getMissingGlobalRole().getMessage());
if (!foundTenantRole) throw new MyValidationException(this.errors.getMissingTenantRole().getCode(), this.errors.getMissingTenantRole().getMessage());
} else { } else {
this.authorizationService.authorizeForce(Permission.EditTenantUserRole); this.authorizationService.authorizeForce(Permission.EditTenantUserRole);
} }