public class GroupPermissions extends Object
ItemKey
using this object as one of the
input parameters to ItemKey.getNewOrExisting(DbControl, UserPermissions, GroupPermissions)
Shareable.setItemKey(ItemKey)
ItemKey
,
UserPermissions
Modifier and Type | Field and Description |
---|---|
private Map<GroupData,Integer> |
groupPermissions |
private Map<GroupData,Integer> |
originalPermissions |
Constructor and Description |
---|
GroupPermissions()
Create a new empty object.
|
GroupPermissions(ItemKey itemKey)
Create a new object, and initialise it with the permissions from a
ItemKey . |
Modifier and Type | Method and Description |
---|---|
void |
addPermissions(Group group,
Set<Permission> permissions)
Grant permissions to a group, keeping those that have already been set.
|
(package private) Map<GroupData,Integer> |
getGroupPermissions()
Get the internal representation of the permissions.
|
(package private) Map<GroupData,Integer> |
getOriginalPermissions()
Get the internal representation of the original permissions.
|
Set<Permission> |
getOriginalPermissions(Group group)
Get the original permissions for a group if this object was created with the
GroupPermissions(ItemKey) constructor. |
Set<Permission> |
getPermissions(Group group)
Get the permissions for a group.
|
boolean |
hasChanged(Group group)
Check if the current permissions for the group has been changed from the original
permissions.
|
void |
merge(ItemKey itemKey)
Merge the permissions for all groups from the given item key with the permissions
in this object.
|
void |
setPermissions(Group group,
Set<Permission> permissions)
Grant permissions to a group.
|
int |
size()
Get the number of entries.
|
public GroupPermissions()
public GroupPermissions(ItemKey itemKey) throws InvalidDataException
ItemKey
.itemKey
- The item key from which we take the current permissionsInvalidDataException
- If the item key is nullpublic void merge(ItemKey itemKey)
itemKey
- An item key (if null, this method simply returns)public void setPermissions(Group group, Set<Permission> permissions) throws InvalidDataException
Set
or null
to remove all permissions for the group.group
- The Group
permissions
- The permissions to grantInvalidDataException
- If the group is nullPermission
public void addPermissions(Group group, Set<Permission> permissions) throws InvalidDataException
group
- The Group
permissions
- The permissions to grantInvalidDataException
- If the user is nullPermission
public Set<Permission> getPermissions(Group group) throws InvalidDataException
group
- The Group
for which we want to get the permissionSet
containing the granted permissions, or an
empty set if no permissions have been grantedInvalidDataException
- If the group is nullgetOriginalPermissions(Group)
,
Permission
public Set<Permission> getOriginalPermissions(Group group)
GroupPermissions(ItemKey)
constructor.group
- The Group
for which we want to get the permissionSet
containing the original permissions, or an
empty setInvalidDataException
- If the group is nullgetPermissions(Group)
public boolean hasChanged(Group group)
getPermissions(Group)
returns a set with the same permissions getOriginalPermissions(Group)
.group
- The group to checkInvalidDataException
- If the group is nullpublic int size()
final Map<GroupData,Integer> getGroupPermissions()