Package org.compiere.model
Class MUser
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_AD_User
org.compiere.model.MUser
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_AD_User
,I_Persistent
,Evaluatee
,ImmutablePOSupport
User Model
- Version:
- $Id: MUser.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, www.arhipac.ro
- FR [ 2788430 ] MUser.getOfBPartner add trxName parameter https://sourceforge.net/p/adempiere/feature-requests/714/
- See Also:
-
Field Summary
Fields inherited from class org.compiere.model.X_AD_User
AUTHENTICATIONTYPE_AD_Reference_ID, AUTHENTICATIONTYPE_ApplicationAndSSO, AUTHENTICATIONTYPE_ApplicationOnly, AUTHENTICATIONTYPE_SSOOnly, ISMENUAUTOEXPAND_AD_Reference_ID, ISMENUAUTOEXPAND_No, ISMENUAUTOEXPAND_Yes, LEADSOURCE_AD_Reference_ID, LEADSOURCE_ColdCall, LEADSOURCE_Conference, LEADSOURCE_Email, LEADSOURCE_Employee, LEADSOURCE_ExistingCustomer, LEADSOURCE_Partner, LEADSOURCE_TradeShow, LEADSOURCE_WebSite, LEADSOURCE_WordOfMouth, LEADSTATUS_AD_Reference_ID, LEADSTATUS_Converted, LEADSTATUS_Expired, LEADSTATUS_New, LEADSTATUS_Recycled, LEADSTATUS_Working, NOTIFICATIONTYPE_AD_Reference_ID, NOTIFICATIONTYPE_EMail, NOTIFICATIONTYPE_EMailPlusNotice, NOTIFICATIONTYPE_None, NOTIFICATIONTYPE_Notice
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, UUID_NEW_RECORD, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
Fields inherited from interface org.compiere.model.I_AD_User
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Image_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_OrgTrx_ID, COLUMNNAME_AD_User_ID, COLUMNNAME_AD_User_UU, COLUMNNAME_Answer, COLUMNNAME_AuthenticationType, COLUMNNAME_Birthday, COLUMNNAME_BP_Location_ID, COLUMNNAME_BPName, COLUMNNAME_C_BPartner_ID, COLUMNNAME_C_BPartner_Location_ID, COLUMNNAME_C_Campaign_ID, COLUMNNAME_C_Greeting_ID, COLUMNNAME_C_Job_ID, COLUMNNAME_C_Location_ID, COLUMNNAME_Comments, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_DateAccountLocked, COLUMNNAME_DateLastLogin, COLUMNNAME_DatePasswordChanged, COLUMNNAME_Description, COLUMNNAME_EMail, COLUMNNAME_EMailUser, COLUMNNAME_EMailUserPW, COLUMNNAME_EMailVerify, COLUMNNAME_EMailVerifyDate, COLUMNNAME_FailedLoginCount, COLUMNNAME_Fax, COLUMNNAME_IsActive, COLUMNNAME_IsAddMailTextAutomatically, COLUMNNAME_IsBillTo, COLUMNNAME_IsExpired, COLUMNNAME_IsFullBPAccess, COLUMNNAME_IsInPayroll, COLUMNNAME_IsLocked, COLUMNNAME_IsMenuAutoExpand, COLUMNNAME_IsNoExpire, COLUMNNAME_IsNoPasswordReset, COLUMNNAME_IsSalesLead, COLUMNNAME_IsShipTo, COLUMNNAME_IsSupportUser, COLUMNNAME_IsVendorLead, COLUMNNAME_LastContact, COLUMNNAME_LastResult, COLUMNNAME_LDAPUser, COLUMNNAME_LeadSource, COLUMNNAME_LeadSourceDescription, COLUMNNAME_LeadStatus, COLUMNNAME_LeadStatusDescription, COLUMNNAME_Name, COLUMNNAME_NotificationType, COLUMNNAME_Password, COLUMNNAME_Phone, COLUMNNAME_Phone2, COLUMNNAME_Processing, COLUMNNAME_R_DefaultMailText_ID, COLUMNNAME_SalesRep_ID, COLUMNNAME_Salt, COLUMNNAME_SecurityQuestion, COLUMNNAME_Supervisor_ID, COLUMNNAME_Title, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_UserPIN, COLUMNNAME_Value, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMUser
(Properties ctx, int AD_User_ID, String trxName) Default ConstructorMUser
(Properties ctx, String AD_User_UU, String trxName) UUID based ConstructorMUser
(Properties ctx, ResultSet rs, String trxName) Load ConstructorMUser
(Properties ctx, MUser copy) Copy constructorMUser
(Properties ctx, MUser copy, String trxName) Copy constructorCopy constructorMUser
(X_C_BPartner partner) Parent Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDescription
(String description) Add to Descriptionprotected boolean
afterSave
(boolean newRecord, boolean success) Called after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.boolean
authenticateHash
(String password) check if hashed password matchesprotected boolean
beforeSave
(boolean newRecord) Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.static MUser
get
(int AD_User_ID) Get User (cached) (immutable).static MUser
get
(Properties ctx) Get Current User (cached)static MUser
get
(Properties ctx, int AD_User_ID) Get User (cached) (immutable).static MUser
get
(Properties ctx, String name) Get User that has roles (already authenticated)static MUser
get
(Properties ctx, String name, String password) Get user via name and passwordstatic MUser
get
(Properties ctx, String name, String password, boolean isSSOLogin) Get User via name and passwordgetBPAccess
(boolean requery) Get active BP Access recordsstatic MUser
getCopy
(Properties ctx, int AD_User_ID, String trxName) Get updateable copy of MUser from cacheGet EMail User ID.Get EMail User Password.Get EMail Verification CodeGet First Namejavax.mail.internet.InternetAddress
Convert EMail to InternetAddressGet Last Namestatic String
getNameOfUser
(int AD_User_ID) Get Name of AD_Userstatic MUser[]
getOfBPartner
(Properties ctx, int C_BPartner_ID) Deprecated.Since 3.5.3a.static MUser[]
getOfBPartner
(Properties ctx, int C_BPartner_ID, String trxName) Get active Users of BPartnerMRole[]
getRoles
(int AD_Org_ID) Get User Roles for OrggetValue()
Get Valuestatic MUser[]
getWithRole
(MRole role) Get Users with Roleboolean
hasBPAccess
(String BPAccessType, Object[] params) Is user has access to BP info and resourcesboolean
hasURLFormAccess
(String url) User has access to URL form?boolean
Is User an Administrator?boolean
Could we send an emailboolean
Is the email validboolean
Is EMail Verified by responseboolean
Is Menu Auto Expand - user preference.
Check if the user has a preference, otherwise use the value from current role.boolean
Is Notification via EMailboolean
Is Notification via Noteboolean
isOnline()
Is it an Online Access Userstatic boolean
isSalesRep
(int AD_User_ID) User is SalesRepmark PO as immutableprotected boolean
Execute after the Delete operation have been committed to database.
Default implementation is nop, to be implemented in sub-classes that needed it.void
Set EMail - reset email validation dateboolean
setEMailVerifyCode
(String code, String info) Check and Set EMail Verification Code.void
setPassword
(String password) Convert Password to SHA-512 hash with salt * 1000 iterations https://www.owasp.org/index.php/Hashing_Javavoid
Set Value - lower case alpha numerics and max length of 8.
If Value is null, use LDAPUser or Name or the "noname" string instead.toString()
String RepresentationMethods inherited from class org.compiere.model.X_AD_User
get_AccessLevel, getAD_Image_ID, getAD_OrgTrx_ID, getAD_User_ID, getAD_User_UU, getAnswer, getAuthenticationType, getBirthday, getBP_Location, getBP_Location_ID, getBPName, getC_BPartner, getC_BPartner_ID, getC_BPartner_Location, getC_BPartner_Location_ID, getC_Campaign, getC_Campaign_ID, getC_Greeting, getC_Greeting_ID, getC_Job, getC_Job_ID, getC_Location, getC_Location_ID, getComments, getDateAccountLocked, getDateLastLogin, getDatePasswordChanged, getDescription, getEMail, getEMailVerify, getEMailVerifyDate, getFailedLoginCount, getFax, getIsMenuAutoExpand, getKeyNamePair, getLastContact, getLastResult, getLDAPUser, getLeadSource, getLeadSourceDescription, getLeadStatus, getLeadStatusDescription, getName, getNotificationType, getPassword, getPhone, getPhone2, getR_DefaultMailText, getR_DefaultMailText_ID, getSalesRep, getSalesRep_ID, getSalt, getSecurityQuestion, getSupervisor, getSupervisor_ID, getTitle, getUserPIN, initPO, isAddMailTextAutomatically, isBillTo, isExpired, isFullBPAccess, isInPayroll, isLocked, isNoExpire, isNoPasswordReset, isProcessing, isSalesLead, isShipTo, isSupportUser, isVendorLead, setAD_Image_ID, setAD_OrgTrx_ID, setAD_User_ID, setAD_User_UU, setAnswer, setAuthenticationType, setBirthday, setBP_Location_ID, setBPName, setC_BPartner_ID, setC_BPartner_Location_ID, setC_Campaign_ID, setC_Greeting_ID, setC_Job_ID, setC_Location_ID, setComments, setDateAccountLocked, setDateLastLogin, setDatePasswordChanged, setDescription, setEMailUser, setEMailUserPW, setEMailVerify, setEMailVerifyDate, setFailedLoginCount, setFax, setIsAddMailTextAutomatically, setIsBillTo, setIsExpired, setIsFullBPAccess, setIsInPayroll, setIsLocked, setIsMenuAutoExpand, setIsNoExpire, setIsNoPasswordReset, setIsSalesLead, setIsShipTo, setIsSupportUser, setIsVendorLead, setLastContact, setLastResult, setLDAPUser, setLeadSource, setLeadSourceDescription, setLeadStatus, setLeadStatusDescription, setName, setNotificationType, setPhone, setPhone2, setProcessing, setR_DefaultMailText_ID, setSalesRep_ID, setSalt, setSecurityQuestion, setSupervisor_ID, setTitle, setUserPIN
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, buildInsertSQL, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, toInsertSQL, unlock, update_Tree, validForeignKeys
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.compiere.model.I_AD_User
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
Methods inherited from interface org.compiere.model.I_Persistent
save
-
Constructor Details
-
MUser
UUID based Constructor- Parameters:
ctx
- ContextAD_User_UU
- UUID keytrxName
- Transaction
-
MUser
Default Constructor- Parameters:
ctx
- contextAD_User_ID
- idtrxName
- transaction
-
MUser
Parent Constructor- Parameters:
partner
- partner
-
MUser
Load Constructor- Parameters:
ctx
- contextrs
- current row of result set to be loadedtrxName
- transaction
-
MUser
Copy constructor- Parameters:
copy
-
-
MUser
Copy constructor- Parameters:
ctx
-copy
-
-
MUser
Copy constructor- Parameters:
ctx
-copy
-trxName
-
-
-
Method Details
-
getOfBPartner
Deprecated.Since 3.5.3a. Please usegetOfBPartner(Properties, int, String)
.Get active Users of BPartner- Parameters:
ctx
- contextC_BPartner_ID
- id- Returns:
- array of users
-
getOfBPartner
Get active Users of BPartner- Parameters:
ctx
-C_BPartner_ID
-trxName
-- Returns:
- array of users
-
getWithRole
Get Users with Role- Parameters:
role
- role- Returns:
- array of users
-
get
Get User (cached) (immutable). Also loads Administrator (0).- Parameters:
AD_User_ID
- id- Returns:
- user
-
get
Get User (cached) (immutable). Also loads Administrator (0).- Parameters:
ctx
- contextAD_User_ID
- id- Returns:
- user
-
get
Get Current User (cached)- Parameters:
ctx
- context- Returns:
- user
-
getCopy
Get updateable copy of MUser from cache- Parameters:
ctx
-AD_User_ID
-trxName
-- Returns:
- MUser
-
get
Get user via name and password- Parameters:
ctx
-name
-password
-- Returns:
- user
-
get
Get User via name and password- Parameters:
ctx
- contextname
- namepassword
- passwordisSSOLogin
- when isSSOLogin is true, password is ignored.- Returns:
- user or null
-
getNameOfUser
Get Name of AD_User- Parameters:
AD_User_ID
- System User- Returns:
- Name of user or ?
-
isSalesRep
public static boolean isSalesRep(int AD_User_ID) User is SalesRep- Parameters:
AD_User_ID
- user- Returns:
- true if sales rep
-
getValue
Get Value -
setValue
Set Value - lower case alpha numerics and max length of 8.
If Value is null, use LDAPUser or Name or the "noname" string instead. -
setPassword
Convert Password to SHA-512 hash with salt * 1000 iterations https://www.owasp.org/index.php/Hashing_Java- Specified by:
setPassword
in interfaceI_AD_User
- Overrides:
setPassword
in classX_AD_User
- Parameters:
password
- -- plain text password
-
authenticateHash
check if hashed password matches -
getFirstName
Get First Name- Returns:
- first name
-
getLastName
Get Last Name- Returns:
- first name
-
addDescription
Add to Description- Parameters:
description
- description to be added
-
toString
String Representation -
isOnline
public boolean isOnline()Is it an Online Access User- Returns:
- true if it has an email or password
-
setEMail
Set EMail - reset email validation date -
getInternetAddress
public javax.mail.internet.InternetAddress getInternetAddress()Convert EMail to InternetAddress- Returns:
- Valid Internet Address
-
isEMailValid
public boolean isEMailValid()Is the email valid- Returns:
- return true if email is valid (artificial check)
-
isCanSendEMail
public boolean isCanSendEMail()Could we send an email- Returns:
- true if EMail User/PW exists
-
getEMailVerifyCode
Get EMail Verification Code- Returns:
- code
-
setEMailVerifyCode
Check and Set EMail Verification Code.- Parameters:
code
- codeinfo
- info- Returns:
- true if valid
-
isEMailVerified
public boolean isEMailVerified()Is EMail Verified by response- Returns:
- true if verified
-
isNotificationEMail
public boolean isNotificationEMail()Is Notification via EMail- Returns:
- true if use email for notification
-
isNotificationNote
public boolean isNotificationNote()Is Notification via Note- Returns:
- true if use note for notification
-
getRoles
Get User Roles for Org- Parameters:
AD_Org_ID
- org- Returns:
- array of roles
-
isAdministrator
public boolean isAdministrator()Is User an Administrator?- Returns:
- true if user is Administrator
-
hasURLFormAccess
User has access to URL form?- Parameters:
url
- form class name- Returns:
- true if user has access
-
hasBPAccess
Is user has access to BP info and resources- Parameters:
BPAccessType
- access typeparams
- opt parameter- Returns:
- true if access
-
getBPAccess
Get active BP Access records- Parameters:
requery
- requery- Returns:
- access list
-
beforeSave
protected boolean beforeSave(boolean newRecord) Description copied from class:PO
Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- true if it is a new record- Returns:
- true if record can be saved
-
isMenuAutoExpand
public boolean isMenuAutoExpand()Is Menu Auto Expand - user preference.
Check if the user has a preference, otherwise use the value from current role.- Returns:
- true if application menu should auto expand
-
get
Get User that has roles (already authenticated)- Parameters:
ctx
- contextname
- name- Returns:
- user or null
-
getEMailUser
Description copied from class:X_AD_User
Get EMail User ID.- Specified by:
getEMailUser
in interfaceI_AD_User
- Overrides:
getEMailUser
in classX_AD_User
- Returns:
- User Name (ID) in the Mail System
-
getEMailUserPW
Description copied from class:X_AD_User
Get EMail User Password.- Specified by:
getEMailUserPW
in interfaceI_AD_User
- Overrides:
getEMailUserPW
in classX_AD_User
- Returns:
- Password of your email user id
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success) Description copied from class:PO
Called after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it. -
postDelete
protected boolean postDelete()Description copied from class:PO
Execute after the Delete operation have been committed to database.
Default implementation is nop, to be implemented in sub-classes that needed it.- Overrides:
postDelete
in classPO
- Returns:
- true if post delete is a success
-
markImmutable
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-