Liferay 6.1.2-ce-ga3

com.liferay.portal.service
Class ResourcePermissionLocalServiceUtil

java.lang.Object
  extended by com.liferay.portal.service.ResourcePermissionLocalServiceUtil

public class ResourcePermissionLocalServiceUtil
extends Object

The utility for the resource permission local service. This utility wraps ResourcePermissionLocalServiceImpl and is the primary access point for service operations in application layer code running on the local server.

This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.

See Also:
ResourcePermissionLocalService, ResourcePermissionLocalServiceBaseImpl, ResourcePermissionLocalServiceImpl
ServiceBuilder generated this class. Modifications in this class will be overwritten the next time it is generated.

Constructor Summary
ResourcePermissionLocalServiceUtil()
           
 
Method Summary
static 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.
static ResourcePermission addResourcePermission(ResourcePermission resourcePermission)
          Adds the resource permission to the database.
static 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.
static ResourcePermission createResourcePermission(long resourcePermissionId)
          Creates a new resource permission with the primary key.
static ResourcePermission deleteResourcePermission(long resourcePermissionId)
          Deletes the resource permission with the primary key from the database.
static ResourcePermission deleteResourcePermission(ResourcePermission resourcePermission)
          Deletes the resource permission from the database.
static void deleteResourcePermissions(long companyId, String name, int scope, long primKey)
          Deletes all resource permissions at the scope to resources of the type.
static void deleteResourcePermissions(long companyId, String name, int scope, String primKey)
          Deletes all resource permissions at the scope to resources of the type.
static DynamicQuery dynamicQuery()
           
static List dynamicQuery(DynamicQuery dynamicQuery)
          Performs a dynamic query on the database and returns the matching rows.
static List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
          Performs a dynamic query on the database and returns a range of the matching rows.
static List dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator)
          Performs a dynamic query on the database and returns an ordered range of the matching rows.
static long dynamicQueryCount(DynamicQuery dynamicQuery)
          Returns the number of rows that match the dynamic query.
static ResourcePermission fetchResourcePermission(long resourcePermissionId)
           
static Map<Long,Set<String>> getAvailableResourcePermissionActionIds(long companyId, String name, int scope, String primKey, long[] roleIds, Collection<String> actionIds)
           
static 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.
static String getBeanIdentifier()
          Returns the Spring bean ID for this bean.
static PersistedModel getPersistedModel(Serializable primaryKeyObj)
           
static ResourcePermission getResourcePermission(long resourcePermissionId)
          Returns the resource permission with the primary key.
static 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.
static List<ResourcePermission> getResourcePermissions(int start, int end)
          Returns a range of all the resource permissions.
static List<ResourcePermission> getResourcePermissions(long companyId, String name, int scope, String primKey)
          Returns all the resource permissions at the scope of the type.
static int getResourcePermissionsCount()
          Returns the number of resource permissions.
static int getResourcePermissionsCount(long companyId, String name, int scope, String primKey)
          Returns the number of resource permissions at the scope of the type.
static List<ResourcePermission> getResourceResourcePermissions(long companyId, long groupId, String name, String primKey)
          Returns the resource permissions that apply to the resource.
static List<ResourcePermission> getRoleResourcePermissions(long roleId)
          Returns all the resource permissions for the role.
static List<ResourcePermission> getRoleResourcePermissions(long roleId, int[] scopes, int start, int end)
          Returns a range of all the resource permissions for the role at the scopes.
static List<ResourcePermission> getScopeResourcePermissions(int[] scopes)
          Returns all the resource permissions where scope = any ?.
static ResourcePermissionLocalService getService()
           
static boolean hasActionId(ResourcePermission resourcePermission, ResourceAction resourceAction)
          Returns true if the resource permission grants permission to perform the resource action.
static boolean hasResourcePermission(List<Resource> resources, long[] roleIds, String actionId)
          Returns true if the roles have permission at the scope to perform the action on the resources.
static 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.
static 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.
static boolean[] hasResourcePermissions(long companyId, String name, int scope, String primKey, long[] roleIds, String actionId)
           
static 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.
static void mergePermissions(long fromRoleId, long toRoleId)
          Reassigns all the resource permissions from the source role to the destination role, and deletes the source role.
static 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.
static 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.
static 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.
static void setBeanIdentifier(String beanIdentifier)
          Sets the Spring bean ID for this bean.
static 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.
static 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.
static 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 setService(ResourcePermissionLocalService service)
          Deprecated.  
static ResourcePermission updateResourcePermission(ResourcePermission resourcePermission)
          Updates the resource permission in the database or adds it if it does not yet exist.
static ResourcePermission updateResourcePermission(ResourcePermission resourcePermission, boolean merge)
          Updates the resource permission in the database or adds it if it does not yet exist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourcePermissionLocalServiceUtil

public ResourcePermissionLocalServiceUtil()
Method Detail

addResourcePermission

public static ResourcePermission addResourcePermission(ResourcePermission resourcePermission)
                                                throws SystemException
Adds the resource permission to the database. Also notifies the appropriate model listeners.

Parameters:
resourcePermission - the resource permission
Returns:
the resource permission that was added
Throws:
SystemException - if a system exception occurred

createResourcePermission

public static ResourcePermission createResourcePermission(long resourcePermissionId)
Creates a new resource permission with the primary key. Does not add the resource permission to the database.

Parameters:
resourcePermissionId - the primary key for the new resource permission
Returns:
the new resource permission

deleteResourcePermission

public static ResourcePermission deleteResourcePermission(long resourcePermissionId)
                                                   throws PortalException,
                                                          SystemException
Deletes the resource permission with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
resourcePermissionId - the primary key of the resource permission
Returns:
the resource permission that was removed
Throws:
PortalException - if a resource permission with the primary key could not be found
SystemException - if a system exception occurred

deleteResourcePermission

public static ResourcePermission deleteResourcePermission(ResourcePermission resourcePermission)
                                                   throws SystemException
Deletes the resource permission from the database. Also notifies the appropriate model listeners.

Parameters:
resourcePermission - the resource permission
Returns:
the resource permission that was removed
Throws:
SystemException - if a system exception occurred

dynamicQuery

public static DynamicQuery dynamicQuery()

dynamicQuery

public static List dynamicQuery(DynamicQuery dynamicQuery)
                         throws SystemException
Performs a dynamic query on the database and returns the matching rows.

Parameters:
dynamicQuery - the dynamic query
Returns:
the matching rows
Throws:
SystemException - if a system exception occurred

dynamicQuery

public static List dynamicQuery(DynamicQuery dynamicQuery,
                                int start,
                                int end)
                         throws SystemException
Performs a dynamic query on the database and returns a range of the matching rows.

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.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
Returns:
the range of matching rows
Throws:
SystemException - if a system exception occurred

dynamicQuery

public static List dynamicQuery(DynamicQuery dynamicQuery,
                                int start,
                                int end,
                                OrderByComparator orderByComparator)
                         throws SystemException
Performs a dynamic query on the database and returns an ordered range of the matching rows.

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.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of matching rows
Throws:
SystemException - if a system exception occurred

dynamicQueryCount

public static long dynamicQueryCount(DynamicQuery dynamicQuery)
                              throws SystemException
Returns the number of rows that match the dynamic query.

Parameters:
dynamicQuery - the dynamic query
Returns:
the number of rows that match the dynamic query
Throws:
SystemException - if a system exception occurred

fetchResourcePermission

public static ResourcePermission fetchResourcePermission(long resourcePermissionId)
                                                  throws SystemException
Throws:
SystemException

getResourcePermission

public static ResourcePermission getResourcePermission(long resourcePermissionId)
                                                throws PortalException,
                                                       SystemException
Returns the resource permission with the primary key.

Parameters:
resourcePermissionId - the primary key of the resource permission
Returns:
the resource permission
Throws:
PortalException - if a resource permission with the primary key could not be found
SystemException - if a system exception occurred

