Class 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:
    • Constructor Details

      • MUser

        public MUser(Properties ctx, String AD_User_UU, String trxName)
        UUID based Constructor
        Parameters:
        ctx - Context
        AD_User_UU - UUID key
        trxName - Transaction
      • MUser

        public MUser(Properties ctx, int AD_User_ID, String trxName)
        Default Constructor
        Parameters:
        ctx - context
        AD_User_ID - id
        trxName - 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 - context
        rs - current row of result set to be loaded
        trxName - transaction
      • MUser

        public MUser(MUser copy)
        Copy constructor
        Parameters:
        copy -
      • MUser

        public MUser(Properties ctx, MUser copy)
        Copy constructor
        Parameters:
        ctx -
        copy -
      • MUser

        public MUser(Properties ctx, MUser copy, String trxName)
        Copy constructor
        Parameters:
        ctx -
        copy -
        trxName -
    • Method Details

      • getOfBPartner

        public static MUser[] getOfBPartner(Properties ctx, int C_BPartner_ID)
        Deprecated.
        Since 3.5.3a. Please use getOfBPartner(Properties, int, String).
        Get active Users of BPartner
        Parameters:
        ctx - context
        C_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 Administrator (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 Administrator (0).
        Parameters:
        ctx - context
        AD_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 via name and password
        Parameters:
        ctx -
        name -
        password -
        Returns:
        user
      • get

        public static MUser get(Properties ctx, String name, String password, boolean isSSOLogin)
        Get User via name and password
        Parameters:
        ctx - context
        name - name
        password - password
        isSSOLogin - when isSSOLogin is true, password is ignored.
        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
        Specified by:
        getValue in interface I_AD_User
        Overrides:
        getValue in class X_AD_User
        Returns:
        value
      • setValue

        public void setValue(String Value)
        Set Value - lower case alpha numerics and max length of 8.
        If Value is null, use LDAPUser or Name or the "noname" string instead.
        Specified by:
        setValue in interface I_AD_User
        Overrides:
        setValue in class X_AD_User
        Parameters:
        Value -
      • 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 interface I_AD_User
        Overrides:
        setPassword in class X_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
        Overrides:
        toString in class X_AD_User
        Returns:
        Info
      • isOnline

        public boolean isOnline()
        Is it an Online Access User
        Returns:
        true if it has an email or password
      • setEMail

        public void setEMail(String EMail)
        Set EMail - reset email validation date
        Specified by:
        setEMail in interface I_AD_User
        Overrides:
        setEMail in class X_AD_User
        Parameters:
        EMail - email
      • 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

        public String getEMailVerifyCode()
        Get EMail Verification Code
        Returns:
        code
      • setEMailVerifyCode

        public boolean setEMailVerifyCode(String code, String info)
        Check and Set EMail Verification Code.
        Parameters:
        code - code
        info - 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

        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 user is Administrator
      • hasURLFormAccess

        public boolean hasURLFormAccess(String url)
        User has access to URL form?
        Parameters:
        url - form class name
        Returns:
        true if user has access
      • hasBPAccess

        public boolean hasBPAccess(String BPAccessType, Object[] params)
        Is user has access to BP info and resources
        Parameters:
        BPAccessType - access type
        params - 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)
        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 class PO
        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

        public static MUser get(Properties ctx, String name)
        Get User that has roles (already authenticated)
        Parameters:
        ctx - context
        name - name
        Returns:
        user or null
      • getEMailUser

        public String getEMailUser()
        Description copied from class: X_AD_User
        Get EMail User ID.
        Specified by:
        getEMailUser in interface I_AD_User
        Overrides:
        getEMailUser in class X_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 interface I_AD_User
        Overrides:
        getEMailUserPW in class X_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.
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - true if it is a new record
        success - true if save operation was success
        Returns:
        if save was a success
      • 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 class PO
        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 interface ImmutablePOSupport
        Returns:
        PO