Class GroupPermissions

    • Constructor Detail

      • GroupPermissions

        public GroupPermissions()
        Create a new empty object.
      • GroupPermissions

        public GroupPermissions​(ItemKey itemKey)
                         throws InvalidDataException
        Create a new object, and initialise it with the permissions from a ItemKey.
        Parameters:
        itemKey - The item key from which we take the current permissions
        Throws:
        InvalidDataException - If the item key is null
    • Method Detail

      • merge

        public void merge​(ItemKey itemKey)
        Merge the permissions for all groups from the given item key with the permissions in this object. If the item key contains permissions for a group that already has permissions in this object the permissions are combined (added) to create a new permission.
        Parameters:
        itemKey - An item key (if null, this method simply returns)
        Since:
        2.16
      • setPermissions

        public void setPermissions​(Group group,
                                   Set<Permission> permissions)
                            throws InvalidDataException
        Grant permissions to a group. Use an empty Set or null to remove all permissions for the group.
        Parameters:
        group - The Group
        permissions - The permissions to grant
        Throws:
        InvalidDataException - If the group is null
        See Also:
        Permission
      • getOriginalPermissions

        public Set<Permission> getOriginalPermissions​(Group group)
        Get the original permissions for a group if this object was created with the GroupPermissions(ItemKey) constructor.
        Parameters:
        group - The Group for which we want to get the permission
        Returns:
        An Set containing the original permissions, or an empty set
        Throws:
        InvalidDataException - If the group is null
        Since:
        2.6
        See Also:
        getPermissions(Group)
      • hasChanged

        public boolean hasChanged​(Group group)
        Check if the current permissions for the group has been changed from the original permissions. This method will return false if the getPermissions(Group) returns a set with the same permissions getOriginalPermissions(Group).
        Parameters:
        group - The group to check
        Returns:
        TRUE if the permissions have changed, FALSE otherwise
        Throws:
        InvalidDataException - If the group is null
        Since:
        2.6
      • size

        public int size()
        Get the number of entries.
      • getGroupPermissions

        final Map<GroupData,​Integer> getGroupPermissions()
        Get the internal representation of the permissions.
      • getOriginalPermissions

        final Map<GroupData,​Integer> getOriginalPermissions()
        Get the internal representation of the original permissions.
        Since:
        2.6