Liferay 6.2-ce-ga5

com.liferay.portal.service.impl
Class ResourcePermissionLocalServiceImpl

java.lang.Object
  extended by com.liferay.portal.service.BaseLocalServiceImpl
      extended by com.liferay.portal.service.base.ResourcePermissionLocalServiceBaseImpl
          extended by com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl
All Implemented Interfaces:
IdentifiableBean, BaseLocalService, PersistedModelLocalService, ResourcePermissionLocalService

public class ResourcePermissionLocalServiceImpl
extends ResourcePermissionLocalServiceBaseImpl

Provides the local service for accessing, adding, checking, deleting, granting, and revoking resource permissions.

Before attempting to read any of the documentation for this class, first read ResourcePermissionImpl for an explanation of scoping.


Field Summary
static String[] EMPTY_ACTION_IDS
           
 
Fields inherited from class com.liferay.portal.service.base.ResourcePermissionLocalServiceBaseImpl
accountLocalService, accountPersistence, accountService, addressLocalService, addressPersistence, addressService, backgroundTaskLocalService, backgroundTaskPersistence, backgroundTaskService, browserTrackerLocalService, browserTrackerPersistence, classNameLocalService, classNamePersistence, classNameService, clusterGroupLocalService, clusterGroupPersistence, cmisRepositoryLocalService, companyLocalService, companyPersistence, companyService, contactLocalService, contactPersistence, contactService, counterLocalService, countryPersistence, countryService, emailAddressLocalService, emailAddressPersistence, emailAddressService, groupFinder, groupLocalService, groupPersistence, groupService, imageLocalService, imagePersistence, imageService, layoutBranchLocalService, layoutBranchPersistence, layoutBranchService, layoutFinder, layoutFriendlyURLLocalService, layoutFriendlyURLPersistence, layoutLocalService, layoutPersistence, layoutPrototypeLocalService, layoutPrototypePersistence, layoutPrototypeService, layoutRevisionLocalService, layoutRevisionPersistence, layoutRevisionService, layoutService, layoutSetBranchLocalService, layoutSetBranchPersistence, layoutSetBranchService, layoutSetLocalService, layoutSetPersistence, layoutSetPrototypeLocalService, layoutSetPrototypePersistence, layoutSetPrototypeService, layoutSetService, layoutTemplateLocalService, listTypePersistence, listTypeService, lockFinder, lockLocalService, lockPersistence, membershipRequestLocalService, membershipRequestPersistence, membershipRequestService, organizationFinder, organizationLocalService, organizationPersistence, organizationService, orgGroupRolePersistence, orgLaborLocalService, orgLaborPersistence, orgLaborService, passwordPolicyFinder, passwordPolicyLocalService, passwordPolicyPersistence, passwordPolicyRelLocalService, passwordPolicyRelPersistence, passwordPolicyService, passwordTrackerLocalService, passwordTrackerPersistence, permissionService, persistedModelLocalServiceRegistry, phoneLocalService, phonePersistence, phoneService, pluginSettingLocalService, pluginSettingPersistence, pluginSettingService, portalLocalService, portalPreferencesLocalService, portalPreferencesPersistence, portalService, portletItemLocalService, portletItemPersistence, portletLocalService, portletPersistence, portletPreferencesFinder, portletPreferencesLocalService, portletPreferencesPersistence, portletPreferencesService, portletService, quartzLocalService, regionPersistence, regionService, releaseLocalService, releasePersistence, repositoryEntryLocalService, repositoryEntryPersistence, repositoryLocalService, repositoryPersistence, repositoryService, resourceActionLocalService, resourceActionPersistence, resourceBlockFinder, resourceBlockLocalService, resourceBlockPermissionLocalService, resourceBlockPermissionPersistence, resourceBlockPersistence, resourceBlockService, resourceLocalService, resourcePermissionFinder, resourcePermissionLocalService, resourcePermissionPersistence, resourcePermissionService, resourceTypePermissionFinder, resourceTypePermissionLocalService, resourceTypePermissionPersistence, roleFinder, roleLocalService, rolePersistence, roleService, serviceComponentLocalService, serviceComponentPersistence, shardLocalService, shardPersistence, stagingLocalService, stagingService, subscriptionLocalService, subscriptionPersistence, systemEventLocalService, systemEventPersistence, teamFinder, teamLocalService, teamPersistence, teamService, themeLocalService, themeService, ticketLocalService, ticketPersistence, userFinder, userGroupFinder, userGroupGroupRoleLocalService, userGroupGroupRolePersistence, userGroupGroupRoleService, userGroupLocalService, userGroupPersistence, userGroupRoleFinder, userGroupRoleLocalService, userGroupRolePersistence, userGroupRoleService, userGroupService, userIdMapperLocalService, userIdMapperPersistence, userLocalService, userNotificationDeliveryLocalService, userNotificationDeliveryPersistence, userNotificationEventLocalService, userNotificationEventPersistence, userPersistence, userService, userTrackerLocalService, userTrackerPathLocalService, userTrackerPathPersistence, userTrackerPersistence, virtualHostLocalService, virtualHostPersistence, webDAVPropsLocalService, webDAVPropsPersistence, websiteLocalService, websitePersistence, websiteService, workflowDefinitionLinkLocalService, workflowDefinitionLinkPersistence, workflowInstanceLinkLocalService, workflowInstanceLinkPersistence
 
Constructor Summary
ResourcePermissionLocalServiceImpl()
           
 
Method Summary
 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 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)
           
protected  void doUpdateResourcePermission(long companyId, String name, int scope, String primKey, long ownerId, Map<Long,String[]> roleIdsToActionIds)
           
 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, long[] roleIds, Collection<String> actionIds)
           
 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.
 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<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<ResourcePermission> getResourceResourcePermissions(long companyId, long groupId, String name, String primKey)
          Returns the resource permissions that apply to the resource.
 List<ResourcePermission> getRoleResourcePermissions(long roleId)
          Returns all the resource permissions for the role.
 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.
 List<ResourcePermission> getScopeResourcePermissions(int[] scopes)
          Returns all the resource permissions where scope = any ?.
 boolean hasActionId(ResourcePermission resourcePermission, ResourceAction resourceAction)
          Returns true if the resource permission grants permission to perform the resource action.
 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.
 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)
           
 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.
 
Methods inherited from class com.liferay.portal.service.base.ResourcePermissionLocalServiceBaseImpl
addResourcePermission, afterPropertiesSet, createResourcePermission, deleteResourcePermission, deleteResourcePermission, destroy, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, dynamicQueryCount, fetchResourcePermission, getAccountLocalService, getAccountPersistence, getAccountService, getAddressLocalService, getAddressPersistence, getAddressService, getBackgroundTaskLocalService, getBackgroundTaskPersistence, getBackgroundTaskService, getBeanIdentifier, getBrowserTrackerLocalService, getBrowserTrackerPersistence, getClassNameLocalService, getClassNamePersistence, getClassNameService, getClusterGroupLocalService, getClusterGroupPersistence, getCMISRepositoryLocalService, getCompanyLocalService, getCompanyPersistence, getCompanyService, getContactLocalService, getContactPersistence, getContactService, getCounterLocalService, getCountryPersistence, getCountryService, getEmailAddressLocalService, getEmailAddressPersistence, getEmailAddressService, getGroupFinder, getGroupLocalService, getGroupPersistence, getGroupService, getImageLocalService, getImagePersistence, getImageService, getLayoutBranchLocalService, getLayoutBranchPersistence, getLayoutBranchService, getLayoutFinder, getLayoutFriendlyURLLocalService, getLayoutFriendlyURLPersistence, getLayoutLocalService, getLayoutPersistence, getLayoutPrototypeLocalService, getLayoutPrototypePersistence, getLayoutPrototypeService, getLayoutRevisionLocalService, getLayoutRevisionPersistence, getLayoutRevisionService, getLayoutService, getLayoutSetBranchLocalService, getLayoutSetBranchPersistence, getLayoutSetBranchService, getLayoutSetLocalService, getLayoutSetPersistence, getLayoutSetPrototypeLocalService, getLayoutSetPrototypePersistence, getLayoutSetPrototypeService, getLayoutSetService, getLayoutTemplateLocalService, getListTypePersistence, getListTypeService, getLockFinder, getLockLocalService, getLockPersistence, getMembershipRequestLocalService, getMembershipRequestPersistence, getMembershipRequestService, getModelClass, getModelClassName, getOrganizationFinder, getOrganizationLocalService, getOrganizationPersistence, getOrganizationService, getOrgGroupRolePersistence, getOrgLaborLocalService, getOrgLaborPersistence, getOrgLaborService, getPasswordPolicyFinder, getPasswordPolicyLocalService, getPasswordPolicyPersistence, getPasswordPolicyRelLocalService, getPasswordPolicyRelPersistence, getPasswordPolicyService, getPasswordTrackerLocalService, getPasswordTrackerPersistence, getPermissionService, getPersistedModel, getPhoneLocalService, getPhonePersistence, getPhoneService, getPluginSettingLocalService, getPluginSettingPersistence, getPluginSettingService, getPortalLocalService, getPortalPreferencesLocalService, getPortalPreferencesPersistence, getPortalService, getPortletItemLocalService, getPortletItemPersistence, getPortletLocalService, getPortletPersistence, getPortletPreferencesFinder, getPortletPreferencesLocalService, getPortletPreferencesPersistence, getPortletPreferencesService, getPortletService, getQuartzLocalService, getRegionPersistence, getRegionService, getReleaseLocalService, getReleasePersistence, getRepositoryEntryLocalService, getRepositoryEntryPersistence, getRepositoryLocalService, getRepositoryPersistence, getRepositoryService, getResourceActionLocalService, getResourceActionPersistence, getResourceBlockFinder, getResourceBlockLocalService, getResourceBlockPermissionLocalService, getResourceBlockPermissionPersistence, getResourceBlockPersistence, getResourceBlockService, getResourceLocalService, getResourcePermission, getResourcePermissionFinder, getResourcePermissionLocalService, getResourcePermissionPersistence, getResourcePermissions, getResourcePermissionsCount, getResourcePermissionService, getResourceTypePermissionFinder, getResourceTypePermissionLocalService, getResourceTypePermissionPersistence, getRoleFinder, getRoleLocalService, getRolePersistence, getRoleService, getServiceComponentLocalService, getServiceComponentPersistence, getShardLocalService, getShardPersistence, getStagingLocalService, getStagingService, getSubscriptionLocalService, getSubscriptionPersistence, getSystemEventLocalService, getSystemEventPersistence, getTeamFinder, getTeamLocalService, getTeamPersistence, getTeamService, getThemeLocalService, getThemeService, getTicketLocalService, getTicketPersistence, getUserFinder, getUserGroupFinder, getUserGroupGroupRoleLocalService, getUserGroupGroupRolePersistence, getUserGroupGroupRoleService, getUserGroupLocalService, getUserGroupPersistence, getUserGroupRoleFinder, getUserGroupRoleLocalService, getUserGroupRolePersistence, getUserGroupRoleService, getUserGroupService, getUserIdMapperLocalService, getUserIdMapperPersistence, getUserLocalService, getUserNotificationDeliveryLocalService, getUserNotificationDeliveryPersistence, getUserNotificationEventLocalService, getUserNotificationEventPersistence, getUserPersistence, getUserService, getUserTrackerLocalService, getUserTrackerPathLocalService, getUserTrackerPathPersistence, getUserTrackerPersistence, getVirtualHostLocalService, getVirtualHostPersistence, getWebDAVPropsLocalService, getWebDAVPropsPersistence, getWebsiteLocalService, getWebsitePersistence, getWebsiteService, getWorkflowDefinitionLinkLocalService, getWorkflowDefinitionLinkPersistence, getWorkflowInstanceLinkLocalService, getWorkflowInstanceLinkPersistence, runSQL, setAccountLocalService, setAccountPersistence, setAccountService, setAddressLocalService, setAddressPersistence, setAddressService, setBackgroundTaskLocalService, setBackgroundTaskPersistence, setBackgroundTaskService, setBeanIdentifier, setBrowserTrackerLocalService, setBrowserTrackerPersistence, setClassNameLocalService, setClassNamePersistence, setClassNameService, setClusterGroupLocalService, setClusterGroupPersistence, setCMISRepositoryLocalService, setCompanyLocalService, setCompanyPersistence, setCompanyService, setContactLocalService, setContactPersistence, setContactService, setCounterLocalService, setCountryPersistence, setCountryService, setEmailAddressLocalService, setEmailAddressPersistence, setEmailAddressService, setGroupFinder, setGroupLocalService, setGroupPersistence, setGroupService, setImageLocalService, setImagePersistence, setImageService, setLayoutBranchLocalService, setLayoutBranchPersistence, setLayoutBranchService, setLayoutFinder, setLayoutFriendlyURLLocalService, setLayoutFriendlyURLPersistence, setLayoutLocalService, setLayoutPersistence, setLayoutPrototypeLocalService, setLayoutPrototypePersistence, setLayoutPrototypeService, setLayoutRevisionLocalService, setLayoutRevisionPersistence, setLayoutRevisionService, setLayoutService, setLayoutSetBranchLocalService, setLayoutSetBranchPersistence, setLayoutSetBranchService, setLayoutSetLocalService, setLayoutSetPersistence, setLayoutSetPrototypeLocalService, setLayoutSetPrototypePersistence, setLayoutSetPrototypeService, setLayoutSetService, setLayoutTemplateLocalService, setListTypePersistence, setListTypeService, setLockFinder, setLockLocalService, setLockPersistence, setMembershipRequestLocalService, setMembershipRequestPersistence, setMembershipRequestService, setOrganizationFinder, setOrganizationLocalService, setOrganizationPersistence, setOrganizationService, setOrgGroupRolePersistence, setOrgLaborLocalService, setOrgLaborPersistence, setOrgLaborService, setPasswordPolicyFinder, setPasswordPolicyLocalService, setPasswordPolicyPersistence, setPasswordPolicyRelLocalService, setPasswordPolicyRelPersistence, setPasswordPolicyService, setPasswordTrackerLocalService, setPasswordTrackerPersistence, setPermissionService, setPhoneLocalService, setPhonePersistence, setPhoneService, setPluginSettingLocalService, setPluginSettingPersistence, setPluginSettingService, setPortalLocalService, setPortalPreferencesLocalService, setPortalPreferencesPersistence, setPortalService, setPortletItemLocalService, setPortletItemPersistence, setPortletLocalService, setPortletPersistence, setPortletPreferencesFinder, setPortletPreferencesLocalService, setPortletPreferencesPersistence, setPortletPreferencesService, setPortletService, setQuartzLocalService, setRegionPersistence, setRegionService, setReleaseLocalService, setReleasePersistence, setRepositoryEntryLocalService, setRepositoryEntryPersistence, setRepositoryLocalService, setRepositoryPersistence, setRepositoryService, setResourceActionLocalService, setResourceActionPersistence, setResourceBlockFinder, setResourceBlockLocalService, setResourceBlockPermissionLocalService, setResourceBlockPermissionPersistence, setResourceBlockPersistence, setResourceBlockService, setResourceLocalService, setResourcePermissionFinder, setResourcePermissionLocalService, setResourcePermissionPersistence, setResourcePermissionService, setResourceTypePermissionFinder, setResourceTypePermissionLocalService, setResourceTypePermissionPersistence, setRoleFinder, setRoleLocalService, setRolePersistence, setRoleService, setServiceComponentLocalService, setServiceComponentPersistence, setShardLocalService, setShardPersistence, setStagingLocalService, setStagingService, setSubscriptionLocalService, setSubscriptionPersistence, setSystemEventLocalService, setSystemEventPersistence, setTeamFinder, setTeamLocalService, setTeamPersistence, setTeamService, setThemeLocalService, setThemeService, setTicketLocalService, setTicketPersistence, setUserFinder, setUserGroupFinder, setUserGroupGroupRoleLocalService, setUserGroupGroupRolePersistence, setUserGroupGroupRoleService, setUserGroupLocalService, setUserGroupPersistence, setUserGroupRoleFinder, setUserGroupRoleLocalService, setUserGroupRolePersistence, setUserGroupRoleService, setUserGroupService, setUserIdMapperLocalService, setUserIdMapperPersistence, setUserLocalService, setUserNotificationDeliveryLocalService, setUserNotificationDeliveryPersistence, setUserNotificationEventLocalService, setUserNotificationEventPersistence, setUserPersistence, setUserService, setUserTrackerLocalService, setUserTrackerPathLocalService, setUserTrackerPathPersistence, setUserTrackerPersistence, setVirtualHostLocalService, setVirtualHostPersistence, setWebDAVPropsLocalService, setWebDAVPropsPersistence, setWebsiteLocalService, setWebsitePersistence, setWebsiteService, setWorkflowDefinitionLinkLocalService, setWorkflowDefinitionLinkPersistence, setWorkflowInstanceLinkLocalService, setWorkflowInstanceLinkPersistence, updateResourcePermission
 
Methods inherited from class com.liferay.portal.service.BaseLocalServiceImpl
getClassLoader, getLayoutURL, getLayoutURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ACTION_IDS

public static final String[] EMPTY_ACTION_IDS
See Also:
VerifyPermission.fixOrganizationRolePermissions()
Constructor Detail

ResourcePermissionLocalServiceImpl

public ResourcePermissionLocalServiceImpl()
Method Detail

addResourcePermission

public 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 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 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 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

fetchResourcePermission

public ResourcePermission fetchResourcePermission(long companyId,
                                                  String name,
                                                  int scope,
                                                  String primKey,
                                                  long roleId)
                                           throws SystemException
Throws:
SystemException

getAvailableResourcePermissionActionIds

public 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 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 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 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 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 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 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 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 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 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 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 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 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 boolean[] hasResourcePermissions(long companyId,
                                        String name,
                                        int scope,
                                        String primKey,
                                        long[] roleIds,
                                        String actionId)
                                 throws PortalException,
                                        SystemException
Throws:
PortalException
SystemException

hasScopeResourcePermission

public 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 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 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 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 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 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 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 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

doUpdateResourcePermission

protected void doUpdateResourcePermission(long companyId,
                                          String name,
                                          int scope,
                                          String primKey,
                                          long ownerId,
                                          long roleId,
                                          String[] actionIds,
                                          int operator,
                                          boolean fetch)
                                   throws PortalException,
                                          SystemException
