|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.GroupPermissions
public class GroupPermissions
This class is used to specify permissions to share an item to groups. It is a three-step procedure:
ItemKey
using this object as one of the
input parameters to ItemKey.getNewOrExisting(DbControl, UserPermissions, GroupPermissions)
Shareable.setItemKey(ItemKey)
ItemKey
,
UserPermissions
Field Summary | |
---|---|
private Map<GroupData,Integer> |
groupPermissions
|
private Map<GroupData,Integer> |
originalPermissions
|
Constructor Summary | |
---|---|
GroupPermissions()
Create a new empty object. |
|
GroupPermissions(ItemKey itemKey)
Create a new object, and initialise it with the permissions from a ItemKey . |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Map<GroupData,Integer> groupPermissions
private final Map<GroupData,Integer> originalPermissions
Constructor Detail |
---|
public GroupPermissions()
public GroupPermissions(ItemKey itemKey) throws InvalidDataException
ItemKey
.
itemKey
- The item key from which we take the current permissions
InvalidDataException
- If the item key is nullMethod Detail |
---|
public 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 grant
InvalidDataException
- If the group is nullPermission
public void addPermissions(Group group, Set<Permission> permissions) throws InvalidDataException
group
- The Group
permissions
- The permissions to grant
InvalidDataException
- If the user is nullPermission
public Set<Permission> getPermissions(Group group) throws InvalidDataException
group
- The Group
for which we want to get the permission
Set
containing the granted permissions, or an
empty set if no permissions have been granted
InvalidDataException
- 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 permission
Set
containing the original permissions, or an
empty set
InvalidDataException
- 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 check
InvalidDataException
- If the group is nullpublic int size()
final Map<GroupData,Integer> getGroupPermissions()
final Map<GroupData,Integer> getOriginalPermissions()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |