Class SimpleACIRole

java.lang.Object
com.isode.dsapi.aci.SimpleACIRole

public class SimpleACIRole extends Object
Simple ACI role. This specifies a minimum auth level and the users that it applies to.

The fields of this class may be accessed directly. There are also methods available to simplify access to some of the fields.

Since:
15.0
Author:
jp
  • Field Details

    • label

      public String label
      Role name.
    • note

      public String note
      Note to explain intended usage of role, or ""
    • auth

      public SimpleACIRole.Auth auth
      Minimum authentication level required for this role.
    • user_all

      public boolean user_all
      Applies to all users?
    • user_names

      public List<DN> user_names
      List of user DNs that it applies to, or null
    • user_groups

      public List<DN> user_groups
      List of group DNs that it applies to, or null
    • user_subtrees

      public SimpleACIArea user_subtrees
      SimpleACIArea which specifies the regions of the DIT within which user DNs lie that this role applies to, or null
    • ORDER

      public static final Comparator<SimpleACIRole> ORDER
      Comparator to order SimpleACIRoles by label.
  • Constructor Details

  • Method Details

    • setNote

      public void setNote(String note)
      Set the note. This tidies the note before putting it into 'note', stripping off spaces and tabs at the beginnings or ends of lines.
      Parameters:
      note - Note to set, or "". Should never be null.
    • addUserName

      public void addUserName(DN dn)
      Add a DN to the 'user_names' list, creating the list if necessary. If 'user_all' was previously set, it will be cleared by this call.
      Parameters:
      dn - User DN
    • addGroupName

      public void addGroupName(DN dn)
      Add a name to the 'user_groups' list, creating the list if necessary. If 'user_all' was previously set, it will be cleared by this call.
      Parameters:
      dn - Group DN
    • addUserSubtree

      public void addUserSubtree(SimpleACIArea.Region ss)
      Add a new user subtree spec to the 'user_subtree' area, creating the area if necessary. If 'user_all' was previously set, it will be cleared by this call.
      Parameters:
      ss - Region to add
    • sort

      public void sort()
      Sort contained lists into a consistent order. This allows equals() and contentsEqual() to work even if values have been loaded back up in a different order.
    • relocate

      public void relocate(DN... reloc_arr)
      Relocate all role-DNs according to the given relocation array (see SimpleACIWorld.relocate(com.isode.dsapi.DN...)).
      Parameters:
      reloc_arr - Array containing source/target pairs of DNs specifying the relocations to perform
    • removeUsersAndGroups

      public void removeUsersAndGroups(List<DN> dnlist)
      Remove all mentions of the given user and/or group DNs from the role.
      Parameters:
      dnlist - List of DNs to remove (not null)
    • isEmpty

      public boolean isEmpty()
      Return true if this role is empty, i.e. includes no users.
      Returns:
      'true' if empty, else 'false'.
    • dumpXML

      public void dumpXML(com.isode.util.XMLOutput out) throws IOException
      Dump the role out to the given XMLOutput stream.
      Throws:
      IOException
    • loadXML

      public static SimpleACIRole loadXML(com.isode.util.XMLInput in)
      Try to load up a SimpleACIRole from XML. Returns null if not found.
    • copyFrom

      public void copyFrom(SimpleACIRole role)
      Copy data from the given role.
      Parameters:
      role - Role to copy data from, must not be null.
    • deepCopy

      public SimpleACIRole deepCopy()
      Copy the role. This is cheap slow code -- it copies it by converting it via XML. It could perhaps be improved if there was ever a need to do a lot of copying.
    • setOriginal

      public void setOriginal(SimpleACIRole role)
      Change the original SimpleACIRole used to support hasChanges().
    • getOriginal

      public SimpleACIRole getOriginal()
      Get the original SimpleACIRole associated with this role.
    • hasChanges

      public boolean hasChanges()
      Test whether there have been changes compared to the original role. The role is sorted internally to allow the comparison. If the original role was not set, this method returns false.
      Returns:
      TRUE if there have been changes compared to the original role; FALSE otherwise or if the original role was not set.
    • contentsEqual

      public boolean contentsEqual(SimpleACIRole bb)
      Test whether two roles' data are identical, apart from their names. The sort() method should be called first if the data was loaded up from different sources, to make sure that lists of DNs compare the same.
    • equals

      public boolean equals(Object o)
      Test if two roles are identical. The sort() method should be called first if the data was loaded up from different sources, to make sure that lists of DNs compare the same.
      Overrides:
      equals in class Object
      Parameters:
      o - Object to compare
      Returns:
      Test result
    • contentsHashCode

      public int contentsHashCode()
      Calculate a hash value which depends on the 'contents' of the role, but not the name. This is used for matching up identical roles.
      Returns:
      Hash code
    • hashCode

      public int hashCode()
      Calculate a hash value which depends on both the 'contents' and the name of the role.
      Overrides:
      hashCode in class Object
      Returns:
      Hash code
    • toString

      public String toString()
      Debugging dump.
      Overrides:
      toString in class Object
      Returns:
      Debugging dump