|
Jive Forums API (5.5.20.2-oracle) Developer 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 forum, the proper code snippet is as follows:
Forum forum = factory.getForum(1); boolean canPost = forum.isAuthorized(ForumPermissions.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. |
java.util.Iterator |
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. |
void |
permissionModificationDetected()
Is called when a permission is modified. |
boolean |
registeredUserHasPermission(PermissionType permissionType,
long permission)
Returns true if registered users have a particular permission. |
void |
removeAllGroupPermissions(PermissionType permissionType)
Revokes all group permissions. |
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 |
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. |
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.
UnauthorizedException
- if does not have proper admin permissions.void removeAnonymousUserPermission(PermissionType permissionType, long permission) throws UnauthorizedException
permissionType
- the type of 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.
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 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.util.Iterator 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.
void permissionModificationDetected()
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |