added common error

This commit is contained in:
CITE\spapacharalampous 2024-09-10 17:32:08 +03:00
parent 1f9aaf616e
commit 76a7b9572d
3 changed files with 9 additions and 2 deletions

View File

@ -538,4 +538,10 @@ public class ErrorThesaurusProperties {
public void setMissingGlobalRole(ErrorDescription missingGlobalRole) {
this.missingGlobalRole = missingGlobalRole;
}
private ErrorDescription userProfileInactive;
public ErrorDescription getUserProfileInactive() { return userProfileInactive; }
public void setUserProfileInactive(ErrorDescription userProfileInactive) {this.userProfileInactive = userProfileInactive; }
}

View File

@ -351,9 +351,9 @@ public class UserServiceImpl implements UserService {
List<UserCredentialEntity> userCredentials = this.queryFactory.query(UserCredentialQuery.class).disableTracking().userIds(data.getId()).collect();
if (userCredentials.isEmpty())
throw new MyApplicationException("Currently cannot update roles for this user");
throw new MyApplicationException(this.errors.getUserProfileInactive().getCode(), this.errors.getUserProfileInactive().getMessage());
if (userCredentials.getFirst().getExternalId() == null)
throw new MyApplicationException("Currently cannot update roles for this user");
throw new MyApplicationException(this.errors.getUserProfileInactive().getCode(), this.errors.getUserProfileInactive().getMessage());
if (!model.getHasTenantAdminMode()) this.applyGlobalRoles(data.getId(), model);

View File

@ -55,6 +55,7 @@ export enum ResponseErrorCode {
planBlueprintImportDraft = 157,
missingTenantRole = 158,
missingGlobalRole = 159,
userProfileInactive = 160,
// Notification & Annotation Errors
InvalidApiKey = 200,