Class AccessControlList

java.lang.Object
com.jalios.jstore.BasicStorable
com.jalios.jcms.Data
com.jalios.jcms.accesscontrol.AccessControlList
All Implemented Interfaces:
AccessControlConstants, EditableData, JcmsConstants, ImportConstants, MashupConstants, Storable, JaliosConstants, LangPropertyArgument, Cloneable, Comparable<BasicStorable>

public class AccessControlList extends Data implements AccessControlConstants, EditableData
Define a collection of resources and their associated authorization.
Since:
jcms-7.0
  • Field Details

    • name

      protected String name
    • isWorkspaceACL

      protected boolean isWorkspaceACL
    • isAdminOnly

      protected boolean isAdminOnly
    • explicitResourceToAuthorizationMap

      protected HashMap<String,Boolean> explicitResourceToAuthorizationMap
  • Constructor Details

    • AccessControlList

      public AccessControlList()
      Builds a new AccessControlList without any authorization and using default value.
      Since:
      jcms-7.0.0
    • AccessControlList

      public AccessControlList(AccessControlList other)
      Builds a new AccessControlList by copying all authorization and option of the specified ACL.
      Parameters:
      other - the ACl from which to copy fields
      Since:
      jcms-7.0.0
  • Method Details

    • getDataName

      public String getDataName(String language)
      Description copied from class: Data
      Return the name of this Data, every sub class Data which will be displayed to user should implements this method already.
      • The Title (multi-language) for a Publication.
      • The Name (multi-language) for a Category.
      • The Name for a Group, a Member.
      • The Title (multi-language) for a Workspace.
      Can be seen as a smart multi-language toString(), but never returning null.
      Default behaviour is to return toFullString() of Data or empty string if toFullString is null.
      Overrides:
      getDataName in class Data
      Parameters:
      language - the language in which to return the name if multilang available for the data.
      Returns:
      name of ACL or empty String if not specified.
      Since:
      jcms-7.0
      See Also:
    • getName

      public String getName()
      Gets the name of this ACL.
      Returns:
      the acl's name or an empty string if the name has not been set.
      Since:
      jcms-7.0.0
    • setName

      public void setName(String name)
      Set the name of this ACL.
      Parameters:
      name - the name to use.
      Since:
      jcms-7.0.0
    • isWorkspaceACL

      public boolean isWorkspaceACL()
      Check if this ACL is dedicated for Workspace's resource access control or any other right
      Returns:
      true if the acl is dedicated for Workspace's resource access (and only that), false if it is dedicated to anything else (excluding workspace's resource).
      Since:
      jcms-7.0.0
    • setWorkspaceACL

      public void setWorkspaceACL(boolean isWorkspaceACL)
      Set if this ACL is dedicated for Workspace's resource access control.
      Parameters:
      isWorkspaceACL - true if the acl is dedicated for Workspace's resource access (and only that), false if it is dedicated to anything else (excluding workspace's resource).
      Since:
      jcms-7.0.0
    • isAdminOnly

      public boolean isAdminOnly()
      Check if this ACL can only be assigned by a global administrator. When this option is enabled (default behavior), only a global administrator can assign this ACL to users (via a group). By disabling this option, members with access to members global administration will have the ability to assign this ACL to users. In every case, workspace members administrators do not benefit from this authorization.

      This option has no effect for workspace ACL.

      Returns:
      true if option is enabled (default), false if assignement authorization has been granted to members with access to members global administration.
      Since:
      JCMS-6893 (for JCMS-6056)
    • setAdminOnly

      public void setAdminOnly(boolean isAdminOnly)
      Set whether this ACL can be assigned only by a global administrator or more.

      This option has no effect for workspace ACL.

      Parameters:
      isAdminOnly - true to restrict to global admin only, false to grant authorization to members with access to members global administration.
      Since:
      JCMS-6893 (for JCMS-6056)
    • getAccessAuthorization

      public Boolean getAccessAuthorization(String resource)
      Retrieve the authorization of the specified resource
      Parameters:
      resource - URI of the resource
      Returns:
      null if no authorization has been defined, TRUE if resource access is allowed, FALSE or null to apply default behavior.
    • isWorker

      public boolean isWorker()
      Check if any ACL provides worker right to the member using it.
      Returns:
      true if ACL provides isWorker right, false otherwise
      Since:
      jcms-7.0.0
    • getExplicitAccessAuthorization

      public Boolean getExplicitAccessAuthorization(String resource)
      Retrieve the explicit authorization of the specified resource.

      Do not use this method for acces right check, see getAccessAuthorization(String).

      Parameters:
      resource - URI of the resource
      Returns:
      null if no authorization has been defined, TRUE if resource access is allowed, FALSE or null to apply default behavior.
      Since:
      jcms-7.0.0
    • setExplicitAccessAuthorization

      public void setExplicitAccessAuthorization(String resource, Boolean authorization)
      Set the authorization of the specified resource
      Parameters:
      resource - URI of the resource
      authorization - TRUE to grant access, FALSE or null to apply default behavior. if null, the authorization is removed and default access will be applied.
      Since:
      jcms-7.0.0
    • removeExplicitAccessAuthorization

      public void removeExplicitAccessAuthorization(String resource)
      Remove all authorization for the specified resource
      Parameters:
      resource - URI of the resource
      Since:
      jcms-7.0.0
    • clearExplicitAccessAuthorization

      public void clearExplicitAccessAuthorization()
      Remove all authorization for this ACL
      Since:
      jcms-7.0.0
    • getExplicitResourceToAuthorizationMap

      public HashMap<String,Boolean> getExplicitResourceToAuthorizationMap()
      Retrieve the internal map used to store authorization.
      Returns:
      a Map of resource URI to authorization boolean
      Since:
      jcms-7.0.0
    • setExplicitResourceToAuthorizationMap

      public void setExplicitResourceToAuthorizationMap(HashMap<String,Boolean> explicitResourceToAuthorizationMap)
      Set the value of the internal map used to store authorization.
      Parameters:
      explicitResourceToAuthorizationMap -
      Since:
      jcms-7.0.0
    • checkIntegrity

      public ControllerStatus checkIntegrity()
      Checks whether or not data integrity constraints are respected.
      Overrides:
      checkIntegrity in class Data
      Returns:
      a ControllerStatus
      Since:
      jcms-7.0.0
    • checkMember

      public ControllerStatus checkMember(int op, Member mbr, Map context)
      Checks if the given member can perform the given operation.
      Overrides:
      checkMember in class Data
      Parameters:
      op - the operation (OP_CREATE, OP_UPDATE, ...)
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Returns:
      a ControllerStatus
      Since:
      jcms-7.0.0
    • checkDelete

      public ControllerStatus checkDelete(Member mbr, Map context)
      Checks if the deletion can be performed
      Overrides:
      checkDelete in class Data
      Parameters:
      mbr - the member which requests the write operation
      context - a map which contains context parameters (may be null)
      Returns:
      a ControllerStatus
      Since:
      jcms-7.0.0
    • updateGroupSet

      public void updateGroupSet(Group group, boolean add)
      Internal method used to update the (transient) set of Group using this ACL.
      Parameters:
      group - the Group to add or remove from the group set.
      add - true -> add, false -> remove
      Since:
      jcms-7.0.0
    • getGroupSet

      public Set<Group> getGroupSet()
      Retrieves the Set of Group using this ACL.
      Returns:
      a TreeSet of Group (internal variable exposed, do not modify the returned set)
      Since:
      jcms-7.0.0
    • exportXmlField

      public void exportXmlField(StringBuffer sb, int indentLevel)
      Description copied from class: Data
      Fills the given StringBuffer with Xml export of fields of this data.
      Overrides:
      exportXmlField in class Data
      Parameters:
      sb - the StringBuffer
      indentLevel - the indent level
    • getWorkspaceAclSelector

      public static AccessControlList.WorkspaceAclSelector getWorkspaceAclSelector()
      Retrieve a DataSelector to select only workspace ACL in a collection.
      Returns:
      a new WorkspaceAclSelector
      Since:
      jcms-7.0.0
    • getNameComparator

      public static <T extends AccessControlList> Comparator<T> getNameComparator()
      Retrieve a Comparator to sort ACL alphabetically using their name.
      Returns:
      a new NameComparator
      Since:
      jcms-7.0.0