Throws:
PortalException
SystemException

doUpdateResourcePermission

protected void doUpdateResourcePermission(long companyId,
                                          String name,
                                          int scope,
                                          String primKey,
                                          long ownerId,
                                          Map<Long,String[]> roleIdsToActionIds)
                                   throws PortalException,
                                          SystemException
Throws:
PortalException
SystemException

isGuestRoleId

protected boolean isGuestRoleId(long companyId,
                                long roleId)
                         throws PortalException,
                                SystemException
Throws:
PortalException
SystemException

updateResourcePermission

protected void updateResourcePermission(long companyId,
                                        String name,
                                        int scope,
                                        String primKey,
                                        long roleId,
                                        long ownerId,
                                        String[] actionIds,
                                        int operator)
                                 throws PortalException,
                                        SystemException
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, 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
actionIds - the action IDs of the actions
operator - whether to add to, remove from, or set/replace the existing actions. Possible values can be found in ResourcePermissionConstants.
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

updateResourcePermission

protected void updateResourcePermission(long companyId,
                                        String name,
                                        int scope,
                                        String primKey,
                                        long ownerId,
                                        Map<Long,String[]> roleIdsToActionIds)
                                 throws PortalException,
                                        SystemException
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, 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
ownerId - the primary key of the owner
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

Liferay 6.2-ce-ga5