getPersistedModel

public static PersistedModel getPersistedModel(Serializable primaryKeyObj)
                                        throws PortalException,
                                               SystemException
Throws:
PortalException
SystemException

getResourcePermissions

public static List<ResourcePermission> getResourcePermissions(int start,
                                                              int end)
                                                       throws SystemException
Returns a range of all the resource permissions.

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.

Parameters:
start - the lower bound of the range of resource permissions
end - the upper bound of the range of resource permissions (not inclusive)
Returns:
the range of resource permissions
Throws:
SystemException - if a system exception occurred

getResourcePermissionsCount

public static int getResourcePermissionsCount()
                                       throws SystemException
Returns the number of resource permissions.

Returns:
the number of resource permissions
Throws:
SystemException - if a system exception occurred

updateResourcePermission

public static ResourcePermission updateResourcePermission(ResourcePermission resourcePermission)
                                                   throws SystemException
Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

Parameters:
resourcePermission - the resource permission
Returns:
the resource permission that was updated
Throws:
SystemException - if a system exception occurred

updateResourcePermission

public static ResourcePermission updateResourcePermission(ResourcePermission resourcePermission,
                                                          boolean merge)
                                                   throws SystemException
Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

Parameters:
resourcePermission - the resource permission
merge - whether to merge the resource permission with the current session. See BatchSession.update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean) for an explanation.
Returns:
the resource permission that was updated
Throws:
SystemException - if a system exception occurred

getBeanIdentifier

public static String getBeanIdentifier()
Returns the Spring bean ID for this bean.

Returns:
the Spring bean ID for this bean

setBeanIdentifier

public static void setBeanIdentifier(String beanIdentifier)
Sets the Spring bean ID for this bean.

Parameters:
beanIdentifier - the Spring bean ID for this bean

addResourcePermission

public static void addResourcePermission(long companyId,
                                         String name,
                                         int scope,
                                         String primKey,
                                         long roleId,
                                         String actionId)
                                  throws PortalException,
                                         SystemException
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, see ResourcePermissionImpl.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope. This method only supports company, group, and group-template scope.
primKey - the primary key
roleId - the primary key of the role
actionId - the action ID
Throws:
PortalException - if scope was set to individual scope or if a role with the primary key or a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

addResourcePermissions

public static void addResourcePermissions(String resourceName,
                                          String roleName,
                                          int scope,
                                          long resourceActionBitwiseValue)
                                   throws SystemException
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 ID
roleName - the role's name
scope - the scope
resourceActionBitwiseValue - the bitwise IDs of the actions
Throws:
SystemException - if a system exception occurred

deleteResourcePermissions

public static void deleteResourcePermissions(long companyId,
                                             String name,
                                             int scope,
                                             long primKey)
                                      throws PortalException,
                                             SystemException
Deletes all resource permissions at the scope to resources of the type. This method should not be confused with any of the 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.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

deleteResourcePermissions

public static void deleteResourcePermissions(long companyId,
                                             String name,
                                             int scope,
                                             String primKey)
                                      throws PortalException,
                                             SystemException
Deletes all resource permissions at the scope to resources of the type. This method should not be confused with any of the 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.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

getAvailableResourcePermissionActionIds

public static List<String> getAvailableResourcePermissionActionIds(long companyId,
                                                                   String name,
                                                                   int scope,
                                                                   String primKey,
                                                                   long roleId,
                                                                   Collection<String> actionIds)
                                                            throws PortalException,
                                                                   SystemException
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 company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
roleId - the primary key of the role
actionIds - the action IDs
Returns:
the intersection of action IDs the role has permission at the scope to perform on resources of the type
Throws:
PortalException - if a resouce action could not be found for any one of the actions on the resource
SystemException - if a system exception occurred

getAvailableResourcePermissionActionIds

public static Map<Long,Set<String>> getAvailableResourcePermissionActionIds(long companyId,
                                                                            String name,
                                                                            int scope,
                                                                            String primKey,
                                                                            long[] roleIds,
                                                                            Collection<String> actionIds)
                                                                     throws PortalException,
                                                                            SystemException
