|
Clearspace API (1.10.16) Core Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PermissionsManager
Manages permissions for users and groups on a particular resource.
This class is only intended for administrative purposes, and should not be used by skin authors to check the permissions for individual users. For example, to check if a particular user is authorized to post messages in a community, the proper code snippet is as follows:
Community community = communityManager.getCommunity(123); boolean canPost = community.isAuthorized(Permissions.CREATE_MESSAGE);
When adding or removing permissions using this class a permissionType of
PermissionType.ADDITIVE or PermissionType.NEGATIVE is required to indicate
whether the permission should be 'additive' or 'negative'. Additive permissions indicate
that if the permission has been already set in a parent object, it will be inherited by the object
and all child objects. Negative permissions on the other hand can be thought of as 'blocking'
a permission from being inherited by the object and all child objects.
Two modes for group permission checking are provided:
GroupManager.getUserGroups(User)
method. Then, a test is performed to see if any of those groups has permissions on the object.
This mode works well when it is easy to find the groups that a user belong to, but hard
to find the list of users in a group. Typically, this mode works better when the groups
classes are being mapped to external roles.
Group.isMember(User) method. This mode
works well when it is easy to find the list of users in a group, but hard to find the
list of groups a user belongs to.<PermissionsManager><useAltGroupMode>true</useAltGroupMode></PermissionsManager>
| Method Summary | |
|---|---|
void |
addAnonymousUserPermission(PermissionType permissionType,
long permission)
Add a permission of the specified PermissionType for anonymous users. |
void |
addGroupPermission(Group group,
PermissionType permissionType,
long permission)
Grants a group a particular permission. |
void |
addRegisteredUserPermission(PermissionType permissionType,
long permission)
Add a permission of the specified PermissionType for registered users. |
void |
addUserPermission(User user,
PermissionType permissionType,
long permission)
Add a permission of the specified PermissionType for the specified user. |
boolean |
anonymousUserHasPermission(PermissionType permissionType,
long permission)
Returns true if the anonymous users have a particular permission. |
Permissions |
getFinalGroupPerms(int objectType,
long objectID,
long groupID,
PermissionType permissionType)
Returns the Permissions object that corresponds to the permissions that a group has for a particular object. |
Permissions |
getFinalUserPerms(int objectType,
long objectID,
long userID,
PermissionType permissionType)
Returns the Permissions object that corresponds to the combined permissions that a user has for a particular object: Anonymous and "registered users" permissions. |
java.lang.Iterable<Group> |
groupsWithPermission(PermissionType permissionType,
long permission)
Returns an Iterator of groups with a particular permission. |
int |
groupsWithPermissionCount(PermissionType permissionType,
long permission)
Returns a count of the groups that have a particular permission. |
boolean |
registeredUserHasPermission(PermissionType permissionType,
long permission)
Returns true if registered users have a particular permission. |
void |
removeAllGroupPermissions(PermissionType permissionType)
Revokes all group permissions. |
void |
removeAllPermissions(int objectType,
long objectID)
|
void |
removeAllUserPermissions(PermissionType permissionType)
Removes all user permissions. |
void |
removeAnonymousUserPermission(PermissionType permissionType,
long permission)
Removes a permission of the specified PermissionType for anonymous users. |
void |
removeGroupPermission(Group group,
PermissionType permissionType,
long permission)
Removes a permission of the specified PermissionType for a group. |
void |
removeRegisteredUserPermission(PermissionType permissionType,
long permission)
Removes a permission of the specified PermissionType for registered users. |
void |
removeUserPermission(User user,
PermissionType permissionType,
long permission)
Removes a permission of the specified PermissionType for the specified user. |
java.util.Iterator<java.lang.Long> |
usersWithPermission(PermissionType permissionType,
long permission)
Returns all the userID's of users with a particular permission. |
int |
usersWithPermissionCount(PermissionType permissionType,
long permission)
Returns a count of the users that have a particular permission. |
| Methods inherited from interface com.jivesoftware.community.JiveManager |
|---|
destroy, initialize |
| Method Detail |
|---|
void addUserPermission(User user,
PermissionType permissionType,
long permission)
throws UnauthorizedException
user - the User to add a permission to.permissionType - the type of permission to add.permission - the permission to add.
UnauthorizedException - if does not have proper admin permissions.
void addAnonymousUserPermission(PermissionType permissionType,
long permission)
throws UnauthorizedException
permissionType - the type of permission to add.permission - the permission to add.
UnauthorizedException - if does not have proper admin permissions.
void addRegisteredUserPermission(PermissionType permissionType,
long permission)
throws UnauthorizedException
permissionType - the type of permission to add.permission - the permission to add.
UnauthorizedException - if does not have proper admin permissions.
void removeUserPermission(User user,
PermissionType permissionType,
long permission)
throws UnauthorizedException
user - the User to remove a permission from.permissionType - the type of permission to remove.permission - the permission to remove
UnauthorizedException - if does not have proper admin permissions.
void removeAnonymousUserPermission(PermissionType permissionType,
long permission)
throws UnauthorizedException
permissionType - the type of permission to remove.permission - the permission to remove
UnauthorizedException - if does not have proper admin permissions.
void removeRegisteredUserPermission(PermissionType permissionType,
long permission)
throws UnauthorizedException
permissionType - the type of permission to remove.permission - the permission to remove
UnauthorizedException - if does not have proper admin permissions.
void removeAllUserPermissions(PermissionType permissionType)
throws UnauthorizedException
permissionType - the type of permissions to remove.
UnauthorizedException - if not a system admin.
boolean anonymousUserHasPermission(PermissionType permissionType,
long permission)
permissionType - the type of permission to check.permission - the permission to check.
boolean registeredUserHasPermission(PermissionType permissionType,
long permission)
permissionType - the type of permission to check.permission - the permission to check.
java.util.Iterator<java.lang.Long> usersWithPermission(PermissionType permissionType,
long permission)
permissionType - the type of permission to check.permission - the permission to check.
int usersWithPermissionCount(PermissionType permissionType,
long permission)
permissionType - the type of permission to check.permission - the permission to check.
void addGroupPermission(Group group,
PermissionType permissionType,
long permission)
throws UnauthorizedException
group - the group to grant a permission to.permissionType - the type of permission to add.permission - the permission to grant the group.
UnauthorizedException - if does not have proper admin permissions.
void removeGroupPermission(Group group,
PermissionType permissionType,
long permission)
throws UnauthorizedException
group - the group to remove the permission from.permissionType - the type of permission to remove.permission - the permission to remove.
UnauthorizedException - if does not have proper admin permissions.
void removeAllGroupPermissions(PermissionType permissionType)
throws UnauthorizedException
permissionType - the type of permissions to remove.
UnauthorizedException - if not a system admin.
java.lang.Iterable<Group> groupsWithPermission(PermissionType permissionType,
long permission)
permissionType - the type of permission to check.permission - the permission to check.
int groupsWithPermissionCount(PermissionType permissionType,
long permission)
permissionType - the type of permission to check.permission - the permission to check.
Permissions getFinalUserPerms(int objectType,
long objectID,
long userID,
PermissionType permissionType)
objectType - the object type to get the permissions onobjectID - the objectID to get the permissions onuserID - the userID to get the permissions forpermissionType - the type of permissions to retrieve
void removeAllPermissions(int objectType,
long objectID)
Permissions getFinalGroupPerms(int objectType,
long objectID,
long groupID,
PermissionType permissionType)
objectType - the object type to get the permissions onobjectID - the objectID to get the permissions ongroupID - the group to get the permissions forpermissionType - the type of permissions to retrieve
|
Clearspace Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||