Interface PermissionChecker
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
PermissionCheckerWrapper
- Author:
- Brian Wing Shun Chan
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionclone()
long
Returns the primary key of the user's company.long[]
long
Returns 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()
long
Returns the primary key of the user.boolean
hasOwnerPermission
(long companyId, String name, long primKey, long ownerId, String actionId) Returnstrue
if the user is the owner of the resource and has permission to perform the action.boolean
hasOwnerPermission
(long companyId, String name, String primKey, long ownerId, String actionId) Returnstrue
if the user is the owner of the resource and has permission to perform the action.boolean
hasPermission
(long groupId, String name, long primKey, String actionId) Returnstrue
if the user has permission to perform the action on the resource.boolean
hasPermission
(long groupId, String name, String primKey, String actionId) Returnstrue
if the user has permission to perform the action on the resource.boolean
hasPermission
(Group group, String name, long primKey, String actionId) boolean
hasPermission
(Group group, String name, String primKey, String actionId) void
Initializes this permission checker.default void
init
(User user, RoleContributor[] roleContributors) boolean
Returnstrue
if guest permissions will be used in permission checks.boolean
Returnstrue
if the user is an administrator of their company.boolean
isCompanyAdmin
(long companyId) Returnstrue
if the user is an administrator of the company.boolean
isContentReviewer
(long companyId, long groupId) Returnstrue
if the user is a content reviewer or has sufficient permissions to review content (i.e. the user is a company or group administrator).boolean
isGroupAdmin
(long groupId) Returnstrue
if the user is an administrator of the group.boolean
isGroupMember
(long groupId) Returnstrue
if the user is a member of the group.boolean
isGroupOwner
(long groupId) Returnstrue
if the user is the owner of the group.boolean
Returnstrue
if the user is a universal administrator.boolean
isOrganizationAdmin
(long organizationId) Returnstrue
if the user is an administrator of the organization.boolean
isOrganizationOwner
(long organizationId) Returnstrue
if the user is an owner of the organization.boolean
Returnstrue
if 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) Returnstrue
if 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:
true
if the user is the owner of the resource and has permission to perform the action;false
otherwise
-
hasOwnerPermission
boolean hasOwnerPermission(long companyId, String name, String primKey, long ownerId, String actionId) Returnstrue
if 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:
true
if the user is the owner of the resource and has permission to perform the action;false
otherwise
-
hasPermission
-
hasPermission
-
hasPermission
Returnstrue
if 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:
true
if the user has permission to perform the action on the resource;false
otherwise
-
hasPermission
Returnstrue
if 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:
true
if the user has permission to perform the action on the resource;false
otherwise
-
init
Initializes this permission checker.- Parameters:
user
- the current user
-
init
-
isCheckGuest
boolean isCheckGuest()Returnstrue
if guest permissions will be used in permission checks.- Returns:
true
if guest permissions will be used in permission checks;false
otherwise
-
isCompanyAdmin
boolean isCompanyAdmin()Returnstrue
if the user is an administrator of their company.- Returns:
true
if the user is an administrator of their company;false
otherwise
-
isCompanyAdmin
boolean isCompanyAdmin(long companyId) Returnstrue
if the user is an administrator of the company.- Parameters:
companyId
- the primary key of the company- Returns:
true
if the user is an administrator of the company;false
otherwise
-
isContentReviewer
boolean isContentReviewer(long companyId, long groupId) Returnstrue
if 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:
true
if the user is a reviewer or has sufficient permissions to review content;false
otherwise
-
isGroupAdmin
boolean isGroupAdmin(long groupId) Returnstrue
if the user is an administrator of the group.- Parameters:
groupId
- the primary key of the group- Returns:
true
if the user is an administrator of the group;false
otherwise
-
isGroupMember
boolean isGroupMember(long groupId) Returnstrue
if the user is a member of the group.- Parameters:
groupId
- the primary key of the group- Returns:
true
if the user is a member of the group;false
otherwise
-
isGroupOwner
boolean isGroupOwner(long groupId) Returnstrue
if the user is the owner of the group.- Parameters:
groupId
- the primary key of the group- Returns:
true
if the user is the owner of the group;false
otherwise
-
isOmniadmin
boolean isOmniadmin()Returnstrue
if the user is a universal administrator.- Returns:
true
if the user is a universal administrator;false
otherwise- See Also:
-
OmniadminUtil
-
isOrganizationAdmin
boolean isOrganizationAdmin(long organizationId) Returnstrue
if the user is an administrator of the organization.- Parameters:
organizationId
- the primary key of the organization- Returns:
true
if the user is an administrator of the organization;false
otherwise
-
isOrganizationOwner
boolean isOrganizationOwner(long organizationId) Returnstrue
if the user is an owner of the organization.- Parameters:
organizationId
- the primary key of the organization- Returns:
true
if the user is an owner of the organization;false
otherwise
-
isSignedIn
boolean isSignedIn()Returnstrue
if the user is signed in.- Returns:
true
if the user is signed in;false
otherwise
-