Adempiere 3.5.2a

org.compiere.model
Class MRole

java.lang.Object
  extended by org.compiere.model.PO
      extended by org.compiere.model.X_AD_Role
          extended by org.compiere.model.MRole
All Implemented Interfaces:
Serializable, Comparator, I_AD_Role, I_Persistent, Evaluatee

public final class MRole
extends X_AD_Role

Role Model. Includes AD_User runtime info for Personal Access The class is final, so that you cannot overwrite the security rules.

Version:
$Id: MRole.java,v 1.5 2006/08/09 16:38:47 jjanke Exp $
Author:
Jorg Janke, Karsten Thiemann FR [ 1782412 ], Carlos Ruiz - globalqss - FR [ 1846929 ] - implement ASP
See Also:
Serialized Form

Field Summary
static boolean SQL_FULLYQUALIFIED
          Access SQL Fully Qualified
static boolean SQL_NOTQUALIFIED
          Access SQL Not Fully Qualified
static boolean SQL_RO
          Access SQL Read Only
static boolean SQL_RW
          Access SQL Read Write
static int SUPERUSER_USER_ID
          The AD_User_ID of the SuperUser
static int SYSTEM_USER_ID
          The AD_User_ID of the System Administrator
 
Fields inherited from class org.compiere.model.X_AD_Role
AD_TREE_MENU_ID_AD_Reference_ID, AD_TREE_ORG_ID_AD_Reference_ID, CONNECTIONPROFILE_AD_Reference_ID, CONNECTIONPROFILE_LAN, CONNECTIONPROFILE_TerminalServer, CONNECTIONPROFILE_VPN, CONNECTIONPROFILE_WAN, PREFERENCETYPE_AD_Reference_ID, PREFERENCETYPE_Client, PREFERENCETYPE_None, PREFERENCETYPE_Organization, PREFERENCETYPE_User, SUPERVISOR_ID_AD_Reference_ID, USERLEVEL_AD_Reference_ID, USERLEVEL_Client, USERLEVEL_ClientPlusOrganization, USERLEVEL_Organization, USERLEVEL_System
 
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, log, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
 
Fields inherited from interface org.compiere.model.I_AD_Role
accessLevel, COLUMNNAME_AD_Role_ID, COLUMNNAME_AD_Tree_Menu_ID, COLUMNNAME_AD_Tree_Org_ID, COLUMNNAME_Allow_Info_Account, COLUMNNAME_Allow_Info_Asset, COLUMNNAME_Allow_Info_BPartner, COLUMNNAME_Allow_Info_CashJournal, COLUMNNAME_Allow_Info_CRP, COLUMNNAME_Allow_Info_InOut, COLUMNNAME_Allow_Info_Invoice, COLUMNNAME_Allow_Info_MRP, COLUMNNAME_Allow_Info_Order, COLUMNNAME_Allow_Info_Payment, COLUMNNAME_Allow_Info_Product, COLUMNNAME_Allow_Info_Resource, COLUMNNAME_Allow_Info_Schedule, COLUMNNAME_AmtApproval, COLUMNNAME_C_Currency_ID, COLUMNNAME_ConfirmQueryRecords, COLUMNNAME_ConnectionProfile, COLUMNNAME_Description, COLUMNNAME_IsAccessAllOrgs, COLUMNNAME_IsCanApproveOwnDoc, COLUMNNAME_IsCanExport, COLUMNNAME_IsCanReport, COLUMNNAME_IsChangeLog, COLUMNNAME_IsManual, COLUMNNAME_IsPersonalAccess, COLUMNNAME_IsPersonalLock, COLUMNNAME_IsShowAcct, COLUMNNAME_IsUseUserOrgAccess, COLUMNNAME_MaxQueryRecords, COLUMNNAME_Name, COLUMNNAME_OverwritePriceLimit, COLUMNNAME_PreferenceType, COLUMNNAME_Supervisor_ID, COLUMNNAME_UserDiscount, COLUMNNAME_UserLevel, Model, Table_ID, Table_Name
 
Constructor Summary
MRole(Properties ctx, int AD_Role_ID, String trxName)
          Standard Constructor
MRole(Properties ctx, ResultSet rs, String trxName)
          Load Constructor
 
Method Summary
 String addAccessSQL(String SQL, String TableNameIn, boolean fullyQualified, boolean rw)
          Appends where clause to SQL statement for Table
protected  boolean afterDelete(boolean success)
          Executed after Delete operation.
protected  boolean afterSave(boolean newRecord, boolean success)
          After Save
protected  boolean beforeSave(boolean newRecord)
          Before Save
 boolean canUpdate(int AD_Client_ID, int AD_Org_ID, int AD_Table_ID, int Record_ID, boolean createError)
          UPADATE - Can I Update the record.
 boolean canView(Properties ctx, String TableLevel)
          VIEW - Can I view record in Table with given TableLevel.
static MRole get(Properties ctx, int AD_Role_ID)
          Get Role (cached).
static MRole get(Properties ctx, int AD_Role_ID, int AD_User_ID, boolean reload)
          Get Role for User
 int getAD_User_ID()
          Get Logged in user
 String getClientWhere(boolean rw)
          Get Client Where Clause Value
 int getConfirmQueryRecords()
          Get Confirm Query Records
static MRole getDefault()
          Get Default (Client) Role
static MRole getDefault(Properties ctx, boolean reload)
          Get/Set Default Role.
 Boolean getFormAccess(int AD_Form_ID)
          Get Form Access
static MRole[] getOf(Properties ctx, String whereClause)
          Get Roles With where clause
static MRole[] getOfClient(Properties ctx)
          Get Roles Of Client
 String getOrgWhere(boolean rw)
          Get Org Where Clause Value
 Boolean getProcessAccess(int AD_Process_ID)
          Get Process Access
 Boolean getTaskAccess(int AD_Task_ID)
          Get Task Access
 Boolean getWindowAccess(int AD_Window_ID)
          Get Window Access
 Boolean getWorkflowAccess(int AD_Workflow_ID)
          Get Workflow Access
 boolean isCanExport(int AD_Table_ID)
          Can Export Table
 boolean isCanReport(int AD_Table_ID)
          Can Report on table
 boolean isClientAccess(int AD_Client_ID, boolean rw)
          Access to Client
 boolean isColumnAccess(int AD_Table_ID, int AD_Column_ID, boolean ro)
          Access to Column
 boolean isOrgAccess(int AD_Org_ID, boolean rw)
          Access to Org
 boolean isQueryMax(int noRecords)
          Over max Query
 boolean isQueryRequire(int noRecords)
          Require Query
 boolean isRecordAccess(int AD_Table_ID, int Record_ID, boolean ro)
          Access to Record (no check of table)
 boolean isShowPreference()
          Show (Value) Preference Menu
 boolean isTableAccess(int AD_Table_ID, boolean ro)
          Access to Table
 boolean isTableAccessLevel(int AD_Table_ID, boolean ro)
          Access to Table based on Role User Level Table Access Level
 void loadAccess(boolean reload)
          Load Access Info
 void setAD_User_ID(int AD_User_ID)
          Set Logged in user
 String toString()
          String Representation
 String toStringX(Properties ctx)
          Extended String Representation
 String updateAccessRecords()
          Create Access Records
 
Methods inherited from class org.compiere.model.X_AD_Role
get_AccessLevel, getAD_Role_ID, getAD_Tree_Menu_ID, getAD_Tree_Org_ID, getAmtApproval, getC_Currency_ID, getC_Currency, getConnectionProfile, getDescription, getKeyNamePair, getMaxQueryRecords, getName, getPreferenceType, getSupervisor_ID, getUserDiscount, getUserLevel, initPO, isAccessAllOrgs, isAllow_Info_Account, isAllow_Info_Asset, isAllow_Info_BPartner, isAllow_Info_CashJournal, isAllow_Info_CRP, isAllow_Info_InOut, isAllow_Info_Invoice, isAllow_Info_MRP, isAllow_Info_Order, isAllow_Info_Payment, isAllow_Info_Product, isAllow_Info_Resource, isAllow_Info_Schedule, isCanApproveOwnDoc, isCanExport, isCanReport, isChangeLog, isManual, isOverwritePriceLimit, isPersonalAccess, isPersonalLock, isShowAcct, isUseUserOrgAccess, setAD_Role_ID, setAD_Tree_Menu_ID, setAD_Tree_Org_ID, setAllow_Info_Account, setAllow_Info_Asset, setAllow_Info_BPartner, setAllow_Info_CashJournal, setAllow_Info_CRP, setAllow_Info_InOut, setAllow_Info_Invoice, setAllow_Info_MRP, setAllow_Info_Order, setAllow_Info_Payment, setAllow_Info_Product, setAllow_Info_Resource, setAllow_Info_Schedule, setAmtApproval, setC_Currency_ID, setConfirmQueryRecords, setConnectionProfile, setDescription, setIsAccessAllOrgs, setIsCanApproveOwnDoc, setIsCanExport, setIsCanReport, setIsChangeLog, setIsManual, setIsPersonalAccess, setIsPersonalLock, setIsShowAcct, setIsUseUserOrgAccess, setMaxQueryRecords, setName, setOverwritePriceLimit, setPreferenceType, setSupervisor_ID, setUserDiscount, setUserLevel
 
