Class ResourcePermissionLocalServiceImpl
- All Implemented Interfaces:
com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService
,com.liferay.portal.kernel.service.BaseLocalService
,com.liferay.portal.kernel.service.change.tracking.CTService<com.liferay.portal.kernel.model.ResourcePermission>
,com.liferay.portal.kernel.service.PersistedModelLocalService
,com.liferay.portal.kernel.service.ResourcePermissionLocalService
Before attempting to read any of the documentation for this class, first read
ResourcePermissionImpl
for an
explanation of scoping.
- Author:
- Brian Wing Shun Chan, Raymond Augé, Connor McKay
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
-
Field Summary
Fields inherited from class com.liferay.portal.service.base.ResourcePermissionLocalServiceBaseImpl
counterLocalService, resourcePermissionFinder, resourcePermissionLocalService, resourcePermissionPersistence
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addGroupPermissions
(long groupId, com.liferay.portal.kernel.model.Resource resource, String[] actionIds) protected void
addGuestPermissions
(com.liferay.portal.kernel.model.Resource resource, String[] actionIds) void
addModelResourcePermissions
(long companyId, long groupId, long userId, String name, String primKey, com.liferay.portal.kernel.service.permission.ModelPermissions modelPermissions) void
addModelResourcePermissions
(long companyId, long groupId, long userId, String name, String primKey, String[] groupPermissions, String[] guestPermissions) Adds resources for the model with the name and primary key string, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.void
addModelResourcePermissions
(com.liferay.portal.kernel.model.AuditedModel auditedModel, com.liferay.portal.kernel.service.ServiceContext serviceContext) 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
(long companyId, long groupId, long userId, String name, String[] primKeys, boolean portletActions, com.liferay.portal.kernel.service.ServiceContext serviceContext) void
addResourcePermissions
(long companyId, long groupId, long userId, String name, String primKey, boolean portletActions, com.liferay.portal.kernel.service.ServiceContext serviceContext) Adds resources for the entity with the name and primary key string, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.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
void
copyModelResourcePermissions
(long companyId, String name, long sourcePrimKey, long targetPrimKey) void
deleteResourcePermissions
(long companyId, String name, int scope) 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.void
com.liferay.portal.kernel.model.ResourcePermission
fetchResourcePermission
(long companyId, String name, int scope, String primKey, long roleId) 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.getAvailableResourcePermissionActionIds
(long companyId, String name, int scope, String primKey, Collection<String> actionIds) protected long
getGroupId
(com.liferay.portal.kernel.model.AuditedModel auditedModel) getIndividualPortletResourcePermissions
(long companyId) 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, long roleId, boolean viewActionId) 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.List<com.liferay.portal.kernel.model.ResourcePermission>
getResourcePermissions
(String name) 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.protected com.liferay.portal.kernel.model.Role
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>
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) Returnstrue
if the resource permission grants permission to perform the resource action.boolean
hasResourcePermission
(long companyId, String name, int scope, String primKey, long[] roleIds, String actionId) Returnstrue
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) Returnstrue
if the role has permission at the scope to perform the action on resources of the type.boolean
hasResourcePermission
(List<com.liferay.portal.kernel.model.Resource> resources, long[] roleIds, String actionId) Returnstrue
if the roles have permission at the scope to perform the action on the resources.boolean
hasScopeResourcePermission
(long companyId, String name, int scope, long roleId, String actionId) Returnstrue
if the role has permission at the scope to perform the action on the resource.void
initDefaultModelResourcePermissions
(long companyId, Collection<String> modelResources) void
initPortletDefaultPermissions
(com.liferay.portal.kernel.model.Portlet portlet) protected boolean
isGuestRoleId
(long companyId, long roleId, Boolean guestRole) 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.void
updateModelResourcePermissions
(com.liferay.portal.kernel.model.AuditedModel auditedModel, com.liferay.portal.kernel.service.ServiceContext serviceContext) Updates the resources for the model, replacing their group and guest permissions with new ones from the service context.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.void
updateResourcePermissions
(long companyId, long groupId, String name, long primKey, String[] groupPermissions, String[] guestPermissions) Updates resources matching the group, name, and primary key at the individual scope, setting new group and guest permissions.void
updateResourcePermissions
(long companyId, long groupId, String name, String primKey, com.liferay.portal.kernel.service.permission.ModelPermissions modelPermissions) void
updateResourcePermissions
(long companyId, long groupId, String name, String primKey, String[] groupPermissions, String[] guestPermissions) void
updateResourcePermissions
(long companyId, String name, int scope, String primKey, String newPrimKey) protected void
Methods inherited from class com.liferay.portal.service.base.ResourcePermissionLocalServiceBaseImpl
addResourcePermission, createPersistedModel, createResourcePermission, deletePersistedModel, deleteResourcePermission, deleteResourcePermission, destroy, dslQuery, dslQueryCount, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, dynamicQueryCount, fetchResourcePermission, getActionableDynamicQuery, getBasePersistence, getCounterLocalService, getCTPersistence, getIndexableActionableDynamicQuery, getModelClass, getModelClassName, getOSGiServiceIdentifier, getPersistedModel, getResourcePermission, getResourcePermissionFinder, getResourcePermissionLocalService, getResourcePermissionPersistence, getResourcePermissions, getResourcePermissionsCount, initActionableDynamicQuery, runSQL, setCounterLocalService, setResourcePermissionFinder, setResourcePermissionLocalService, setResourcePermissionPersistence, updateResourcePermission, updateWithUnsafeFunction
Methods inherited from class com.liferay.portal.kernel.service.BaseLocalServiceImpl
getClassLoader, getLocalizationMap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.liferay.portal.kernel.service.PersistedModelLocalService
fetchPersistedModel
-
Constructor Details
-
ResourcePermissionLocalServiceImpl
public ResourcePermissionLocalServiceImpl()
-
-
Method Details
-
addModelResourcePermissions
public void addModelResourcePermissions(com.liferay.portal.kernel.model.AuditedModel auditedModel, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
addModelResourcePermissions
public void addModelResourcePermissions(long companyId, long groupId, long userId, String name, String primKey, com.liferay.portal.kernel.service.permission.ModelPermissions modelPermissions) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
addModelResourcePermissions
public void addModelResourcePermissions(long companyId, long groupId, long userId, String name, String primKey, String[] groupPermissions, String[] guestPermissions) throws com.liferay.portal.kernel.exception.PortalException Adds resources for the model with the name and primary key string, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.- Parameters:
companyId
- the primary key of the portal instancegroupId
- the primary key of the groupuserId
- the primary key of the user adding the resourcesname
- a name for the resource, typically the model's class nameprimKey
- the primary key string of the model instance, optionally an empty string if no instance existsgroupPermissions
- the group permissions to be appliedguestPermissions
- the guest permissions to be applied- Throws:
com.liferay.portal.kernel.exception.PortalException
-
addResourcePermission
@Retry(acceptor=com.liferay.portal.kernel.service.SQLStateAcceptor.class, properties=@Property(name="SQLSTATE",value="23")) public void addResourcePermission(long companyId, String name, int scope, String primKey, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException Grants the role permission at the scope to perform the action on resources of the type. Existing actions are retained.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, seeResourcePermissionImpl
.- Parameters:
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 ID- Throws:
com.liferay.portal.kernel.exception.PortalException
-
addResourcePermissions
public void addResourcePermissions(long companyId, long groupId, long userId, String name, String primKey, boolean portletActions, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException Adds resources for the entity with the name and primary key string, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.- Parameters:
companyId
- the primary key of the portal instancegroupId
- the primary key of the groupuserId
- the primary key of the user adding the resourcesname
- a name for the resource, which should be a portlet ID if the resource is a portlet or the resource's class name otherwiseprimKey
- the primary key string of the resource instance, optionally an empty string if no instance existsportletActions
- whether to associate portlet actions with the resource- Throws:
com.liferay.portal.kernel.exception.PortalException
-
addResourcePermissions
public void addResourcePermissions(long companyId, long groupId, long userId, String name, String[] primKeys, boolean portletActions, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
addResourcePermissions
public 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. Existing actions are retained.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.
- Parameters:
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 actions
-
afterPropertiesSet
public void afterPropertiesSet()- Overrides:
afterPropertiesSet
in classResourcePermissionLocalServiceBaseImpl
-
copyModelResourcePermissions
public void copyModelResourcePermissions(long companyId, String name, long sourcePrimKey, long targetPrimKey) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
deleteResourcePermissions
public void deleteResourcePermissions(long companyId, String name, int scope) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
deleteResourcePermissions
public void deleteResourcePermissions(long companyId, String name, int scope, long primKey) throws com.liferay.portal.kernel.exception.PortalException Deletes all resource permissions at the scope to resources of the type. This method should not be confused with any of theremoveResourcePermission
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, seeResourcePermissionImpl
.- Parameters:
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 key- Throws:
com.liferay.portal.kernel.exception.PortalException
-
deleteResourcePermissions
public void deleteResourcePermissions(long companyId, String name, int scope, String primKey) throws com.liferay.portal.kernel.exception.PortalException Deletes all resource permissions at the scope to resources of the type. This method should not be confused with any of theremoveResourcePermission
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, seeResourcePermissionImpl
.- Parameters:
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 key- Throws:
com.liferay.portal.kernel.exception.PortalException
-
deleteResourcePermissions
-
fetchResourcePermission
-
getAvailableResourcePermissionActionIds
-
getAvailableResourcePermissionActionIds
public List<String> getAvailableResourcePermissionActionIds(long companyId, String name, int scope, String primKey, long roleId, Collection<String> actionIds) throws com.liferay.portal.kernel.exception.PortalException Returns the intersection of action IDs the role has permission at the scope to perform on resources of the type.- Parameters:
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 IDs- Returns:
- the intersection of action IDs the role has permission at the scope to perform on resources of the type
- Throws:
com.liferay.portal.kernel.exception.PortalException
-
getIndividualPortletResourcePermissions
-
getResourcePermission
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 Returns the resource permission for the role at the scope to perform the actions on resources of the type.- Parameters:
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 role- Returns:
- the resource permission for the role at the scope to perform the actions on resources of the type
- Throws:
com.liferay.portal.kernel.exception.PortalException
-
getResourcePermissions
-
getResourcePermissions
public 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.- Parameters:
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 key- Returns:
- the resource permissions at the scope of the type
-
getResourcePermissions
-
getResourcePermissionsCount
Returns the number of resource permissions at the scope of the type.- Parameters:
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 key- Returns:
- the number of resource permissions at the scope of the type
-
getResourceResourcePermissions
public 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.- Parameters:
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 resource- Returns:
- the resource permissions associated with the resource
-
getRoleResourcePermissions
public List<com.liferay.portal.kernel.model.ResourcePermission> getRoleResourcePermissions(long roleId) Returns all the resource permissions for the role.- Parameters:
roleId
- the primary key of the role- Returns:
- the resource permissions for the role
-
getRoleResourcePermissions
public 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.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil.ALL_POS
will return the full result set.- Parameters:
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)- Returns:
- the range of resource permissions for the role at the scopes
-
getRoles
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 - Throws:
com.liferay.portal.kernel.exception.PortalException
-
getScopeResourcePermissions
public List<com.liferay.portal.kernel.model.ResourcePermission> getScopeResourcePermissions(int[] scopes) Returns all the resource permissions where scope = any ?.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil.ALL_POS
will return the full result set.- Parameters:
scopes
- the scopes- Returns:
- the resource permissions where scope = any ?
-
hasActionId
public boolean hasActionId(com.liferay.portal.kernel.model.ResourcePermission resourcePermission, com.liferay.portal.kernel.model.ResourceAction resourceAction) Returnstrue
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.- Parameters:
resourcePermission
- the resource permissionresourceAction
- the resource action- Returns:
true
if the resource permission grants permission to perform the resource action
-
hasResourcePermission
public boolean hasResourcePermission(List<com.liferay.portal.kernel.model.Resource> resources, long[] roleIds, String actionId) throws com.liferay.portal.kernel.exception.PortalException Returnstrue
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, seeResourcePermissionImpl
.- Parameters:
resources
- the resourcesroleIds
- the primary keys of the rolesactionId
- the action ID- Returns:
true
if any one of the roles has permission to perform the action on any one of the resources;false
otherwise- Throws:
com.liferay.portal.kernel.exception.PortalException
-
hasResourcePermission
public boolean hasResourcePermission(long companyId, String name, int scope, String primKey, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException Returnstrue
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, seeResourcePermissionImpl
.- Parameters:
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 ID- Returns:
true
if the role has permission to perform the action on the resource;false
otherwise- Throws:
com.liferay.portal.kernel.exception.PortalException
-
hasResourcePermission
public boolean hasResourcePermission(long companyId, String name, int scope, String primKey, long[] roleIds, String actionId) throws com.liferay.portal.kernel.exception.PortalException Returnstrue
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, seeResourcePermissionImpl
.- Parameters:
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 ID- Returns:
true
if any one of the roles has permission to perform the action on the resource;false
otherwise- Throws:
com.liferay.portal.kernel.exception.PortalException
-
hasScopeResourcePermission
public boolean hasScopeResourcePermission(long companyId, String name, int scope, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException Returnstrue
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, seeResourcePermissionImpl
.- Parameters:
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 ID- Returns:
true
if the role has permission to perform the action on the resource;false
otherwise- Throws:
com.liferay.portal.kernel.exception.PortalException
-
initDefaultModelResourcePermissions
public void initDefaultModelResourcePermissions(long companyId, Collection<String> modelResources) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
initPortletDefaultPermissions
public void initPortletDefaultPermissions(com.liferay.portal.kernel.model.Portlet portlet) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
mergePermissions
public void mergePermissions(long fromRoleId, long toRoleId) throws com.liferay.portal.kernel.exception.PortalException Reassigns all the resource permissions from the source role to the destination role, and deletes the source role.- Parameters:
fromRoleId
- the primary key of the source roletoRoleId
- the primary key of the destination role- Throws:
com.liferay.portal.kernel.exception.PortalException
-
reassignPermissions
public void reassignPermissions(long resourcePermissionId, long toRoleId) throws com.liferay.portal.kernel.exception.PortalException 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.- Parameters:
resourcePermissionId
- the primary key of the resource permissiontoRoleId
- the primary key of the role- Throws:
com.liferay.portal.kernel.exception.PortalException
-
removeResourcePermission
public void removeResourcePermission(long companyId, String name, int scope, String primKey, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException Revokes permission at the scope from the role to perform the action on resources of the type. For example, this method could be used to revoke a group scope permission to edit blog posts.Depending on the scope, the value of
primKey
will have different meanings. For more information, seeResourcePermissionImpl
.- Parameters:
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 ID- Throws:
com.liferay.portal.kernel.exception.PortalException
-
removeResourcePermissions
public void removeResourcePermissions(long companyId, String name, int scope, long roleId, String actionId) throws com.liferay.portal.kernel.exception.PortalException Revokes all permissions at the scope from the role to perform the action on resources of the type. For example, this method could be used to revoke all individual scope permissions to edit blog posts from site members.- Parameters:
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 ID- Throws:
com.liferay.portal.kernel.exception.PortalException
-
setOwnerResourcePermissions
@Retry(acceptor=com.liferay.portal.kernel.service.SQLStateAcceptor.class, properties=@Property(name="SQLSTATE",value="23")) public void setOwnerResourcePermissions(long companyId, String name, int scope, String primKey, long roleId, long ownerId, String[] actionIds) throws com.liferay.portal.kernel.exception.PortalException 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. Existing actions are replaced.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, seeResourcePermissionImpl
.- Parameters:
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 actions- Throws:
com.liferay.portal.kernel.exception.PortalException
-
setResourcePermissions
@Retry(acceptor=com.liferay.portal.kernel.service.SQLStateAcceptor.class, properties=@Property(name="SQLSTATE",value="23")) public void setResourcePermissions(long companyId, String name, int scope, String primKey, long roleId, String[] actionIds) throws com.liferay.portal.kernel.exception.PortalException Updates the role's permissions at the scope, setting the actions that can be performed on resources of the type. Existing actions are replaced.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, seeResourcePermissionImpl
.- Parameters:
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 actions- Throws:
com.liferay.portal.kernel.exception.PortalException
-
setResourcePermissions
@Retry(acceptor=com.liferay.portal.kernel.service.SQLStateAcceptor.class, properties=@Property(name="SQLSTATE",value="23")) public void setResourcePermissions(long companyId, String name, int scope, String primKey, Map<Long, String[]> roleIdsToActionIds) throws com.liferay.portal.kernel.exception.PortalExceptionUpdates the role's permissions at the scope, setting the actions that can be performed on resources of the type. Existing actions are replaced.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, seeResourcePermissionImpl
.- Parameters:
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 actions- Throws:
com.liferay.portal.kernel.exception.PortalException
-
updateModelResourcePermissions
public void updateModelResourcePermissions(com.liferay.portal.kernel.model.AuditedModel auditedModel, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException Updates the resources for the model, replacing their group and guest permissions with new ones from the service context.- Parameters:
auditedModel
- the model associated with the resourcesserviceContext
- the service context to be applied. Can set group and guest permissions.- Throws:
com.liferay.portal.kernel.exception.PortalException
-
updateResourcePermissions
public void updateResourcePermissions(long companyId, long groupId, String name, long primKey, String[] groupPermissions, String[] guestPermissions) throws com.liferay.portal.kernel.exception.PortalException Updates resources matching the group, name, and primary key at the individual scope, setting new group and guest permissions.- Parameters:
companyId
- the primary key of the portal instancegroupId
- the primary key of the groupname
- the resource's name, which should be a portlet ID if the resource is a portlet or the resource's class name otherwiseprimKey
- the primary key of the resource instancegroupPermissions
- the group permissions to be appliedguestPermissions
- the guest permissions to be applied- Throws:
com.liferay.portal.kernel.exception.PortalException
-
updateResourcePermissions
public void updateResourcePermissions(long companyId, long groupId, String name, String primKey, com.liferay.portal.kernel.service.permission.ModelPermissions modelPermissions) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
updateResourcePermissions
public void updateResourcePermissions(long companyId, long groupId, String name, String primKey, String[] groupPermissions, String[] guestPermissions) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
updateResourcePermissions
-
addGroupPermissions
protected void addGroupPermissions(long groupId, com.liferay.portal.kernel.model.Resource resource, String[] actionIds) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
addGuestPermissions
protected void addGuestPermissions(com.liferay.portal.kernel.model.Resource resource, String[] actionIds) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
getGroupId
protected long getGroupId(com.liferay.portal.kernel.model.AuditedModel auditedModel) -
getRole
protected com.liferay.portal.kernel.model.Role getRole(long companyId, long groupId, String roleName) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-
isGuestRoleId
-
updateResourcePermission
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 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. Automatically creates a new resource permission if none exists, or deletes the existing resource permission if it no longer grants permissions to perform any action.Depending on the scope, the value of
primKey
will have different meanings. For more information, seeResourcePermissionImpl
.- Parameters:
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 inResourcePermissionConstants
.- Throws:
com.liferay.portal.kernel.exception.PortalException
-
updateResourcePermission
protected void updateResourcePermission(long companyId, String name, int scope, String primKey, long ownerId, Map<Long, String[]> roleIdsToActionIds) throws com.liferay.portal.kernel.exception.PortalExceptionUpdates 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. Automatically creates a new resource permission if none exists, or deletes the existing resource permission if it no longer grants permissions to perform any action.Depending on the scope, the value of
primKey
will have different meanings. For more information, seeResourcePermissionImpl
.- Parameters:
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 owner- Throws:
com.liferay.portal.kernel.exception.PortalException
-
validate
protected void validate(String name, boolean portletActions) throws com.liferay.portal.kernel.exception.PortalException - Throws:
com.liferay.portal.kernel.exception.PortalException
-