Class PermissionCheckerWrapper
Object
com.liferay.portal.kernel.security.permission.wrapper.PermissionCheckerWrapper
- All Implemented Interfaces:
PermissionChecker
,Cloneable
- Author:
- Preston Crary
-
Field Summary
Fields inherited from interface com.liferay.portal.kernel.security.permission.PermissionChecker
DEFAULT_ROLE_IDS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal PermissionChecker
clone()
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) final void
Initializes this permission checker.final 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.
-
Constructor Details
-
PermissionCheckerWrapper
-
-
Method Details
-
clone
- Specified by:
clone
in interfacePermissionChecker
- Overrides:
clone
in classObject
-
getCompanyId
public long getCompanyId()Description copied from interface:PermissionChecker
Returns the primary key of the user's company.- Specified by:
getCompanyId
in interfacePermissionChecker
- Returns:
- the primary key of the user's company
-
getGuestUserRoleIds
public long[] getGuestUserRoleIds()- Specified by:
getGuestUserRoleIds
in interfacePermissionChecker
-
getOwnerRoleId
public long getOwnerRoleId()Description copied from interface:PermissionChecker
Returns the primary key of the owner role. This role is automatically given to the creator of a resource.- Specified by:
getOwnerRoleId
in interfacePermissionChecker
- Returns:
- the primary key of the owner role
-
getPermissionChecksMap
- Specified by:
getPermissionChecksMap
in interfacePermissionChecker
-
getRoleIds
public long[] getRoleIds(long userId, long groupId) Description copied from interface:PermissionChecker
Returns the primary keys of the roles the user has within the group.- Specified by:
getRoleIds
in interfacePermissionChecker
- 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
- Specified by:
getUser
in interfacePermissionChecker
-
getUserBag
- Specified by:
getUserBag
in interfacePermissionChecker
- Throws:
Exception
-
getUserId
public long getUserId()Description copied from interface:PermissionChecker
Returns the primary key of the user.- Specified by:
getUserId
in interfacePermissionChecker
- Returns:
- the primary key of the user
-
hasOwnerPermission
public boolean hasOwnerPermission(long companyId, String name, long primKey, long ownerId, String actionId) Description copied from interface:PermissionChecker
Returnstrue
if the user is the owner of the resource and has permission to perform the action.- Specified by:
hasOwnerPermission
in interfacePermissionChecker
- 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
public boolean hasOwnerPermission(long companyId, String name, String primKey, long ownerId, String actionId) Description copied from interface:PermissionChecker
Returnstrue
if the user is the owner of the resource and has permission to perform the action.- Specified by:
hasOwnerPermission
in interfacePermissionChecker
- 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
- Specified by:
hasPermission
in interfacePermissionChecker
-
hasPermission
- Specified by:
hasPermission
in interfacePermissionChecker
-
hasPermission
Description copied from interface:PermissionChecker
Returnstrue
if the user has permission to perform the action on the resource.- Specified by:
hasPermission
in interfacePermissionChecker
- 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
Description copied from interface:PermissionChecker
Returnstrue
if the user has permission to perform the action on the resource.- Specified by:
hasPermission
in interfacePermissionChecker
- 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
Description copied from interface:PermissionChecker
Initializes this permission checker.- Specified by:
init
in interfacePermissionChecker
- Parameters:
user
- the current user
-
init
- Specified by:
init
in interfacePermissionChecker
-
isCheckGuest
public boolean isCheckGuest()Description copied from interface:PermissionChecker
Returnstrue
if guest permissions will be used in permission checks.- Specified by:
isCheckGuest
in interfacePermissionChecker
- Returns:
true
if guest permissions will be used in permission checks;false
otherwise
-
isCompanyAdmin
public boolean isCompanyAdmin()Description copied from interface:PermissionChecker
Returnstrue
if the user is an administrator of their company.- Specified by:
isCompanyAdmin
in interfacePermissionChecker
- Returns:
true
if the user is an administrator of their company;false
otherwise
-
isCompanyAdmin
public boolean isCompanyAdmin(long companyId) Description copied from interface:PermissionChecker
Returnstrue
if the user is an administrator of the company.- Specified by:
isCompanyAdmin
in interfacePermissionChecker
- Parameters:
companyId
- the primary key of the company- Returns:
true
if the user is an administrator of the company;false
otherwise
-
isContentReviewer
public boolean isContentReviewer(long companyId, long groupId) Description copied from interface:PermissionChecker
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).- Specified by:
isContentReviewer
in interfacePermissionChecker
- 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
public boolean isGroupAdmin(long groupId) Description copied from interface:PermissionChecker
Returnstrue
if the user is an administrator of the group.- Specified by:
isGroupAdmin
in interfacePermissionChecker
- Parameters:
groupId
- the primary key of the group- Returns:
true
if the user is an administrator of the group;false
otherwise
-
isGroupMember
public boolean isGroupMember(long groupId) Description copied from interface:PermissionChecker
Returnstrue
if the user is a member of the group.- Specified by:
isGroupMember
in interfacePermissionChecker
- Parameters:
groupId
- the primary key of the group- Returns:
true
if the user is a member of the group;false
otherwise
-
isGroupOwner
public boolean isGroupOwner(long groupId) Description copied from interface:PermissionChecker
Returnstrue
if the user is the owner of the group.- Specified by:
isGroupOwner
in interfacePermissionChecker
- Parameters:
groupId
- the primary key of the group- Returns:
true
if the user is the owner of the group;false
otherwise
-
isOmniadmin
public boolean isOmniadmin()Description copied from interface:PermissionChecker
Returnstrue
if the user is a universal administrator.- Specified by:
isOmniadmin
in interfacePermissionChecker
- Returns:
true
if the user is a universal administrator;false
otherwise- See Also:
-
OmniadminUtil
-
isOrganizationAdmin
public boolean isOrganizationAdmin(long organizationId) Description copied from interface:PermissionChecker
Returnstrue
if the user is an administrator of the organization.- Specified by:
isOrganizationAdmin
in interfacePermissionChecker
- Parameters:
organizationId
- the primary key of the organization- Returns:
true
if the user is an administrator of the organization;false
otherwise
-
isOrganizationOwner
public boolean isOrganizationOwner(long organizationId) Description copied from interface:PermissionChecker
Returnstrue
if the user is an owner of the organization.- Specified by:
isOrganizationOwner
in interfacePermissionChecker
- Parameters:
organizationId
- the primary key of the organization- Returns:
true
if the user is an owner of the organization;false
otherwise
-
isSignedIn
public boolean isSignedIn()Description copied from interface:PermissionChecker
Returnstrue
if the user is signed in.- Specified by:
isSignedIn
in interfacePermissionChecker
- Returns:
true
if the user is signed in;false
otherwise
-