IDEMPIERE-1747 when user click cancel button in "select role" in condition "change role". it should forward to system, not login / Peer review

This commit is contained in:
Carlos Ruiz 2014-02-19 09:32:43 -05:00
parent fc810c64db
commit 3e23250e18
2 changed files with 20 additions and 12 deletions

View File

@ -79,7 +79,7 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
/** /**
* *
*/ */
private static final long serialVersionUID = 1071903027424763936L; private static final long serialVersionUID = 4068073033610726196L;
protected LoginWindow wndLogin; protected LoginWindow wndLogin;
protected Login login; protected Login login;
@ -101,11 +101,19 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
protected boolean m_show = true; protected boolean m_show = true;
private RolePanel component; private RolePanel component;
public boolean isChangeRole = false; private boolean isChangeRole = false;
public boolean isChangeRole() {
return isChangeRole;
}
public void setChangeRole(boolean isChangeRole) {
this.isChangeRole = isChangeRole;
}
// backup old value // backup old value
private Properties b_ctx = null; private Properties ctxBeforeChangeRole = null;
private static final String ON_DEFER_LOGOUT = "onDeferLogout"; private static final String ON_DEFER_LOGOUT = "onDeferLogout";
@ -517,14 +525,14 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
} }
else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{ {
if (isChangeRole){ if (isChangeRole()) {
changeRole(b_ctx); changeRole(ctxBeforeChangeRole);
validateRoles(); validateRoles();
}else{ } else {
ctxBeforeChangeRole = null;
SessionManager.logoutSession(); SessionManager.logoutSession();
wndLogin.loginCancelled(); wndLogin.loginCancelled();
} }
} }
else if (ON_DEFER_LOGOUT.equals(event.getName())) else if (ON_DEFER_LOGOUT.equals(event.getName()))
{ {
@ -548,7 +556,7 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
} }
public void changeRole(Properties ctx) { public void changeRole(Properties ctx) {
b_ctx = ctx; ctxBeforeChangeRole = ctx;
int AD_Client_ID = Env.getAD_Client_ID(ctx); int AD_Client_ID = Env.getAD_Client_ID(ctx);
lstClient.setValue(AD_Client_ID); lstClient.setValue(AD_Client_ID);
updateRoleList(); updateRoleList();

View File

@ -180,7 +180,7 @@ public class LoginWindow extends FWindow implements EventListener<Event>
loginName = user.getLDAPUser() != null ? user.getLDAPUser() : user.getName(); loginName = user.getLDAPUser() != null ? user.getLDAPUser() : user.getName();
loginOk(loginName, true, login.getClients()); loginOk(loginName, true, login.getClients());
getDesktop().getSession().setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx)); getDesktop().getSession().setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx));
pnlRole.isChangeRole = true; pnlRole.setChangeRole(true);
pnlRole.changeRole(ctx); pnlRole.changeRole(ctx);
} }
} }