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
public class MUser extends X_AD_User implements 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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.compiere.model.X_AD_User
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, 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_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
Constructors Constructor Description MUser(Properties ctx, int AD_User_ID, String trxName)
Default ConstructorMUser(Properties ctx, ResultSet rs, String trxName)
Load ConstructorMUser(Properties ctx, MUser copy)
MUser(Properties ctx, MUser copy, String trxName)
MUser(MUser copy)
MUser(X_C_BPartner partner)
Parent Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addDescription(String description)
Add to Descriptionprotected boolean
afterSave(boolean newRecord, boolean success)
save new pass to historyboolean
authenticateHash(String password)
check if hashed password matchesprotected boolean
beforeSave(boolean newRecord)
Before Savestatic MUser
get(int AD_User_ID)
Get User (cached) (immutable) Also loads Admninistrator (0)static MUser
get(Properties ctx)
Get Current User (cached)static MUser
get(Properties ctx, int AD_User_ID)
Get User (cached) (immutable) Also loads Admninistrator (0)static MUser
get(Properties ctx, String name)
Get User that has roles (already authenticated)static MUser
get(Properties ctx, String name, String password)
Get UserMUserBPAccess[]
getBPAccess(boolean requery)
Get active BP Access recordsstatic MUser
getCopy(Properties ctx, int AD_User_ID, String trxName)
Get updateable copy of MUser from cacheString
getEMailUser()
Get EMail User ID.String
getEMailUserPW()
Get EMail User Password.String
getEMailVerifyCode()
Get EMail Validation CodeString
getFirstName()
Get First Namejavax.mail.internet.InternetAddress
getInternetAddress()
Convert EMailString
getLastName()
Get 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 OrgString
getValue()
Get Value - 7 bit lower case alpha numerics max length 8static MUser[]
getWithRole(MRole role)
Get Users with Roleboolean
hasBPAccess(String BPAccessType, Object[] params)
Has the user Access to BP info and resourcesboolean
hasURLFormAccess(String url)
User has access to URL form?boolean
isAdministrator()
Is User an Administrator?boolean
isCanSendEMail()
Could we send an emailboolean
isEMailValid()
Is the email validboolean
isEMailVerified()
Is EMail Verified by responseboolean
isMenuAutoExpand()
Is Menu Auto Expand - user preference Check if the user has a preference, otherwise use the value from current roleboolean
isNotificationEMail()
Get Notification via EMailboolean
isNotificationNote()
Get Notification via Noteboolean
isOnline()
Is it an Online Access Userstatic boolean
isSalesRep(int AD_User_ID)
User is SalesRepMUser
markImmutable()
mark PO as immutableprotected boolean
postDelete()
Executed after the Delete operation is committed in the database.void
setEMail(String EMail)
Set EMail - reset validationboolean
setEMailVerifyCode(String code, String info)
Check and Set EMail Validation Code.void
setPassword(String password)
Convert Password to SHA-512 hash with salt * 1000 iterations https://www.owasp.org/index.php/Hashing_Javavoid
setValue(String Value)
Set Value - 7 bit lower case alpha numerics max length 8String
toString()
String Representation-
Methods inherited from class org.compiere.model.X_AD_User
get_AccessLevel, getAD_Image_ID, getAD_OrgTrx_ID, getAD_User_ID, getAD_User_UU, getAnswer, 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, 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, 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_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, 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, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, 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, 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 Detail
-
MUser
public MUser(Properties ctx, int AD_User_ID, String trxName)
Default Constructor- Parameters:
ctx
- contextAD_User_ID
- idtrxName
- transaction
-
MUser
public MUser(X_C_BPartner partner)
Parent Constructor- Parameters:
partner
- partner
-
MUser
public MUser(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- current row of result set to be loadedtrxName
- transaction
-
MUser
public MUser(MUser copy)
- Parameters:
copy
-
-
MUser
public MUser(Properties ctx, MUser copy)
- Parameters:
ctx
-copy
-
-
MUser
public MUser(Properties ctx, MUser copy, String trxName)
- Parameters:
ctx
-copy
-trxName
-
-
-
Method Detail
-
getOfBPartner
public static MUser[] getOfBPartner(Properties ctx, int C_BPartner_ID)
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
public static MUser[] getOfBPartner(Properties ctx, int C_BPartner_ID, String trxName)
Get active Users of BPartner- Parameters:
ctx
-C_BPartner_ID
-trxName
-- Returns:
- array of users
-
getWithRole
public static MUser[] getWithRole(MRole role)
Get Users with Role- Parameters:
role
- role- Returns:
- array of users
-
get
public static MUser get(int AD_User_ID)
Get User (cached) (immutable) Also loads Admninistrator (0)- Parameters:
AD_User_ID
- id- Returns:
- user
-
get
public static MUser get(Properties ctx, int AD_User_ID)
Get User (cached) (immutable) Also loads Admninistrator (0)- Parameters:
ctx
- contextAD_User_ID
- id- Returns:
- user
-
get
public static MUser get(Properties ctx)
Get Current User (cached)- Parameters:
ctx
- context- Returns:
- user
-
getCopy
public static MUser getCopy(Properties ctx, int AD_User_ID, String trxName)
Get updateable copy of MUser from cache- Parameters:
ctx
-AD_User_ID
-trxName
-- Returns:
- MUser
-
get
public static MUser get(Properties ctx, String name, String password)
Get User- Parameters:
ctx
- contextname
- namepassword
- password- Returns:
- user or null
-
getNameOfUser
public static String getNameOfUser(int AD_User_ID)
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
public String getValue()
Get Value - 7 bit lower case alpha numerics max length 8
-
setValue
public void setValue(String Value)
Set Value - 7 bit lower case alpha numerics max length 8
-
setPassword
public void setPassword(String password)
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
public boolean authenticateHash(String password)
check if hashed password matches
-
getFirstName
public String getFirstName()
Get First Name- Returns:
- first name
-
getLastName
public String getLastName()
Get Last Name- Returns:
- first name
-
addDescription
public void addDescription(String description)
Add to Description- Parameters:
description
- description to be added
-
toString
public String toString()
String Representation
-
isOnline
public boolean isOnline()
Is it an Online Access User- Returns:
- true if it has an email and password
-
setEMail
public void setEMail(String EMail)
Set EMail - reset validation
-
getInternetAddress
public javax.mail.internet.InternetAddress getInternetAddress()
Convert EMail- 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 Uwer/PW exists
-
getEMailVerifyCode
public String getEMailVerifyCode()
Get EMail Validation Code- Returns:
- code
-
setEMailVerifyCode
public boolean setEMailVerifyCode(String code, String info)
Check and Set EMail Validation 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()
Get Notification via EMail- Returns:
- true if email
-
isNotificationNote
public boolean isNotificationNote()
Get Notification via Note- Returns:
- true if note
-
getRoles
public MRole[] getRoles(int AD_Org_ID)
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 Admin
-
hasURLFormAccess
public boolean hasURLFormAccess(String url)
User has access to URL form?- Returns:
- true if user has access
-
hasBPAccess
public boolean hasBPAccess(String BPAccessType, Object[] params)
Has the user Access to BP info and resources- Parameters:
BPAccessType
- access typeparams
- opt parameter- Returns:
- true if access
-
getBPAccess
public MUserBPAccess[] getBPAccess(boolean requery)
Get active BP Access records- Parameters:
requery
- requery- Returns:
- access list
-
beforeSave
protected boolean beforeSave(boolean newRecord)
Before Save- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new- Returns:
- true
-
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:
- boolean
-
get
public static MUser get(Properties ctx, String name)
Get User that has roles (already authenticated)- Parameters:
ctx
- contextname
- name- Returns:
- user or null
-
getEMailUser
public String 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
public String 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)
save new pass to history
-
postDelete
protected boolean postDelete()
Description copied from class:PO
Executed after the Delete operation is committed in the database.- Overrides:
postDelete
in classPO
- Returns:
- true if post delete is a success
-
markImmutable
public MUser markImmutable()
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-
-