public class PermissionCheckerWrapper extends Object implements PermissionChecker
DEFAULT_ROLE_IDS
Constructor and Description |
---|
PermissionCheckerWrapper(PermissionChecker permissionChecker) |
Modifier and Type | Method and Description |
---|---|
PermissionChecker |
clone() |
long |
getCompanyId()
Returns the primary key of the user's company.
|
long[] |
getGuestUserRoleIds() |
long |
getOwnerRoleId()
Returns the primary key of the owner role.
|
Map<Object,Object> |
getPermissionChecksMap() |
long[] |
getRoleIds(long userId,
long groupId)
Returns the primary keys of the roles the user has within the group.
|
User |
getUser() |
UserBag |
getUserBag() |
long |
getUserId()
Returns the primary key of the user.
|
boolean |
hasOwnerPermission(long companyId,
String name,
long primKey,
long ownerId,
String actionId)
Returns
true 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)
Returns
true if the user is the owner of the resource and
has permission to perform the action. |
boolean |
hasPermission(Group group,
String name,
long primKey,
String actionId) |
boolean |
hasPermission(Group group,
String name,
String primKey,
String actionId) |
boolean |
hasPermission(long groupId,
String name,
long primKey,
String actionId)
Returns
true if the user has permission to perform the
action on the resource. |
boolean |
hasPermission(long groupId,
String name,
String primKey,
String actionId)
Returns
true if the user has permission to perform the
action on the resource. |
void |
init(User user)
Initializes this permission checker.
|
void |
init(User user,
RoleContributor[] roleContributors) |
boolean |
isCheckGuest()
Returns
true if guest permissions will be used in permission
checks. |
boolean |
isCompanyAdmin()
Returns
true if the user is an administrator of their
company. |
boolean |
isCompanyAdmin(long companyId)
Returns
true if the user is an administrator of the company. |
boolean |
isContentReviewer(long companyId,
long groupId)
Returns
true 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)
Returns
true if the user is an administrator of the group. |
boolean |
isGroupMember(long groupId)
Returns
true if the user is a member of the group. |
boolean |
isGroupOwner(long groupId)
Returns
true if the user is the owner of the group. |
boolean |
isOmniadmin()
Returns
true if the user is a universal administrator. |
boolean |
isOrganizationAdmin(long organizationId)
Returns
true if the user is an administrator of the
organization. |
boolean |
isOrganizationOwner(long organizationId)
Returns
true if the user is an owner of the organization. |
boolean |
isSignedIn()
Returns
true if the user is signed in. |
public PermissionCheckerWrapper(PermissionChecker permissionChecker)
public final PermissionChecker clone()
clone
in interface PermissionChecker
clone
in class Object
public long getCompanyId()
PermissionChecker
getCompanyId
in interface PermissionChecker
public long[] getGuestUserRoleIds()
getGuestUserRoleIds
in interface PermissionChecker
public long getOwnerRoleId()
PermissionChecker
getOwnerRoleId
in interface PermissionChecker
public Map<Object,Object> getPermissionChecksMap()
getPermissionChecksMap
in interface PermissionChecker
public long[] getRoleIds(long userId, long groupId)
PermissionChecker
getRoleIds
in interface PermissionChecker
userId
- the primary key of the usergroupId
- the primary key of the grouppublic User getUser()
getUser
in interface PermissionChecker
public UserBag getUserBag() throws Exception
getUserBag
in interface PermissionChecker
Exception
public long getUserId()
PermissionChecker
getUserId
in interface PermissionChecker
public boolean hasOwnerPermission(long companyId, String name, long primKey, long ownerId, String actionId)
PermissionChecker
true
if the user is the owner of the resource and
has permission to perform the action.hasOwnerPermission
in interface PermissionChecker
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 IDtrue
if the user is the owner of the resource and
has permission to perform the action; false
otherwisepublic boolean hasOwnerPermission(long companyId, String name, String primKey, long ownerId, String actionId)
PermissionChecker
true
if the user is the owner of the resource and
has permission to perform the action.hasOwnerPermission
in interface PermissionChecker
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 IDtrue
if the user is the owner of the resource and
has permission to perform the action; false
otherwisepublic boolean hasPermission(Group group, String name, long primKey, String actionId)
hasPermission
in interface PermissionChecker
public boolean hasPermission(Group group, String name, String primKey, String actionId)
hasPermission
in interface PermissionChecker
public boolean hasPermission(long groupId, String name, long primKey, String actionId)
PermissionChecker
true
if the user has permission to perform the
action on the resource.hasPermission
in interface PermissionChecker
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 IDtrue
if the user has permission to perform the
action on the resource; false
otherwisepublic boolean hasPermission(long groupId, String name, String primKey, String actionId)
PermissionChecker
true
if the user has permission to perform the
action on the resource.hasPermission
in interface PermissionChecker
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 IDtrue
if the user has permission to perform the
action on the resource; false
otherwisepublic final void init(User user)
PermissionChecker
init
in interface PermissionChecker
user
- the current userpublic final void init(User user, RoleContributor[] roleContributors)
init
in interface PermissionChecker
public boolean isCheckGuest()
PermissionChecker
true
if guest permissions will be used in permission
checks.isCheckGuest
in interface PermissionChecker
true
if guest permissions will be used in permission
checks; false
otherwisepublic boolean isCompanyAdmin()
PermissionChecker
true
if the user is an administrator of their
company.isCompanyAdmin
in interface PermissionChecker
true
if the user is an administrator of their
company; false
otherwisepublic boolean isCompanyAdmin(long companyId)
PermissionChecker
true
if the user is an administrator of the company.isCompanyAdmin
in interface PermissionChecker
companyId
- the primary key of the companytrue
if the user is an administrator of the company;
false
otherwisepublic boolean isContentReviewer(long companyId, long groupId)
PermissionChecker
true
if the user is a content reviewer or has
sufficient permissions to review content (i.e. the user is a company or
group administrator).isContentReviewer
in interface PermissionChecker
companyId
- the primary key of the companygroupId
- the primary key of the grouptrue
if the user is a reviewer or has sufficient
permissions to review content; false
otherwisepublic boolean isGroupAdmin(long groupId)
PermissionChecker
true
if the user is an administrator of the group.isGroupAdmin
in interface PermissionChecker
groupId
- the primary key of the grouptrue
if the user is an administrator of the group;
false
otherwisepublic boolean isGroupMember(long groupId)
PermissionChecker
true
if the user is a member of the group.isGroupMember
in interface PermissionChecker
groupId
- the primary key of the grouptrue
if the user is a member of the group;
false
otherwisepublic boolean isGroupOwner(long groupId)
PermissionChecker
true
if the user is the owner of the group.isGroupOwner
in interface PermissionChecker
groupId
- the primary key of the grouptrue
if the user is the owner of the group;
false
otherwisepublic boolean isOmniadmin()
PermissionChecker
true
if the user is a universal administrator.isOmniadmin
in interface PermissionChecker
true
if the user is a universal administrator;
false
otherwiseOmniadminUtil
public boolean isOrganizationAdmin(long organizationId)
PermissionChecker
true
if the user is an administrator of the
organization.isOrganizationAdmin
in interface PermissionChecker
organizationId
- the primary key of the organizationtrue
if the user is an administrator of the
organization; false
otherwisepublic boolean isOrganizationOwner(long organizationId)
PermissionChecker
true
if the user is an owner of the organization.isOrganizationOwner
in interface PermissionChecker
organizationId
- the primary key of the organizationtrue
if the user is an owner of the organization;
false
otherwisepublic boolean isSignedIn()
PermissionChecker
true
if the user is signed in.isSignedIn
in interface PermissionChecker
true
if the user is signed in; false
otherwise