Throws:
PortalException
SystemException

getResourcePermission

public static ResourcePermission getResourcePermission(long companyId,
                                                       String name,
                                                       int scope,
                                                       String primKey,
                                                       long roleId)
                                                throws PortalException,
                                                       SystemException
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 company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
roleId - 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:
PortalException - if no matching resources could be found
SystemException - if a system exception occurred

getResourcePermissions

public static List<ResourcePermission> getResourcePermissions(long companyId,
                                                              String name,
                                                              int scope,
                                                              String primKey)
                                                       throws SystemException
Returns all the resource permissions at the scope of the type.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
Returns:
the resource permissions at the scope of the type
Throws:
SystemException - if a system exception occurred

getResourcePermissionsCount

public static int getResourcePermissionsCount(long companyId,
                                              String name,
                                              int scope,
                                              String primKey)
                                       throws SystemException
Returns the number of resource permissions at the scope of the type.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
Returns:
the number of resource permissions at the scope of the type
Throws:
SystemException - if a system exception occurred

getResourceResourcePermissions

public static List<ResourcePermission> getResourceResourcePermissions(long companyId,
                                                                      long groupId,
                                                                      String name,
                                                                      String primKey)
                                                               throws SystemException
Returns the resource permissions that apply to the resource.

Parameters:
companyId - the primary key of the resource's company
groupId - the primary key of the resource's group
name - the resource's name, which can be either a class name or a portlet ID
primKey - the primary key of the resource
Returns:
the resource permissions associated with the resource
Throws:
SystemException - if a system exception occurred

getRoleResourcePermissions

public static List<ResourcePermission> getRoleResourcePermissions(long roleId)
                                                           throws SystemException
Returns all the resource permissions for the role.

Parameters:
roleId - the primary key of the role
Returns:
the resource permissions for the role
Throws:
SystemException - if a system exception occurred

getRoleResourcePermissions

public static List<ResourcePermission> getRoleResourcePermissions(long roleId,
                                                                  int[] scopes,
                                                                  int start,
                                                                  int end)
                                                           throws SystemException
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 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.

Parameters:
roleId - the primary key of the role
scopes - the scopes
start - the lower bound of the range of results
end - the upper bound of the range of results (not inclusive)
Returns:
the range of resource permissions for the role at the scopes
Throws:
SystemException - if a system exception occurred

getScopeResourcePermissions

public static List<ResourcePermission> getScopeResourcePermissions(int[] scopes)
                                                            throws SystemException
Returns all the resource permissions where scope = any ?.

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.

Parameters:
scopes - the scopes
Returns:
the resource permissions where scope = any ?
Throws:
SystemException - if a system exception occurred

hasActionId

public static boolean hasActionId(ResourcePermission resourcePermission,
                                  ResourceAction resourceAction)
Returns 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.

Parameters:
resourcePermission - the resource permission
resourceAction - the resource action
Returns:
true if the resource permission grants permission to perform the resource action

hasResourcePermission

public static boolean hasResourcePermission(List<Resource> resources,
                                            long[] roleIds,
                                            String actionId)
                                     throws PortalException,
                                            SystemException
Returns 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.

Parameters:
resources - the resources
roleIds - the primary keys of the roles
actionId - 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:
PortalException - if any one of the roles with the primary keys could not be found or if a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

hasResourcePermission

public static boolean hasResourcePermission(long companyId,
                                            String name,
                                            int scope,
                                            String primKey,
                                            long roleId,
                                            String actionId)
                                     throws PortalException,
                                            SystemException
Returns 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.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
roleId - the primary key of the role
actionId - the action ID
Returns:
true if the role has permission to perform the action on the resource; false otherwise
Throws:
PortalException - if a role with the primary key or a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

hasResourcePermission

public static boolean hasResourcePermission(long companyId,
                                            String name,
                                            int scope,
                                            String primKey,
                                            long[] roleIds,
                                            String actionId)
                                     throws PortalException,
                                            SystemException
Returns 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.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
roleIds - the primary keys of the roles
actionId - the action ID
Returns:
true if any one of the roles has permission to perform the action on the resource; false otherwise
Throws:
PortalException - if any one of the roles with the primary keys could not be found or if a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

hasResourcePermissions

public static boolean[] hasResourcePermissions(long companyId,
                                               String name,
                                               int scope,
                                               String primKey,
                                               long[] roleIds,
                                               String actionId)
                                        throws PortalException,
                                               SystemException
Throws:
PortalException
SystemException

hasScopeResourcePermission

public static boolean hasScopeResourcePermission(long companyId,
                                                 String name,
                                                 int scope,
                                                 long roleId,
                                                 String actionId)
                                          throws PortalException,
                                                 SystemException
Returns 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.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
roleId - the primary key of the role
actionId - the action ID
Returns:
true if the role has permission to perform the action on the resource; false otherwise
Throws:
PortalException - if a role with the primary key or a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

mergePermissions

public static void mergePermissions(long fromRoleId,
                                    long toRoleId)
                             throws PortalException,
                                    SystemException
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 role
toRoleId - the primary key of the destination role
Throws:
PortalException - if a role with the primary key could not be found
SystemException - if a system exception occurred

reassignPermissions

public static void reassignPermissions(long resourcePermissionId,
                                       long toRoleId)
                                throws PortalException,
                                       SystemException
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 permission
toRoleId - the primary key of the role
Throws:
PortalException - if a resource permission or role with the primary key could not be found
SystemException - if a system exception occurred

removeResourcePermission

public static void removeResourcePermission(long companyId,
                                            String name,
                                            int scope,
                                            String primKey,
                                            long roleId,
                                            String actionId)
                                     throws PortalException,
                                            SystemException
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, see ResourcePermissionImpl.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
roleId - the primary key of the role
actionId - the action ID
Throws:
PortalException - if a role with the primary key or a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

removeResourcePermissions

public static void removeResourcePermissions(long companyId,
                                             String name,
                                             int scope,
                                             long roleId,
                                             String actionId)
                                      throws PortalException,
                                             SystemException
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 company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
roleId - the primary key of the role
actionId - the action ID
Throws:
PortalException - if a role with the primary key or a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

setOwnerResourcePermissions

public static void setOwnerResourcePermissions(long companyId,
                                               String name,
                                               int scope,
                                               String primKey,
                                               long roleId,
                                               long ownerId,
                                               String[] actionIds)
                                        throws PortalException,
                                               SystemException
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, see ResourcePermissionImpl.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
roleId - the primary key of the role
ownerId - the primary key of the owner (generally the user that created the resource)
actionIds - the action IDs of the actions
Throws:
PortalException - if a role with the primary key or a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

setResourcePermissions

public static void setResourcePermissions(long companyId,
                                          String name,
                                          int scope,
                                          String primKey,
                                          long roleId,
                                          String[] actionIds)
                                   throws PortalException,
                                          SystemException
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, see ResourcePermissionImpl.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
roleId - the primary key of the role
actionIds - the action IDs of the actions
Throws:
PortalException - if a role with the primary key or a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

setResourcePermissions

public static void setResourcePermissions(long companyId,
                                          String name,
                                          int scope,
                                          String primKey,
                                          Map<Long,String[]> roleIdsToActionIds)
                                   throws PortalException,
                                          SystemException
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, see ResourcePermissionImpl.

Parameters:
companyId - the primary key of the company
name - the resource's name, which can be either a class name or a portlet ID
scope - the scope
primKey - the primary key
roleIdsToActionIds - a map of role IDs to action IDs of the actions
Throws:
PortalException - if a role with the primary key or a resource action with the name and action ID could not be found
SystemException - if a system exception occurred

getService

public static ResourcePermissionLocalService getService()

setService

public void setService(ResourcePermissionLocalService service)
Deprecated. 


Liferay 6.1.2-ce-ga3