Package org.compiere.util
Class Login
java.lang.Object
org.compiere.util.Login
Login Manager
- Version:
- $Id: Login.java,v 1.6 2006/10/02 05:19:06 jjanke Exp $
- Author:
- Jorg Janke, victor.perez@e-evolution.com, e-Evolution http://www.e-evolution.com
- Incorrect global Variable when you use multi Account Schema https://sourceforge.net/p/adempiere/bugs/1713/, teo.sarca@gmail.com
- BF [ 2867246 ] Do not show InTrazit WHs on login https://sourceforge.net/p/adempiere/bugs/2136/
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Batch Login with system dateboolean
batchLogin
(Timestamp loginDate) Batch Login using Ini valuesstatic String
getAppUser
(String app_user) Get the user from the login textGet clients (AD_Client)getClients
(String app_user, String app_pwd) Get clients (AD_Client)getClients
(String app_user, String app_pwd, String roleTypes) Validate Client Login.getClients
(String app_user, String app_pwd, String roleTypes, Object token) Validate Client Login.
Sets Context with login info.getClients
(KeyNamePair role) Get Clients (AD_Client).Get login error messagegetOrgs
(KeyNamePair rol) Get Organizations (AD_Org).Deprecated.Deprecated, for removal: This API element is subject to removal in a future version.getRoles
(String app_user, KeyNamePair client) Get roles of usergetRoles
(String app_user, KeyNamePair client, String roleTypes) Get Roles.Deprecated, for removal: This API element is subject to removal in a future version.protected KeyNamePair[]
getRoles
(CConnection cc, String app_user, String app_pwd, boolean force) Deprecated, for removal: This API element is subject to removal in a future version.getWarehouses
(KeyNamePair org) Get Warehousesstatic Properties
initTest
(boolean isClient) Deprecated.static boolean
isJavaOK
(boolean isClient) Java Version Test, only use for client environmentboolean
isMFARequired
(String registerCookie) Validate if MFA is required taking into account the registerCookie and the IPAddressboolean
Is user password has expireloadPreferences
(KeyNamePair org, KeyNamePair warehouse, Timestamp timestamp, String printerName) Load Preferences into Context for selected client.void
Load user preferencesvalidateLogin
(KeyNamePair org) Validate Login
-
Constructor Details
-
Login
- Parameters:
ctx
- context
-
-
Method Details
-
getLoginErrMsg
Get login error message- Returns:
- login error message
-
isPasswordExpired
public boolean isPasswordExpired()Is user password has expire- Returns:
- true if user password has expire
-
initTest
Deprecated.Test Init - Set Environment for tests- Parameters:
isClient
- client session- Returns:
- Context
-
isJavaOK
public static boolean isJavaOK(boolean isClient) Java Version Test, only use for client environment- Parameters:
isClient
- client environment- Returns:
- true if Java Version is OK
-
getRoles
@Deprecated(since="2", forRemoval=true) protected KeyNamePair[] getRoles(CConnection cc, String app_user, String app_pwd, boolean force) Deprecated, for removal: This API element is subject to removal in a future version.(Test) Client Login.- Get Connection - Compare User info
Sets Context with login info
- Parameters:
cc
- connectionapp_user
- userapp_pwd
- pwdforce
- ignore pwd- Returns:
- Array of Role KeyNamePair or null if error The error (NoDatabase, UserPwdError, DBLogin) is saved in the log
-
getRoles
Deprecated, for removal: This API element is subject to removal in a future version.(Web) Client Login.Compare User Info
Sets Context with login info
- Parameters:
app_user
- Principal- Returns:
- role array or null if in error. The error (NoDatabase, UserPwdError, DBLogin) is saved in the log
-
getRoles
@Deprecated(since="2", forRemoval=true) public KeyNamePair[] getRoles(String app_user, String app_pwd) Deprecated, for removal: This API element is subject to removal in a future version.use usegetRoles(String, KeyNamePair)
Client Login.Compare User Info
Sets Context with login info
- Parameters:
app_user
- user idapp_pwd
- password- Returns:
- role array or null if in error. The error (NoDatabase, UserPwdError, DBLogin) is saved in the log
-
getClients
Get Clients (AD_Client).Sets Role info in context and loads its clients
- Parameters:
role
- role information- Returns:
- list of valid client KeyNamePairs or null if has error
-
getOrgs
Get Organizations (AD_Org).Sets Client info in context and loads organizations that the role has access to
- Parameters:
rol
- role- Returns:
- list of valid Org KeyNodePairs or null if in error
-
getWarehouses
Get Warehouses- Parameters:
org
- organization- Returns:
- Array of Warehouse Info
-
validateLogin
Validate Login- Parameters:
org
- login org- Returns:
- error message or null
-
loadPreferences
public String loadPreferences(KeyNamePair org, KeyNamePair warehouse, Timestamp timestamp, String printerName) Load Preferences into Context for selected client.Sets Org info in context and loads relevant field from - AD_Client/Info, - C_AcctSchema, - C_AcctSchema_Elements - AD_Preference
Assumes that the context is set for #AD_Client_ID, #AD_User_ID, #AD_Role_ID
- Parameters:
org
- org informationwarehouse
- optional warehouse informationtimestamp
- optional dateprinterName
- optional printer info- Returns:
- AD_Message of error (NoValidAcctInfo) or ""
-
loadUserPreferences
public void loadUserPreferences()Load user preferences -
batchLogin
Batch Login using Ini valuesAdempiere.startup(true); Ini.setProperty(Ini.P_UID,"SuperUser"); Ini.setProperty(Ini.P_PWD,"System"); Ini.setProperty(Ini.P_ROLE,"GardenAdmin"); Ini.setProperty(Ini.P_CLIENT, "Garden World"); Ini.setProperty(Ini.P_ORG,"HQ"); Ini.setProperty(Ini.P_WAREHOUSE,"HQ"); Ini.setProperty(Ini.P_LANGUAGE,"English"); Ini.setProperty(Ini.P_PRINTER,"MyPrinter"); Login login = new Login(Env.getCtx()); login.batchLogin();
- Parameters:
loginDate
- optional login date- Returns:
- true if logged in using Ini values
-
batchLogin
public boolean batchLogin()Batch Login with system date- Returns:
- true if logged in
-
getPrincipal
Deprecated.Get SSO Principal- Returns:
- principal
-
getClients
Get clients (AD_Client)- Parameters:
app_user
- login idapp_pwd
- login password- Returns:
- list of accessible client
-
getClients
Validate Client Login. Sets Context with login info.- Parameters:
app_user
- user idapp_pwd
- passwordroleTypes
- comma separated list of the role types allowed to login (NULL can be added)- Returns:
- client array or null if in error.
-
getClients
Validate Client Login.
Sets Context with login info.- Parameters:
app_user
- user idapp_pwd
- password, ignore for SSO loginroleTypes
- comma separated list of the role types allowed to login (NULL can be added)token
- token to validate SSO login user (app_user).- Returns:
- client array or null if in error.
-
getAppUser
Get the user from the login text- Parameters:
app_user
-- Returns:
- user id
-
getRoles
Get roles of user- Parameters:
app_user
-client
-- Returns:
- roles of user
-
getRoles
Get Roles.Sets Client info in context and loads its roles.
- Parameters:
client
- client informationroleTypes
- comma separated list of the role types allowed to login (NULL can be added)- Returns:
- list of valid roles KeyNodePairs or null if in error
-
getClients
Get clients (AD_Client)- Returns:
- clients
-
isMFARequired
Validate if MFA is required taking into account the registerCookie and the IPAddress- Parameters:
registerCookie
-- Returns:
-
getRoles(String, KeyNamePair)