Interface PermissionChecker
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
PermissionCheckerWrapper
- Author:
- Brian Wing Shun Chan
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionclone()longReturns the primary key of the user's company.long[]longReturns the primary key of the owner role.long[]getRoleIds(long userId, long groupId) Returns the primary keys of the roles the user has within the group.getUser()longReturns the primary key of the user.booleanhasOwnerPermission(long companyId, String name, long primKey, long ownerId, String actionId) Returnstrueif the user is the owner of the resource and has permission to perform the action.booleanhasOwnerPermission(long companyId, String name, String primKey, long ownerId, String actionId) Returnstrueif the user is the owner of the resource and has permission to perform the action.booleanhasPermission(long groupId, String name, long primKey, String actionId) Returnstrueif the user has permission to perform the action on the resource.booleanhasPermission(long groupId, String name, String primKey, String actionId) Returnstrueif the user has permission to perform the action on the resource.booleanhasPermission(Group group, String name, long primKey, String actionId) booleanhasPermission(Group group, String name, String primKey, String actionId) voidInitializes this permission checker.default voidinit(User user, RoleContributor[] roleContributors) booleanReturnstrueif guest permissions will be used in permission checks.booleanReturnstrueif the user is an administrator of their company.booleanisCompanyAdmin(long companyId) Returnstrueif the user is an administrator of the company.booleanisContentReviewer(long companyId, long groupId) Returnstrueif the user is a content reviewer or has sufficient permissions to review content (i.e. the user is a company or group administrator).booleanisGroupAdmin(long groupId) Returnstrueif the user is an administrator of the group.booleanisGroupMember(long groupId) Returnstrueif the user is a member of the group.booleanisGroupOwner(long groupId) Returnstrueif the user is the owner of the group.booleanReturnstrueif the user is a universal administrator.booleanisOrganizationAdmin(long organizationId) Returnstrueif the user is an administrator of the organization.booleanisOrganizationOwner(long organizationId) Returnstrueif the user is an owner of the organization.booleanReturnstrueif the user is signed in.
-
Field Details
-
DEFAULT_ROLE_IDS
static final long[] DEFAULT_ROLE_IDS
-
-
Method Details
-
clone
PermissionChecker clone() -
getCompanyId
long getCompanyId()Returns the primary key of the user's company.- Returns:
- the primary key of the user's company
-
getGuestUserRoleIds
long[] getGuestUserRoleIds() -
getOwnerRoleId
long getOwnerRoleId()Returns the primary key of the owner role. This role is automatically given to the creator of a resource.- Returns:
- the primary key of the owner role
-
getPermissionChecksMap
-
getRoleIds
long[] getRoleIds(long userId, long groupId) Returns the primary keys of the roles the user has within the group.- Parameters:
userId- the primary key of the usergroupId- the primary key of the group- Returns:
- the primary keys of the roles the user has within the group
-
getUser
User getUser() -
getUserBag
- Throws:
Exception
-
getUserId
long getUserId()Returns the primary key of the user.- Returns:
- the primary key of the user
-
hasOwnerPermission
boolean hasOwnerPermission(long companyId, String name, long primKey, long ownerId, String actionId) Returnstrueif the user is the owner of the resource and has permission to perform the action.- Parameters:
companyId- the primary key of the user's companyname- the resource's name, which can be either a class name or a portlet IDprimKey- the primary key of the resourceownerId- the primary key of the resource's owneractionId- the action ID- Returns:
trueif the user is the owner of the resource and has permission to perform the action;falseotherwise
-
hasOwnerPermission
boolean hasOwnerPermission(long companyId, String name, String primKey, long ownerId, String actionId) Returnstrueif the user is the owner of the resource and has permission to perform the action.- Parameters:
companyId- the primary key of the user's companyname- the resource's name, which can be either a class name or a portlet IDprimKey- the primary key of the resourceownerId- the primary key of the resource's owneractionId- the action ID- Returns:
trueif the user is the owner of the resource and has permission to perform the action;falseotherwise
-
hasPermission
-
hasPermission
-
hasPermission
Returnstrueif the user has permission to perform the action on the resource.- Parameters:
groupId- the primary key of the group containing the resourcename- the resource's name, which can be either a class name or a portlet IDprimKey- the primary key of the resourceactionId- the action ID- Returns:
trueif the user has permission to perform the action on the resource;falseotherwise
-
hasPermission
Returnstrueif the user has permission to perform the action on the resource.- Parameters:
groupId- the primary key of the group containing the resourcename- the resource's name, which can be either a class name or a portlet IDprimKey- the primary key of the resourceactionId- the action ID- Returns:
trueif the user has permission to perform the action on the resource;falseotherwise
-
init
Initializes this permission checker.- Parameters:
user- the current user
-
init
-
isCheckGuest
boolean isCheckGuest()Returnstrueif guest permissions will be used in permission checks.- Returns:
trueif guest permissions will be used in permission checks;falseotherwise
-
isCompanyAdmin
boolean isCompanyAdmin()Returnstrueif the user is an administrator of their company.- Returns:
trueif the user is an administrator of their company;falseotherwise
-
isCompanyAdmin
boolean isCompanyAdmin(long companyId) Returnstrueif the user is an administrator of the company.- Parameters:
companyId- the primary key of the company- Returns:
trueif the user is an administrator of the company;falseotherwise
-
isContentReviewer
boolean isContentReviewer(long companyId, long groupId) Returnstrueif the user is a content reviewer or has sufficient permissions to review content (i.e. the user is a company or group administrator).- Parameters:
companyId- the primary key of the companygroupId- the primary key of the group- Returns:
trueif the user is a reviewer or has sufficient permissions to review content;falseotherwise
-
isGroupAdmin
boolean isGroupAdmin(long groupId) Returnstrueif the user is an administrator of the group.- Parameters:
groupId- the primary key of the group- Returns:
trueif the user is an administrator of the group;falseotherwise
-
isGroupMember
boolean isGroupMember(long groupId) Returnstrueif the user is a member of the group.- Parameters:
groupId- the primary key of the group- Returns:
trueif the user is a member of the group;falseotherwise
-
isGroupOwner
boolean isGroupOwner(long groupId) Returnstrueif the user is the owner of the group.- Parameters:
groupId- the primary key of the group- Returns:
trueif the user is the owner of the group;falseotherwise
-
isOmniadmin
boolean isOmniadmin()Returnstrueif the user is a universal administrator.- Returns:
trueif the user is a universal administrator;falseotherwise- See Also:
-
OmniadminUtil
-
isOrganizationAdmin
boolean isOrganizationAdmin(long organizationId) Returnstrueif the user is an administrator of the organization.- Parameters:
organizationId- the primary key of the organization- Returns:
trueif the user is an administrator of the organization;falseotherwise
-
isOrganizationOwner
boolean isOrganizationOwner(long organizationId) Returnstrueif the user is an owner of the organization.- Parameters:
organizationId- the primary key of the organization- Returns:
trueif the user is an owner of the organization;falseotherwise
-
isSignedIn
boolean isSignedIn()Returnstrueif the user is signed in.- Returns:
trueif the user is signed in;falseotherwise
-