Methods inherited from class org.compiere.model.PO
beforeDelete, compare, copyValues, copyValues, createAttachment, delete_Accounting, delete_Tree, delete, delete, deleteEx, deleteEx, dump, dump, equals, 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_Table_ID, get_TableName, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_new, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadComplete, loadDefaults, loadSpecial, lock, save, save, saveEx, saveEx, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_ColumnUpdateable, set_CustomColumn, set_TrxName, set_TrxName, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setDoc, setDocWorkflowMgr, setIsActive, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, unlock
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.compiere.model.I_Persistent
save
 

Field Detail

SQL_RW

public static final boolean SQL_RW
Access SQL Read Write

See Also:
Constant Field Values

SQL_RO

public static final boolean SQL_RO
Access SQL Read Only

See Also:
Constant Field Values

SQL_FULLYQUALIFIED

public static final boolean SQL_FULLYQUALIFIED
Access SQL Fully Qualified

See Also:
Constant Field Values

SQL_NOTQUALIFIED

public static final boolean SQL_NOTQUALIFIED
Access SQL Not Fully Qualified

See Also:
Constant Field Values

SUPERUSER_USER_ID

public static final int SUPERUSER_USER_ID
The AD_User_ID of the SuperUser

See Also:
Constant Field Values

SYSTEM_USER_ID

public static final int SYSTEM_USER_ID
The AD_User_ID of the System Administrator

See Also:
Constant Field Values
Constructor Detail

MRole

public MRole(Properties ctx,
             int AD_Role_ID,
             String trxName)
Standard Constructor

Parameters:
ctx - context
AD_Role_ID - id
trxName - transaction

MRole

public MRole(Properties ctx,
             ResultSet rs,
             String trxName)
Load Constructor

Parameters:
ctx - context
rs - result set
trxName - transaction
Method Detail

getDefault

public static MRole getDefault()
Get Default (Client) Role

Returns:
role

getDefault

public static MRole getDefault(Properties ctx,
                               boolean reload)
Get/Set Default Role.

Parameters:
ctx - context
reload - if true forces load
Returns:
role
See Also:
Login.loadPreferences(KeyNamePair, KeyNamePair, java.sql.Timestamp, String)

get

public static MRole get(Properties ctx,
                        int AD_Role_ID,
                        int AD_User_ID,
                        boolean reload)
Get Role for User

Parameters:
ctx - context
AD_Role_ID - role
AD_User_ID - user
reload - if true forces load
Returns:
role

get

public static MRole get(Properties ctx,
                        int AD_Role_ID)
Get Role (cached). Did not set user - so no access loaded

Parameters:
ctx - context
AD_Role_ID - role
Returns:
role

getOfClient

public static MRole[] getOfClient(Properties ctx)
Get Roles Of Client

Parameters:
ctx - context
Returns:
roles of client

getOf

public static MRole[] getOf(Properties ctx,
                            String whereClause)
Get Roles With where clause

Parameters:
ctx - context
whereClause - where clause
Returns:
roles of client

getConfirmQueryRecords

public int getConfirmQueryRecords()
Get Confirm Query Records

Specified by:
getConfirmQueryRecords in interface I_AD_Role
Overrides:
getConfirmQueryRecords in class X_AD_Role
Returns:
entered records or 500 (default)

isQueryRequire

public boolean isQueryRequire(int noRecords)
Require Query

Parameters:
noRecords - records
Returns:
true if query required

isQueryMax

public boolean isQueryMax(int noRecords)
Over max Query

Parameters:
noRecords - records
Returns:
true if over max query

beforeSave

protected boolean beforeSave(boolean newRecord)
Before Save

Overrides:
beforeSave in class PO
Parameters:
newRecord - new
Returns:
true if it can be saved

afterSave

protected boolean afterSave(boolean newRecord,
                            boolean success)
After Save

Overrides:
afterSave in class PO
Parameters:
newRecord - new
success - success
Returns:
success

afterDelete

protected boolean afterDelete(boolean success)
Executed after Delete operation.

Overrides:
afterDelete in class PO
Parameters:
success - true if record deleted
Returns:
true if delete is a success

updateAccessRecords

public String updateAccessRecords()
Create Access Records

Returns:
info

toString

public String toString()
String Representation

Overrides:
toString in class X_AD_Role
Returns:
info

toStringX

public String toStringX(Properties ctx)
Extended String Representation

Parameters:
ctx - Properties
Returns:
extended info

setAD_User_ID

public void setAD_User_ID(int AD_User_ID)
Set Logged in user

Parameters:
AD_User_ID - user requesting info

getAD_User_ID

public int getAD_User_ID()
Get Logged in user

Returns:
AD_User_ID user requesting info

loadAccess

public void loadAccess(boolean reload)
Load Access Info

Parameters:
reload - re-load from disk

getClientWhere

public String getClientWhere(boolean rw)
Get Client Where Clause Value

Parameters:
rw - read write
Returns:
"AD_Client_ID=0" or "AD_Client_ID IN(0,1)"

