Package org.openbravo.base.validation
Class AccessLevelChecker
- java.lang.Object
-
- org.openbravo.base.validation.AccessLevelChecker
-
public class AccessLevelChecker extends Object
Provides checking logic that enforces that certain tables (== Entities) in the system only contain records (== Objects) with the correct client and organization. TheaccessLevel
of the table is used for this.System tables may only contain objects with Client id '0' and organization id '0' (=* organization)
System/Client tables may contain objects from any client but only organizations with id '0'
Organization may not contain objects with client '0' or organization '0' (client != '0' and org != '0')
Client/Organization may not contain objects with client '0', any organization is allowed
All this allows all client/organizations.
- Author:
- mtaal
-
-
Field Summary
Fields Modifier and Type Field Description static AccessLevelChecker
ALL
static AccessLevelChecker
CLIENT_ORGANIZATION
CLIENT_ORGANIZATION access level, only allows client with id unequal to id '0' and any organization.static AccessLevelChecker
ORGANIZATION
ORGANIZATION access level, only allows client and organization with id both unequal to id '0'.static AccessLevelChecker
SYSTEM
SYSTEM access level, only allows client with id '0' and organization with id '0'.static AccessLevelChecker
SYSTEM_CLIENT
SYSTEM_CLIENT access level, allows any client but only allows an organization with id '0'.
-
Constructor Summary
Constructors Constructor Description AccessLevelChecker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkAccessLevel(String entity, String clientId, String orgId)
protected void
failOnNonZeroClient(String entity, String clientId)
protected void
failOnNonZeroOrg(String entity, String orgId)
protected void
failOnZeroClient(String entity, String clientId)
protected void
failOnZeroOrg(String entity, String orgId)
-
-
-
Field Detail
-
ALL
public static final AccessLevelChecker ALL
-
SYSTEM
public static final AccessLevelChecker SYSTEM
SYSTEM access level, only allows client with id '0' and organization with id '0'.
-
SYSTEM_CLIENT
public static final AccessLevelChecker SYSTEM_CLIENT
SYSTEM_CLIENT access level, allows any client but only allows an organization with id '0'.
-
ORGANIZATION
public static final AccessLevelChecker ORGANIZATION
ORGANIZATION access level, only allows client and organization with id both unequal to id '0'.
-
CLIENT_ORGANIZATION
public static final AccessLevelChecker CLIENT_ORGANIZATION
CLIENT_ORGANIZATION access level, only allows client with id unequal to id '0' and any organization.
-
-