Class 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. The accessLevel 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 Detail

      • 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.
    • Constructor Detail

      • AccessLevelChecker

        public AccessLevelChecker()
    • Method Detail

      • checkAccessLevel

        public void checkAccessLevel​(String entity,
                                     String clientId,
                                     String orgId)
      • failOnZeroClient

        protected void failOnZeroClient​(String entity,
                                        String clientId)
      • failOnNonZeroClient

        protected void failOnNonZeroClient​(String entity,
                                           String clientId)
      • failOnZeroOrg

        protected void failOnZeroOrg​(String entity,
                                     String orgId)
      • failOnNonZeroOrg

        protected void failOnNonZeroOrg​(String entity,
                                        String orgId)