isClientAccess

public boolean isClientAccess(int AD_Client_ID,
                              boolean rw)
Access to Client

Parameters:
AD_Client_ID - client
rw - read write access
Returns:
true if access

getOrgWhere

public String getOrgWhere(boolean rw)
Get Org Where Clause Value

Parameters:
rw - read write
Returns:
"AD_Org_ID=0" or "AD_Org_ID IN(0,1)" or null (if access all org)

isOrgAccess

public boolean isOrgAccess(int AD_Org_ID,
                           boolean rw)
Access to Org

Parameters:
AD_Org_ID - org
rw - read write access
Returns:
true if access

isCanReport

public boolean isCanReport(int AD_Table_ID)
Can Report on table

Parameters:
AD_Table_ID - table
Returns:
true if access

isCanExport

public boolean isCanExport(int AD_Table_ID)
Can Export Table

Parameters:
AD_Table_ID -
Returns:
true if access

isTableAccess

public boolean isTableAccess(int AD_Table_ID,
                             boolean ro)
Access to Table

Parameters:
AD_Table_ID - table
ro - check read only access otherwise read write access level
Returns:
has RO/RW access to table

isTableAccessLevel

public boolean isTableAccessLevel(int AD_Table_ID,
                                  boolean ro)
Access to Table based on Role User Level Table Access Level

Parameters:
AD_Table_ID - table
ro - check read only access otherwise read write access level
Returns:
has RO/RW access to table

isColumnAccess

public boolean isColumnAccess(int AD_Table_ID,
                              int AD_Column_ID,
                              boolean ro)
Access to Column

Parameters:
AD_Table_ID - table
AD_Column_ID - column
ro - read only
Returns:
true if access

isRecordAccess

public boolean isRecordAccess(int AD_Table_ID,
                              int Record_ID,
                              boolean ro)
Access to Record (no check of table)

Parameters:
AD_Table_ID - table
Record_ID - record
ro - read only
Returns:
boolean

getWindowAccess

public Boolean getWindowAccess(int AD_Window_ID)
Get Window Access

Parameters:
AD_Window_ID - window
Returns:
null in no access, TRUE if r/w and FALSE if r/o

getProcessAccess

public Boolean getProcessAccess(int AD_Process_ID)
Get Process Access

Parameters:
AD_Process_ID - process
Returns:
null in no access, TRUE if r/w and FALSE if r/o

getTaskAccess

public Boolean getTaskAccess(int AD_Task_ID)
Get Task Access

Parameters:
AD_Task_ID - task
Returns:
null in no access, TRUE if r/w and FALSE if r/o

getFormAccess

public Boolean getFormAccess(int AD_Form_ID)
Get Form Access

Parameters:
AD_Form_ID - form
Returns:
null in no access, TRUE if r/w and FALSE if r/o

getWorkflowAccess

public Boolean getWorkflowAccess(int AD_Workflow_ID)
Get Workflow Access

Parameters:
AD_Workflow_ID - workflow
Returns:
null in no access, TRUE if r/w and FALSE if r/o

addAccessSQL

public String addAccessSQL(String SQL,
                           String TableNameIn,
                           boolean fullyQualified,
                           boolean rw)
Appends where clause to SQL statement for Table

Parameters:
SQL - existing SQL statement
TableNameIn - Table Name or list of table names AAA, BBB or AAA a, BBB b
fullyQualified - fullyQualified names
rw - if false, includes System Data
Returns:
updated SQL statement

canUpdate

public boolean canUpdate(int AD_Client_ID,
                         int AD_Org_ID,
                         int AD_Table_ID,
                         int Record_ID,
                         boolean createError)
UPADATE - Can I Update the record. Access error info (AccessTableNoUpdate) is saved in the log

Parameters:
AD_Client_ID - comntext to derive client/org/user level
AD_Org_ID - number of the current window to retrieve context
AD_Table_ID - table
Record_ID - record id
createError - boolean
Returns:
true if you can update see org.compiere.model.MTable#dataSave(boolean)

canView

public boolean canView(Properties ctx,
                       String TableLevel)
VIEW - Can I view record in Table with given TableLevel. TableLevel S__ 100 4 System info SCO 111 7 System shared info SC_ 110 6 System/Client info _CO 011 3 Client shared info _C_ 011 2 Client shared info __O 001 1 Organization info

Parameters:
ctx - context
TableLevel - AccessLevel
Returns:
true/false Access error info (AccessTableNoUpdate, AccessTableNoView) is saved in the log see org.compiere.model.MTabVO#loadTabDetails(MTabVO, ResultSet)

isShowPreference

public boolean isShowPreference()
Show (Value) Preference Menu

Returns:
true if preference type is not None

Adempiere 3.5.2a

Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.