Class RoleLocalServiceImpl

Object
com.liferay.portal.kernel.service.BaseLocalServiceImpl
com.liferay.portal.service.base.RoleLocalServiceBaseImpl
com.liferay.portal.service.impl.RoleLocalServiceImpl
All Implemented Interfaces:
com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService, com.liferay.portal.kernel.service.BaseLocalService, com.liferay.portal.kernel.service.change.tracking.CTService<com.liferay.portal.kernel.model.Role>, com.liferay.portal.kernel.service.PersistedModelLocalService, com.liferay.portal.kernel.service.RoleLocalService

public class RoleLocalServiceImpl extends RoleLocalServiceBaseImpl
Provides the local service for accessing, adding, checking, deleting, and updating roles.
Author:
Brian Wing Shun Chan, Marcellus Tavares
  • Constructor Details

    • RoleLocalServiceImpl

      public RoleLocalServiceImpl()
  • Method Details

    • addRole

      public com.liferay.portal.kernel.model.Role addRole(String externalReferenceCode, long userId, String className, long classPK, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, int type, String subtype, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • addUserRole

      public boolean addUserRole(long userId, long roleId) throws com.liferay.portal.kernel.exception.PortalException
      Adds the role to the user. The user is reindexed after the role is added.
      Specified by:
      addUserRole in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      addUserRole in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      roleId - the primary key of the role
      Returns:
      true if the association between the ${userId} and ${roleId} is added; false if it was already added
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.addRole(long, long)
    • addUserRole

      public boolean addUserRole(long userId, com.liferay.portal.kernel.model.Role role) throws com.liferay.portal.kernel.exception.PortalException
      Adds the role to the user. The user is reindexed after the role is added.
      Specified by:
      addUserRole in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      addUserRole in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      role - the role
      Returns:
      true if the association between the ${userId} and ${role} is added; false if it was already added
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.addRole(long, Role)
    • addUserRoles

      public boolean addUserRoles(long userId, List<com.liferay.portal.kernel.model.Role> roles) throws com.liferay.portal.kernel.exception.PortalException
      Adds the roles to the user. The user is reindexed after the roles are added.
      Specified by:
      addUserRoles in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      addUserRoles in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      roles - the roles
      Returns:
      true if at least an association between the ${userId} and the ${roles} is added; false if all were already added
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.addRoles(long, List)
    • addUserRoles

      public boolean addUserRoles(long userId, long[] roleIds) throws com.liferay.portal.kernel.exception.PortalException
      Adds the roles to the user. The user is reindexed after the roles are added.
      Specified by:
      addUserRoles in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      addUserRoles in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      roleIds - the primary keys of the roles
      Returns:
      true if at least an association between the ${userId} and the ${roleIds} is added; false if all were already added
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.addRoles(long, long[])
    • checkSystemRoles

      public void checkSystemRoles() throws com.liferay.portal.kernel.exception.PortalException
      Checks to ensure that the system roles map has appropriate default roles in each company.
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • checkSystemRoles

      @Transactional(propagation=SUPPORTS, readOnly=true) public void checkSystemRoles(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Checks to ensure that the system roles map has appropriate default roles in the company.
      Parameters:
      companyId - the primary key of the company
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • clearUserRoles

      public void clearUserRoles(long userId) throws com.liferay.portal.kernel.exception.PortalException
      Removes every role from the user. The user is reindexed after the roles are removed.
      Specified by:
      clearUserRoles in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      clearUserRoles in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.clearRoles(long)
    • deleteRole

      public com.liferay.portal.kernel.model.Role deleteRole(long roleId) throws com.liferay.portal.kernel.exception.PortalException
      Deletes the role with the primary key and its associated permissions.
      Specified by:
      deleteRole in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      deleteRole in class RoleLocalServiceBaseImpl
      Parameters:
      roleId - the primary key of the role
      Returns:
      the deleted role
      Throws:
      com.liferay.portal.kernel.exception.PortalException - if a role with the primary key could not be found
    • deleteRole

      @SystemEvent(action=1, type=1) public com.liferay.portal.kernel.model.Role deleteRole(com.liferay.portal.kernel.model.Role role) throws com.liferay.portal.kernel.exception.PortalException
      Deletes the role and its associated permissions.
      Specified by:
      deleteRole in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      deleteRole in class RoleLocalServiceBaseImpl
      Parameters:
      role - the role
      Returns:
      the deleted role
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteUserRole

      public void deleteUserRole(long userId, long roleId) throws com.liferay.portal.kernel.exception.PortalException
      Removes the role from the user. The user is reindexed after the role is removed.
      Specified by:
      deleteUserRole in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      deleteUserRole in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      roleId - the primary key of the role
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.removeRole(long, long)
    • deleteUserRole

      public void deleteUserRole(long userId, com.liferay.portal.kernel.model.Role role) throws com.liferay.portal.kernel.exception.PortalException
      Removes the role from the user. The user is reindexed after the role is removed.
      Specified by:
      deleteUserRole in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      deleteUserRole in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      role - the role
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.removeRole(long, Role)
    • deleteUserRoles

      public void deleteUserRoles(long userId, List<com.liferay.portal.kernel.model.Role> roles) throws com.liferay.portal.kernel.exception.PortalException
      Removes the roles from the user. The user is reindexed after the roles are removed.
      Specified by:
      deleteUserRoles in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      deleteUserRoles in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      roles - the roles
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.removeRoles(long, List)
    • deleteUserRoles

      public void deleteUserRoles(long userId, long[] roleIds) throws com.liferay.portal.kernel.exception.PortalException
      Removes the roles from the user. The user is reindexed after the roles are removed.
      Specified by:
      deleteUserRoles in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      deleteUserRoles in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      roleIds - the primary keys of the roles
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • UserPersistence.removeRoles(long, long[])
    • fetchRole

      public com.liferay.portal.kernel.model.Role fetchRole(long companyId, String name)
      Returns the role with the name in the company.

      The method searches the system roles map first for default roles. If a role with the name is not found, then the method will query the database.

      Parameters:
      companyId - the primary key of the company
      name - the role's name
      Returns:
      Returns the role with the name or null if a role with the name could not be found in the company
    • getAssigneesTotal

      public int getAssigneesTotal(long roleId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getDefaultGroupRole

      public com.liferay.portal.kernel.model.Role getDefaultGroupRole(long groupId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the default role for the group with the primary key.

      If the group is a site, then the default role is RoleConstants.SITE_MEMBER. If the group is an organization, then the default role is RoleConstants.ORGANIZATION_USER. If the group is a user or user group, then the default role is RoleConstants.POWER_USER. For all other group types, the default role is RoleConstants.USER.

      Parameters:
      groupId - the primary key of the group
      Returns:
      the default role for the group with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getGroupRelatedRoles

      public List<com.liferay.portal.kernel.model.Role> getGroupRelatedRoles(long groupId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getGroupRolesAndTeamRoles

      public List<com.liferay.portal.kernel.model.Role> getGroupRolesAndTeamRoles(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId, int start, int end)
    • getGroupRolesAndTeamRolesCount

      public int getGroupRolesAndTeamRolesCount(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId)
    • getResourceRoles

      public Map<String,List<String>> getResourceRoles(long companyId, String name, int scope, String primKey)
      Returns a map of role names to associated action IDs for the named resource in the company within the permission scope.
      Parameters:
      companyId - the primary key of the company
      name - the resource name
      scope - the permission scope
      primKey - the primary key of the resource's class
      Returns:
      the role names and action IDs
    • getResourceRoles

      public List<com.liferay.portal.kernel.model.Role> getResourceRoles(long companyId, String name, int scope, String primKey, String actionId)
      Returns all the roles associated with the action ID in the company within the permission scope.
      Parameters:
      companyId - the primary key of the company
      name - the resource name
      scope - the permission scope
      primKey - the primary key of the resource's class
      actionId - the name of the resource action
      Returns:
      the roles
    • getRole

      public com.liferay.portal.kernel.model.Role getRole(long companyId, String name) throws com.liferay.portal.kernel.exception.PortalException
      Returns the role with the name in the company.

      The method searches the system roles map first for default roles. If a role with the name is not found, then the method will query the database.

      Parameters:
      companyId - the primary key of the company
      name - the role's name
      Returns:
      the role with the name
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getRoles

      public List<com.liferay.portal.kernel.model.Role> getRoles(int type, String subtype)
      Returns all the roles of the type and subtype.
      Parameters:
      type - the role's type (optionally 0)
      subtype - the role's subtype (optionally null)
      Returns:
      the roles of the type and subtype
    • getRoles

      public List<com.liferay.portal.kernel.model.Role> getRoles(long companyId)
      Returns all the roles in the company.
      Parameters:
      companyId - the primary key of the company
      Returns:
      the roles in the company
    • getRoles

      public List<com.liferay.portal.kernel.model.Role> getRoles(long companyId, int[] types)
      Returns all the roles with the types.
      Parameters:
      companyId - the primary key of the company
      types - the role types (optionally null)
      Returns:
      the roles with the types
    • getRoles

      public List<com.liferay.portal.kernel.model.Role> getRoles(long companyId, long classNameId, long[] classPKs, int type)
    • getRoles

      public List<com.liferay.portal.kernel.model.Role> getRoles(long[] roleIds) throws com.liferay.portal.kernel.exception.PortalException
      Returns all the roles with the primary keys.
      Parameters:
      roleIds - the primary keys of the roles
      Returns:
      the roles with the primary keys
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getSubtypeRoles

      public List<com.liferay.portal.kernel.model.Role> getSubtypeRoles(String subtype)
      Returns all the roles of the subtype.
      Parameters:
      subtype - the role's subtype (optionally null)
      Returns:
      the roles of the subtype
    • getSubtypeRolesCount

      public int getSubtypeRolesCount(String subtype)
      Returns the number of roles of the subtype.
      Parameters:
      subtype - the role's subtype (optionally null)
      Returns:
      the number of roles of the subtype
    • getTeamRole

      public com.liferay.portal.kernel.model.Role getTeamRole(long companyId, long teamId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the team role in the company.
      Parameters:
      companyId - the primary key of the company
      teamId - the primary key of the team
      Returns:
      the team role in the company
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getTeamRoleMap

      public Map<com.liferay.portal.kernel.model.Team,com.liferay.portal.kernel.model.Role> getTeamRoleMap(long groupId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the team role map for the group.
      Parameters:
      groupId - the primary key of the group
      Returns:
      the team role map for the group
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getTeamRoles

      public List<com.liferay.portal.kernel.model.Role> getTeamRoles(long groupId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the team roles in the group.
      Parameters:
      groupId - the primary key of the group
      Returns:
      the team roles in the group
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getTeamRoles

      public List<com.liferay.portal.kernel.model.Role> getTeamRoles(long groupId, long[] excludedRoleIds) throws com.liferay.portal.kernel.exception.PortalException
      Returns the team roles in the group, excluding the specified role IDs.
      Parameters:
      groupId - the primary key of the group
      excludedRoleIds - the primary keys of the roles to exclude (optionally null)
      Returns:
      the team roles in the group, excluding the specified role IDs
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getTeamsRoles

      public List<com.liferay.portal.kernel.model.Role> getTeamsRoles(long companyId, long[] teamIds) throws com.liferay.portal.kernel.exception.PortalException
      Returns the team roles in the company.
      Parameters:
      companyId - the primary key of the company
      teamIds - the primary keys of the teams
      Returns:
      the team roles in the company
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getTypeRoles

      public List<com.liferay.portal.kernel.model.Role> getTypeRoles(int type)
      Returns all the roles of the type.
      Parameters:
      type - the role's type (optionally 0)
      Returns:
      the range of the roles of the type
    • getTypeRoles

      public List<com.liferay.portal.kernel.model.Role> getTypeRoles(int type, int start, int end)
      Returns a range of all the roles of the type.
      Parameters:
      type - the role's type (optionally 0)
      start - the lower bound of the range of roles to return
      end - the upper bound of the range of roles to return (not inclusive)
      Returns:
      the range of the roles of the type
    • getTypeRolesCount

      public int getTypeRolesCount(int type)
      Returns the number of roles of the type.
      Parameters:
      type - the role's type (optionally 0)
      Returns:
      the number of roles of the type
    • getUserGroupGroupRoles

      public List<com.liferay.portal.kernel.model.Role> getUserGroupGroupRoles(long userId, long groupId)
      Returns all the user's roles within the user group.
      Parameters:
      userId - the primary key of the user
      groupId - the primary key of the group
      Returns:
      the user's roles within the user group
    • getUserGroupGroupRoles

      public List<com.liferay.portal.kernel.model.Role> getUserGroupGroupRoles(long userId, long groupId, int start, int end)
    • getUserGroupGroupRolesCount

      public int getUserGroupGroupRolesCount(long userId, long groupId)
    • getUserGroupRoles

      public List<com.liferay.portal.kernel.model.Role> getUserGroupRoles(long userId, long groupId)
      Returns all the user's roles within the user group.
      Parameters:
      userId - the primary key of the user
      groupId - the primary key of the group
      Returns:
      the user's roles within the user group
    • getUserRelatedRoles

      public List<com.liferay.portal.kernel.model.Role> getUserRelatedRoles(long userId, List<com.liferay.portal.kernel.model.Group> groups)
      Returns the union of all the user's roles within the groups. If no groups are provided, only the user's directly assigned roles are returned.
      Parameters:
      userId - the primary key of the user
      groups - the groups (optionally null)
      Returns:
      the union of all the user's roles within the groups
    • getUserRelatedRoles

      public List<com.liferay.portal.kernel.model.Role> getUserRelatedRoles(long userId, long groupId)
      Returns all the user's roles within the group.
      Parameters:
      userId - the primary key of the user
      groupId - the primary key of the group
      Returns:
      the user's roles within the group
    • getUserRelatedRoles

      public List<com.liferay.portal.kernel.model.Role> getUserRelatedRoles(long userId, long[] groupIds)
      Returns the union of all the user's roles within the groups. If no groupIds are provided, only the user's directly assigned roles are returned.
      Parameters:
      userId - the primary key of the user
      groupIds - the primary keys of the groups
      Returns:
      the union of all the user's roles within the groups
    • getUserTeamRoles

      public List<com.liferay.portal.kernel.model.Role> getUserTeamRoles(long userId, long groupId)
    • hasUserRole

      @ThreadLocalCachable public boolean hasUserRole(long userId, long companyId, String name, boolean inherited) throws com.liferay.portal.kernel.exception.PortalException
      Returns true if the user is associated with the named regular role.
      Parameters:
      userId - the primary key of the user
      companyId - the primary key of the company
      name - the name of the role
      inherited - whether to include the user's inherited roles in the search
      Returns:
      true if the user is associated with the regular role; false otherwise
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • hasUserRoles

      public boolean hasUserRoles(long userId, long companyId, String[] names, boolean inherited) throws com.liferay.portal.kernel.exception.PortalException
      Returns true if the user has any one of the named regular roles.
      Parameters:
      userId - the primary key of the user
      companyId - the primary key of the company
      names - the names of the roles
      inherited - whether to include the user's inherited roles in the search
      Returns:
      true if the user has any one of the regular roles; false otherwise
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • search

      public List<com.liferay.portal.kernel.model.Role> search(long companyId, String keywords, Integer[] types, int start, int end, com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.kernel.model.Role> orderByComparator)
      Returns an ordered range of all the roles that match the keywords and types.

      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:
      companyId - the primary key of the company
      keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
      types - the role types (optionally null)
      start - the lower bound of the range of roles to return
      end - the upper bound of the range of roles to return (not inclusive)
      orderByComparator - the comparator to order the roles (optionally null)
      Returns:
      the ordered range of the matching roles, ordered by orderByComparator
      See Also:
      • RoleFinder
    • search

      public List<com.liferay.portal.kernel.model.Role> search(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.kernel.model.Role> orderByComparator)
      Returns an ordered range of all the roles that match the keywords, types, and params.

      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:
      companyId - the primary key of the company
      keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
      types - the role types (optionally null)
      params - the finder parameters. Can specify values for the "usersRoles" key. For more information, see RoleFinder
      start - the lower bound of the range of roles to return
      end - the upper bound of the range of roles to return (not inclusive)
      orderByComparator - the comparator to order the roles (optionally null)
      Returns:
      the ordered range of the matching roles, ordered by orderByComparator
      See Also:
      • RoleFinder
    • search

      public List<com.liferay.portal.kernel.model.Role> search(long companyId, String name, String description, Integer[] types, int start, int end, com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.kernel.model.Role> orderByComparator)
      Returns an ordered range of all the roles that match the name, description, and types.

      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:
      companyId - the primary key of the company
      name - the role's name (optionally null)
      description - the role's description (optionally null)
      types - the role types (optionally null)
      start - the lower bound of the range of the roles to return
      end - the upper bound of the range of the roles to return (not inclusive)
      orderByComparator - the comparator to order the roles (optionally null)
      Returns:
      the ordered range of the matching roles, ordered by orderByComparator
      See Also:
      • RoleFinder
    • search

      public List<com.liferay.portal.kernel.model.Role> search(long companyId, String name, String description, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.kernel.model.Role> orderByComparator)
      Returns an ordered range of all the roles that match the name, description, types, and params.

      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:
      companyId - the primary key of the company
      name - the role's name (optionally null)
      description - the role's description (optionally null)
      types - the role types (optionally null)
      params - the finder's parameters. Can specify values for the "usersRoles" key. For more information, see RoleFinder
      start - the lower bound of the range of the roles to return
      end - the upper bound of the range of the roles to return (not inclusive)
      orderByComparator - the comparator to order the roles (optionally null)
      Returns:
      the ordered range of the matching roles, ordered by orderByComparator
      See Also:
      • RoleFinder
    • searchCount

      public int searchCount(long companyId, String keywords, Integer[] types)
      Returns the number of roles that match the keywords and types.
      Parameters:
      companyId - the primary key of the company
      keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
      types - the role types (optionally null)
      Returns:
      the number of matching roles
    • searchCount

      public int searchCount(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params)
      Returns the number of roles that match the keywords, types and params.
      Parameters:
      companyId - the primary key of the company
      keywords - the keywords (space separated), which may occur in the role's name or description (optionally null)
      types - the role types (optionally null)
      params - the finder parameters. For more information, see RoleFinder
      Returns:
      the number of matching roles
    • searchCount

      public int searchCount(long companyId, String name, String description, Integer[] types)
      Returns the number of roles that match the name, description, and types.
      Parameters:
      companyId - the primary key of the company
      name - the role's name (optionally null)
      description - the role's description (optionally null)
      types - the role types (optionally null)
      Returns:
      the number of matching roles
    • searchCount

      public int searchCount(long companyId, String name, String description, Integer[] types, LinkedHashMap<String,Object> params)
      Returns the number of roles that match the name, description, types, and params.
      Parameters:
      companyId - the primary key of the company
      name - the role's name (optionally null)
      description - the role's description (optionally null)
      types - the role types (optionally null)
      params - the finder parameters. Can specify values for the "usersRoles" key. For more information, see RoleFinder
      Returns:
      the number of matching roles
    • setUserRoles

      public void setUserRoles(long userId, long[] roleIds) throws com.liferay.portal.kernel.exception.PortalException
      Sets the roles associated with the user, replacing the user's existing roles. The user is reindexed after the roles are set.
      Specified by:
      setUserRoles in interface com.liferay.portal.kernel.service.RoleLocalService
      Overrides:
      setUserRoles in class RoleLocalServiceBaseImpl
      Parameters:
      userId - the primary key of the user
      roleIds - the primary keys of the roles
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • unsetUserRoles

      public void unsetUserRoles(long userId, long[] roleIds) throws com.liferay.portal.kernel.exception.PortalException
      Removes the matching roles associated with the user. The user is reindexed after the roles are removed.
      Parameters:
      userId - the primary key of the user
      roleIds - the primary keys of the roles
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateExternalReferenceCode

      public com.liferay.portal.kernel.model.Role updateExternalReferenceCode(long roleId, String externalReferenceCode) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateExternalReferenceCode

      public com.liferay.portal.kernel.model.Role updateExternalReferenceCode(com.liferay.portal.kernel.model.Role role, String externalReferenceCode) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateRole

      public com.liferay.portal.kernel.model.Role updateRole(long roleId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, String subtype, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException
      Updates the role with the primary key.
      Parameters:
      roleId - the primary key of the role
      name - the role's new name
      titleMap - the new localized titles (optionally null) to replace those existing for the role
      descriptionMap - the new localized descriptions (optionally null) to replace those existing for the role
      subtype - the role's new subtype (optionally null)
      serviceContext - the service context to be applied (optionally null). Can set expando bridge attributes for the role.
      Returns:
      the role with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • validateName

      public void validateName(String name) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • checkSystemRole

      protected void checkSystemRole(Map<String,com.liferay.portal.kernel.model.Role> companyRolesMap, long companyId, String name, String description, int type) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getDefaultControlPanelPortlets

      protected String[] getDefaultControlPanelPortlets()
    • getTeamRoleMap

      protected Map<com.liferay.portal.kernel.model.Team,com.liferay.portal.kernel.model.Role> getTeamRoleMap(long groupId, long[] excludedRoleIds) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • initAnalyticsAdministratorViewPermissions

      protected void initAnalyticsAdministratorViewPermissions(com.liferay.portal.kernel.model.Role role) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • initPersonalControlPanelPortletsPermissions

      protected void initPersonalControlPanelPortletsPermissions(com.liferay.portal.kernel.model.Role role) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • initPublicationsUserViewPermissions

      protected void initPublicationsUserViewPermissions(com.liferay.portal.kernel.model.Role role) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • reindex

      protected void reindex(long userId) throws com.liferay.portal.kernel.search.SearchException
      Throws:
      com.liferay.portal.kernel.search.SearchException
    • setRolePermissions

      protected void setRolePermissions(com.liferay.portal.kernel.model.Role role, String name, String[] actionIds) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • validate

      protected void validate(long roleId, long companyId, long classNameId, String name) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException