IDEMPIERE-356 Implement Change Role / Make it work with EMail as Login IDEMPIERE-358 / Fix Change Role and Cancel problem

This commit is contained in:
Carlos Ruiz 2012-08-23 20:04:28 -05:00
parent 52b7f43d4d
commit 340fa1a121
3 changed files with 16 additions and 5 deletions

View File

@ -81,7 +81,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
/** /**
* *
*/ */
private static final long serialVersionUID = 5616730124927184116L; private static final long serialVersionUID = -208259686238044047L;
private static final String SAVED_CONTEXT = "saved.context"; private static final String SAVED_CONTEXT = "saved.context";
@ -358,6 +358,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
Session session = Executions.getCurrent().getDesktop().getSession(); Session session = Executions.getCurrent().getDesktop().getSession();
//stop background thread //stop background thread
if (appDesktop != null)
appDesktop.logout(); appDesktop.logout();
//clear remove all children and root component //clear remove all children and root component

View File

@ -76,7 +76,7 @@ public class RolePanel extends Window implements EventListener, Deferrable
/** /**
* *
*/ */
private static final long serialVersionUID = 153231955030136145L; private static final long serialVersionUID = 4403663665119775251L;
private static final String RESOURCE = "org.compiere.apps.ALoginRes"; private static final String RESOURCE = "org.compiere.apps.ALoginRes";
@ -465,6 +465,7 @@ public class RolePanel extends Window implements EventListener, Deferrable
} }
else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{ {
SessionManager.logoutSession();
wndLogin.loginCancelled(); wndLogin.loginCancelled();
} }
} }

View File

@ -30,6 +30,7 @@ import org.adempiere.webui.IWebClient;
import org.adempiere.webui.component.FWindow; import org.adempiere.webui.component.FWindow;
import org.adempiere.webui.panel.LoginPanel; import org.adempiere.webui.panel.LoginPanel;
import org.adempiere.webui.panel.RolePanel; import org.adempiere.webui.panel.RolePanel;
import org.compiere.model.MSysConfig;
import org.compiere.model.MUser; import org.compiere.model.MUser;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
@ -53,7 +54,8 @@ public class LoginWindow extends FWindow implements EventListener
/** /**
* *
*/ */
private static final long serialVersionUID = -6312322926432586415L; private static final long serialVersionUID = -5169830531440825871L;
private IWebClient app; private IWebClient app;
private Properties ctx; private Properties ctx;
private LoginPanel pnlLogin; private LoginPanel pnlLogin;
@ -130,7 +132,14 @@ public class LoginWindow extends FWindow implements EventListener
getDesktop().getSession().setAttribute(Attributes.PREFERRED_LOCALE, locale); getDesktop().getSession().setAttribute(Attributes.PREFERRED_LOCALE, locale);
Locales.setThreadLocal(locale); Locales.setThreadLocal(locale);
Login login = new Login(Env.getCtx()); Login login = new Login(Env.getCtx());
loginOk(MUser.getNameOfUser(Env.getAD_User_ID(ctx)), true, login.getClients()); MUser user = MUser.get(ctx, Env.getAD_User_ID(ctx));
String loginName;
boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false);
if (email_login)
loginName = user.getEMail();
else
loginName = user.getLDAPUser() != null ? user.getLDAPUser() : user.getName();
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.changeRole(ctx); pnlRole.changeRole(ctx);