public class ResourcePermissionLocalServiceImpl extends ResourcePermissionLocalServiceBaseImpl
Before attempting to read any of the documentation for this class, first read
ResourcePermissionImpl
for an
explanation of scoping.
Modifier and Type | Field and Description |
---|---|
static String[] |
EMPTY_ACTION_IDS |
counterLocalService, persistedModelLocalServiceRegistry, resourceActionLocalService, resourceActionPersistence, resourcePermissionFinder, resourcePermissionLocalService, resourcePermissionPersistence, roleFinder, roleLocalService, rolePersistence
Constructor and Description |
---|
ResourcePermissionLocalServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addResourcePermission(long companyId,
String name,
int scope,
String primKey,
long roleId,
String actionId)
Grants the role permission at the scope to perform the action on
resources of the type.
|
void |
addResourcePermissions(String resourceName,
String roleName,
int scope,
long resourceActionBitwiseValue)
Grants the role permissions at the scope to perform the actions on all
resources of the type.
|
void |
copyModelResourcePermissions(long companyId,
String name,
long oldPrimKey,
long newPrimKey) |
void |
deleteResourcePermissions(long companyId,
String name,
int scope,
long primKey)
Deletes all resource permissions at the scope to resources of the type.
|
void |
deleteResourcePermissions(long companyId,
String name,
int scope,
String primKey)
Deletes all resource permissions at the scope to resources of the type.
|
protected void |
doUpdateResourcePermission(long companyId,
String name,
int scope,
String primKey,
long ownerId,
long roleId,
String[] actionIds,
int operator,
boolean fetch) |
com.liferay.portal.kernel.model.ResourcePermission |
fetchResourcePermission(long companyId,
String name,
int scope,
String primKey,
long roleId) |
Map<Long,Set<String>> |
getAvailableResourcePermissionActionIds(long companyId,
String name,
int scope,
String primKey,
Collection<String> actionIds) |
Map<Long,Set<String>> |
getAvailableResourcePermissionActionIds(long companyId,
String name,
int scope,
String primKey,
long[] roleIds,
Collection<String> actionIds)
Deprecated.
As of Wilberforce (7.0.x), replaced by
getAvailableResourcePermissionActionIds(long, String, int,
String, Collection) |
List<String> |
getAvailableResourcePermissionActionIds(long companyId,
String name,
int scope,
String primKey,
long roleId,
Collection<String> actionIds)
Returns the intersection of action IDs the role has permission at the
scope to perform on resources of the type.
|
com.liferay.portal.kernel.model.ResourcePermission |
getResourcePermission(long companyId,
String name,
int scope,
String primKey,
long roleId)
Returns the resource permission for the role at the scope to perform the
actions on resources of the type.
|
List<com.liferay.portal.kernel.model.ResourcePermission> |
getResourcePermissions(long companyId,
String name,
int scope,
String primKey)
Returns all the resource permissions at the scope of the type.
|
int |
getResourcePermissionsCount(long companyId,
String name,
int scope,
String primKey)
Returns the number of resource permissions at the scope of the type.
|
List<com.liferay.portal.kernel.model.ResourcePermission> |
getResourceResourcePermissions(long companyId,
long groupId,
String name,
String primKey)
Returns the resource permissions that apply to the resource.
|
List<com.liferay.portal.kernel.model.ResourcePermission> |
getRoleResourcePermissions(long roleId)
Returns all the resource permissions for the role.
|
List<com.liferay.portal.kernel.model.ResourcePermission> |
getRoleResourcePermissions(long roleId,
int[] scopes,
int start,
int end)
Returns a range of all the resource permissions for the role at the
scopes.
|
List<com.liferay.portal.kernel.model.Role> |
getRoles(long companyId,
String name,
int scope,
String primKey,
String actionId) |
List<com.liferay.portal.kernel.model.ResourcePermission> |
getScopeResourcePermissions(int[] scopes)
Returns all the resource permissions where scope = any ?.
|
boolean |
hasActionId(com.liferay.portal.kernel.model.ResourcePermission resourcePermission,
com.liferay.portal.kernel.model.ResourceAction resourceAction)
Returns
true if the resource permission grants permission to
perform the resource action. |
boolean |
hasResourcePermission(List<com.liferay.portal.kernel.model.Resource> resources,
long[] roleIds,
String actionId)
Returns
true if the roles have permission at the scope to
perform the action on the resources. |
boolean |
hasResourcePermission(long companyId,
String name,
int scope,
String primKey,
long[] roleIds,
String actionId)
Returns
true if the roles have permission at the scope to
perform the action on resources of the type. |
boolean |
hasResourcePermission(long companyId,
String name,
int scope,
String primKey,
long roleId,
String actionId)
Returns
true if the role has permission at the scope to
perform the action on resources of the type. |
boolean[] |
hasResourcePermissions(long companyId,
String name,
int scope,
String primKey,
long[] roleIds,
String actionId)
Deprecated.
As of Wilberforce (7.0.x), replaced by
#getRoles(long,
String, int, String, String |
boolean |
hasScopeResourcePermission(long companyId,
String name,
int scope,
long roleId,
String actionId)
Returns
true if the role has permission at the scope to
perform the action on the resource. |
protected boolean |
isGuestRoleId(long companyId,
long roleId) |
void |
mergePermissions(long fromRoleId,
long toRoleId)
Reassigns all the resource permissions from the source role to the
destination role, and deletes the source role.
|
void |
reassignPermissions(long resourcePermissionId,
long toRoleId)
Grants the role default permissions to all the resources of the type and
at the scope stored in the resource permission, deletes the resource
permission, and deletes the resource permission's role if it has no
permissions remaining.
|
void |
removeResourcePermission(long companyId,
String name,
int scope,
String primKey,
long roleId,
String actionId)
Revokes permission at the scope from the role to perform the action on
resources of the type.
|
void |
removeResourcePermissions(long companyId,
String name,
int scope,
long roleId,
String actionId)
Revokes all permissions at the scope from the role to perform the action
on resources of the type.
|
void |
setOwnerResourcePermissions(long companyId,
String name,
int scope,
String primKey,
long roleId,
long ownerId,
String[] actionIds)
Updates the role's permissions at the scope, setting the actions that can
be performed on resources of the type, also setting the owner of any
newly created resource permissions.
|
void |
setResourcePermissions(long companyId,
String name,
int scope,
String primKey,
long roleId,
String[] actionIds)
Updates the role's permissions at the scope, setting the actions that can
be performed on resources of the type.
|
void |
setResourcePermissions(long companyId,
String name,
int scope,
String primKey,
Map<Long,String[]> roleIdsToActionIds)
Updates the role's permissions at the scope, setting the actions that can
be performed on resources of the type.
|
protected void |
updateResourcePermission(long companyId,
String name,
int scope,
String primKey,
long roleId,
long ownerId,
String[] actionIds,
int operator)
Updates the role's permissions at the scope, either adding to, removing
from, or setting the actions that can be performed on resources of the
type.
|
protected void |
updateResourcePermission(long companyId,
String name,
int scope,
String primKey,
long ownerId,
Map<Long,String[]> roleIdsToActionIds)
Updates the role's permissions at the scope, either adding to, removing
from, or setting the actions that can be performed on resources of the
type.
|
addResourcePermission, afterPropertiesSet, createResourcePermission, deletePersistedModel, deleteResourcePermission, deleteResourcePermission, destroy, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, dynamicQueryCount, fetchResourcePermission, getActionableDynamicQuery, getCounterLocalService, getIndexableActionableDynamicQuery, getModelClass, getModelClassName, getOSGiServiceIdentifier, getPersistedModel, getResourceActionLocalService, getResourceActionPersistence, getResourcePermission, getResourcePermissionFinder, getResourcePermissionLocalService, getResourcePermissionPersistence, getResourcePermissions, getResourcePermissionsCount, getRoleFinder, getRoleLocalService, getRolePersistence, initActionableDynamicQuery, runSQL, setCounterLocalService, setResourceActionLocalService, setResourceActionPersistence, setResourcePermissionFinder, setResourcePermissionLocalService, setResourcePermissionPersistence, setRoleFinder, setRoleLocalService, setRolePersistence, updateResourcePermission
@Retry(acceptor=com.liferay.portal.kernel.service.ExceptionRetryAcceptor.class, properties=@Property(name="EXCEPTION_NAME",value="org.springframework.dao.DataIntegrityViolationException")) public void addResourcePermission(long companyId, String name, int scope, String primKey, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException
This method cannot be used to grant individual scope permissions, but is only intended for adding permissions at the company, group, and group-template scopes. For example, this method could be used to grant a company scope permission to edit message board posts.
If a company scope permission is granted to resources that the role already had group scope permissions to, the group scope permissions are deleted. Likewise, if a group scope permission is granted to resources that the role already had company scope permissions to, the company scope permissions are deleted. Be aware that this latter behavior can result in an overall reduction in permissions for the role.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scope. This method only supports company, group, and
group-template scope.primKey
- the primary keyroleId
- the primary key of the roleactionId
- the action IDcom.liferay.portal.kernel.exception.PortalException
public void addResourcePermissions(String resourceName, String roleName, int scope, long resourceActionBitwiseValue)
This method should only be used to add default permissions to existing resources en masse during upgrades or while verifying permissions. For example, this method could be used to grant site members individual scope permissions to view all blog posts.
resourceName
- the resource's name, which can be either a class name
or a portlet IDroleName
- the role's namescope
- the scoperesourceActionBitwiseValue
- the bitwise IDs of the actionspublic void copyModelResourcePermissions(long companyId, String name, long oldPrimKey, long newPrimKey) throws com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.PortalException
public void deleteResourcePermissions(long companyId, String name, int scope, long primKey) throws com.liferay.portal.kernel.exception.PortalException
removeResourcePermission
methods, as its purpose is very
different. This method should only be used for deleting resource
permissions that refer to a resource when that resource is deleted. For
example this method could be used to delete all individual scope
permissions to a blog post when it is deleted.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keycom.liferay.portal.kernel.exception.PortalException
public void deleteResourcePermissions(long companyId, String name, int scope, String primKey) throws com.liferay.portal.kernel.exception.PortalException
removeResourcePermission
methods, as its purpose is very
different. This method should only be used for deleting resource
permissions that refer to a resource when that resource is deleted. For
example this method could be used to delete all individual scope
permissions to a blog post when it is deleted.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keycom.liferay.portal.kernel.exception.PortalException
public com.liferay.portal.kernel.model.ResourcePermission fetchResourcePermission(long companyId, String name, int scope, String primKey, long roleId)
public Map<Long,Set<String>> getAvailableResourcePermissionActionIds(long companyId, String name, int scope, String primKey, Collection<String> actionIds)
public List<String> getAvailableResourcePermissionActionIds(long companyId, String name, int scope, String primKey, long roleId, Collection<String> actionIds) throws com.liferay.portal.kernel.exception.PortalException
companyId
- he primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleId
- the primary key of the roleactionIds
- the action IDscom.liferay.portal.kernel.exception.PortalException
@Deprecated public Map<Long,Set<String>> getAvailableResourcePermissionActionIds(long companyId, String name, int scope, String primKey, long[] roleIds, Collection<String> actionIds)
getAvailableResourcePermissionActionIds(long, String, int,
String, Collection)
public com.liferay.portal.kernel.model.ResourcePermission getResourcePermission(long companyId, String name, int scope, String primKey, long roleId) throws com.liferay.portal.kernel.exception.PortalException
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleId
- the primary key of the rolecom.liferay.portal.kernel.exception.PortalException
public List<com.liferay.portal.kernel.model.ResourcePermission> getResourcePermissions(long companyId, String name, int scope, String primKey)
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keypublic int getResourcePermissionsCount(long companyId, String name, int scope, String primKey)
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keypublic List<com.liferay.portal.kernel.model.ResourcePermission> getResourceResourcePermissions(long companyId, long groupId, String name, String primKey)
companyId
- the primary key of the resource's companygroupId
- the primary key of the resource's groupname
- the resource's name, which can be either a class name or a
portlet IDprimKey
- the primary key of the resourcepublic List<com.liferay.portal.kernel.model.ResourcePermission> getRoleResourcePermissions(long roleId)
roleId
- the primary key of the rolepublic List<com.liferay.portal.kernel.model.ResourcePermission> getRoleResourcePermissions(long roleId, int[] scopes, int start, int end)
Useful when paginating results. Returns a maximum of end -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil.ALL_POS
will return the full
result set.
roleId
- the primary key of the rolescopes
- the scopesstart
- the lower bound of the range of resultsend
- the upper bound of the range of results (not inclusive)public List<com.liferay.portal.kernel.model.Role> getRoles(long companyId, String name, int scope, String primKey, String actionId) throws com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.PortalException
public List<com.liferay.portal.kernel.model.ResourcePermission> getScopeResourcePermissions(int[] scopes)
Useful when paginating results. Returns a maximum of end -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil.ALL_POS
will return the full
result set.
scopes
- the scopespublic boolean hasActionId(com.liferay.portal.kernel.model.ResourcePermission resourcePermission, com.liferay.portal.kernel.model.ResourceAction resourceAction)
true
if the resource permission grants permission to
perform the resource action. Note that this method does not ensure that
the resource permission refers to the same type of resource as the
resource action.resourcePermission
- the resource permissionresourceAction
- the resource actiontrue
if the resource permission grants permission to
perform the resource actionpublic boolean hasResourcePermission(List<com.liferay.portal.kernel.model.Resource> resources, long[] roleIds, String actionId) throws com.liferay.portal.kernel.exception.PortalException
true
if the roles have permission at the scope to
perform the action on the resources.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
resources
- the resourcesroleIds
- the primary keys of the rolesactionId
- the action IDtrue
if any one of the roles has permission to
perform the action on any one of the resources;
false
otherwisecom.liferay.portal.kernel.exception.PortalException
public boolean hasResourcePermission(long companyId, String name, int scope, String primKey, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException
true
if the role has permission at the scope to
perform the action on resources of the type.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleId
- the primary key of the roleactionId
- the action IDtrue
if the role has permission to perform the
action on the resource; false
otherwisecom.liferay.portal.kernel.exception.PortalException
public boolean hasResourcePermission(long companyId, String name, int scope, String primKey, long[] roleIds, String actionId) throws com.liferay.portal.kernel.exception.PortalException
true
if the roles have permission at the scope to
perform the action on resources of the type.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleIds
- the primary keys of the rolesactionId
- the action IDtrue
if any one of the roles has permission to
perform the action on the resource; false
otherwisecom.liferay.portal.kernel.exception.PortalException
@Deprecated public boolean[] hasResourcePermissions(long companyId, String name, int scope, String primKey, long[] roleIds, String actionId) throws com.liferay.portal.kernel.exception.PortalException
#getRoles(long,
String, int, String, String
com.liferay.portal.kernel.exception.PortalException
public boolean hasScopeResourcePermission(long companyId, String name, int scope, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException
true
if the role has permission at the scope to
perform the action on the resource.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scoperoleId
- the primary key of the roleactionId
- the action IDtrue
if the role has permission to perform the
action on the resource; false
otherwisecom.liferay.portal.kernel.exception.PortalException
public void mergePermissions(long fromRoleId, long toRoleId) throws com.liferay.portal.kernel.exception.PortalException
fromRoleId
- the primary key of the source roletoRoleId
- the primary key of the destination rolecom.liferay.portal.kernel.exception.PortalException
public void reassignPermissions(long resourcePermissionId, long toRoleId) throws com.liferay.portal.kernel.exception.PortalException
resourcePermissionId
- the primary key of the resource permissiontoRoleId
- the primary key of the rolecom.liferay.portal.kernel.exception.PortalException
public void removeResourcePermission(long companyId, String name, int scope, String primKey, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleId
- the primary key of the roleactionId
- the action IDcom.liferay.portal.kernel.exception.PortalException
public void removeResourcePermissions(long companyId, String name, int scope, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scoperoleId
- the primary key of the roleactionId
- the action IDcom.liferay.portal.kernel.exception.PortalException
@Retry(acceptor=com.liferay.portal.kernel.service.ExceptionRetryAcceptor.class, properties=@Property(name="EXCEPTION_NAME",value="org.springframework.dao.DataIntegrityViolationException")) public void setOwnerResourcePermissions(long companyId, String name, int scope, String primKey, long roleId, long ownerId, String[] actionIds) throws com.liferay.portal.kernel.exception.PortalException
This method can be used to set permissions at any scope, but it is generally only used at the individual scope. For example, it could be used to set the guest permissions on a blog post.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleId
- the primary key of the roleownerId
- the primary key of the owner (generally the user that
created the resource)actionIds
- the action IDs of the actionscom.liferay.portal.kernel.exception.PortalException
@Retry(acceptor=com.liferay.portal.kernel.service.ExceptionRetryAcceptor.class, properties=@Property(name="EXCEPTION_NAME",value="org.springframework.dao.DataIntegrityViolationException")) public void setResourcePermissions(long companyId, String name, int scope, String primKey, long roleId, String[] actionIds) throws com.liferay.portal.kernel.exception.PortalException
This method can be used to set permissions at any scope, but it is generally only used at the individual scope. For example, it could be used to set the guest permissions on a blog post.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleId
- the primary key of the roleactionIds
- the action IDs of the actionscom.liferay.portal.kernel.exception.PortalException
@Retry(acceptor=com.liferay.portal.kernel.service.ExceptionRetryAcceptor.class, properties=@Property(name="EXCEPTION_NAME",value="org.springframework.dao.DataIntegrityViolationException")) public void setResourcePermissions(long companyId, String name, int scope, String primKey, Map<Long,String[]> roleIdsToActionIds) throws com.liferay.portal.kernel.exception.PortalException
This method can be used to set permissions at any scope, but it is generally only used at the individual scope. For example, it could be used to set the guest permissions on a blog post.
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleIdsToActionIds
- a map of role IDs to action IDs of the actionscom.liferay.portal.kernel.exception.PortalException
protected void doUpdateResourcePermission(long companyId, String name, int scope, String primKey, long ownerId, long roleId, String[] actionIds, int operator, boolean fetch) throws com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.PortalException
protected boolean isGuestRoleId(long companyId, long roleId) throws com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.PortalException
protected void updateResourcePermission(long companyId, String name, int scope, String primKey, long roleId, long ownerId, String[] actionIds, int operator) throws com.liferay.portal.kernel.exception.PortalException
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyroleId
- the primary key of the roleownerId
- the primary key of the owneractionIds
- the action IDs of the actionsoperator
- whether to add to, remove from, or set/replace the
existing actions. Possible values can be found in ResourcePermissionConstants
.com.liferay.portal.kernel.exception.PortalException
protected void updateResourcePermission(long companyId, String name, int scope, String primKey, long ownerId, Map<Long,String[]> roleIdsToActionIds) throws com.liferay.portal.kernel.exception.PortalException
Depending on the scope, the value of primKey
will have
different meanings. For more information, see ResourcePermissionImpl
.
companyId
- the primary key of the companyname
- the resource's name, which can be either a class name or a
portlet IDscope
- the scopeprimKey
- the primary keyownerId
- the primary key of the ownercom.liferay.portal.kernel.exception.PortalException