fixed update of account role mapping
This commit is contained in:
@ -121,7 +121,7 @@ public class AccountView implements Serializable {
|
|||||||
if ((currentAccount.getCreatedBy() == null) && (existingEntity != null)) {
|
if ((currentAccount.getCreatedBy() == null) && (existingEntity != null)) {
|
||||||
FacesUtil.addErrorMessage("editDialogMessaegs", "Create new account failed", "Account with username " + username + " already exists");
|
FacesUtil.addErrorMessage("editDialogMessaegs", "Create new account failed", "Account with username " + username + " already exists");
|
||||||
} else {
|
} else {
|
||||||
accountService.saveAccount(currentAccount, currentAccountRoles);
|
accountService.saveAccount(currentAccount, applicationView.getCurrentApplication(), currentAccountRoles);
|
||||||
// force accounts to be loaded from database again
|
// force accounts to be loaded from database again
|
||||||
accountList = null;
|
accountList = null;
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ public class AccountView implements Serializable {
|
|||||||
if ((password != null) && (!password.trim().equals(""))) {
|
if ((password != null) && (!password.trim().equals(""))) {
|
||||||
// password has been specified
|
// password has been specified
|
||||||
if (password.equals(repeatPassword)) {
|
if (password.equals(repeatPassword)) {
|
||||||
currentAccount.getAccountLogin().setAccountPassword(accountService.getHashedPassword(password));
|
currentAccountLogin.setAccountPassword(accountService.getHashedPassword(password));
|
||||||
FacesUtil.addGlobalInfoMessage("Info", "Password updated");
|
FacesUtil.addGlobalInfoMessage("Info", "Password updated");
|
||||||
} else {
|
} else {
|
||||||
// TODO connect to IPRS
|
// TODO connect to IPRS
|
||||||
|
|||||||
@ -94,7 +94,7 @@ public class AccountControl implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public AccountEntity saveAccount(AccountEntity account, List<ApplicationRoleEntity> applicationRoles) {
|
public AccountEntity saveAccount(AccountEntity account, ApplicationEntity app, List<ApplicationRoleEntity> applicationRoles) {
|
||||||
Date now = DateUtil.getCurrentTimeInUTC();
|
Date now = DateUtil.getCurrentTimeInUTC();
|
||||||
Subject currentUser = SecurityUtils.getSubject();
|
Subject currentUser = SecurityUtils.getSubject();
|
||||||
String currentLoggedInUser = currentUser.getPrincipal().toString();
|
String currentLoggedInUser = currentUser.getPrincipal().toString();
|
||||||
@ -127,7 +127,7 @@ public class AccountControl implements Serializable {
|
|||||||
List<ApplicationRoleEntity> assignedRoles = new ArrayList<>();
|
List<ApplicationRoleEntity> assignedRoles = new ArrayList<>();
|
||||||
assignedRoles.addAll(account.getApplicationRoleList());
|
assignedRoles.addAll(account.getApplicationRoleList());
|
||||||
for (ApplicationRoleEntity currentlyAssignedRole : assignedRoles) {
|
for (ApplicationRoleEntity currentlyAssignedRole : assignedRoles) {
|
||||||
if ((currentlyAssignedRole.getApplication().equals(application) && (!applicationRoles.contains(currentlyAssignedRole)))) {
|
if ((currentlyAssignedRole.getApplication().equals(app) && (!applicationRoles.contains(currentlyAssignedRole)))) {
|
||||||
account.getApplicationRoleList().remove(currentlyAssignedRole);
|
account.getApplicationRoleList().remove(currentlyAssignedRole);
|
||||||
roleSetupChanged = true;
|
roleSetupChanged = true;
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user