Class 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
- Author:
- Brian Wing Shun Chan, Marcellus Tavares
-
Field Summary
Fields inherited from class com.liferay.portal.service.base.RoleLocalServiceBaseImpl
counterLocalService, groupPersistence, roleFinder, roleLocalService, rolePersistence, userPersistence
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.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) boolean
addUserRole
(long userId, long roleId) Adds the role to the user.boolean
addUserRole
(long userId, com.liferay.portal.kernel.model.Role role) Adds the role to the user.boolean
addUserRoles
(long userId, long[] roleIds) Adds the roles to the user.boolean
addUserRoles
(long userId, List<com.liferay.portal.kernel.model.Role> roles) Adds the roles to the user.protected void
checkSystemRole
(Map<String, com.liferay.portal.kernel.model.Role> companyRolesMap, long companyId, String name, String description, int type) void
Checks to ensure that the system roles map has appropriate default roles in each company.void
checkSystemRoles
(long companyId) Checks to ensure that the system roles map has appropriate default roles in the company.void
clearUserRoles
(long userId) Removes every role from the user.com.liferay.portal.kernel.model.Role
deleteRole
(long roleId) Deletes the role with the primary key and its associated permissions.com.liferay.portal.kernel.model.Role
deleteRole
(com.liferay.portal.kernel.model.Role role) Deletes the role and its associated permissions.void
deleteUserRole
(long userId, long roleId) Removes the role from the user.void
deleteUserRole
(long userId, com.liferay.portal.kernel.model.Role role) Removes the role from the user.void
deleteUserRoles
(long userId, long[] roleIds) Removes the roles from the user.void
deleteUserRoles
(long userId, List<com.liferay.portal.kernel.model.Role> roles) Removes the roles from the user.com.liferay.portal.kernel.model.Role
Returns the role with the name in the company.int
getAssigneesTotal
(long roleId) protected String[]
com.liferay.portal.kernel.model.Role
getDefaultGroupRole
(long groupId) Returns the default role for the group with the primary key.List<com.liferay.portal.kernel.model.Role>
getGroupRelatedRoles
(long groupId) 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) int
getGroupRolesAndTeamRolesCount
(long companyId, String name, List<String> excludedNames, String title, String description, int[] types, long excludedTeamRoleId, long teamGroupId) 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.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.com.liferay.portal.kernel.model.Role
Returns the role with the name in the company.List<com.liferay.portal.kernel.model.Role>
Returns all the roles of the type and subtype.List<com.liferay.portal.kernel.model.Role>
getRoles
(long companyId) Returns all the roles in the company.List<com.liferay.portal.kernel.model.Role>
getRoles
(long[] roleIds) Returns all the roles with the primary keys.List<com.liferay.portal.kernel.model.Role>
getRoles
(long companyId, int[] types) Returns all the roles with the types.List<com.liferay.portal.kernel.model.Role>
getRoles
(long companyId, long classNameId, long[] classPKs, int type) List<com.liferay.portal.kernel.model.Role>
getSubtypeRoles
(String subtype) Returns all the roles of the subtype.int
getSubtypeRolesCount
(String subtype) Returns the number of roles of the subtype.com.liferay.portal.kernel.model.Role
getTeamRole
(long companyId, long teamId) Returns the team role in the company.Map<com.liferay.portal.kernel.model.Team,
com.liferay.portal.kernel.model.Role> getTeamRoleMap
(long groupId) Returns the team role map for the group.protected Map<com.liferay.portal.kernel.model.Team,
com.liferay.portal.kernel.model.Role> getTeamRoleMap
(long groupId, long[] excludedRoleIds) List<com.liferay.portal.kernel.model.Role>
getTeamRoles
(long groupId) Returns the team roles in the group.List<com.liferay.portal.kernel.model.Role>
getTeamRoles
(long groupId, long[] excludedRoleIds) Returns the team roles in the group, excluding the specified role IDs.List<com.liferay.portal.kernel.model.Role>
getTeamsRoles
(long companyId, long[] teamIds) Returns the team roles in the company.List<com.liferay.portal.kernel.model.Role>
getTypeRoles
(int type) Returns all the roles of the type.List<com.liferay.portal.kernel.model.Role>
getTypeRoles
(int type, int start, int end) Returns a range of all the roles of the type.int
getTypeRolesCount
(int type) Returns the number of roles of the type.List<com.liferay.portal.kernel.model.Role>
getUserGroupGroupRoles
(long userId, long groupId) Returns all the user's roles within the user group.List<com.liferay.portal.kernel.model.Role>
getUserGroupGroupRoles
(long userId, long groupId, int start, int end) int
getUserGroupGroupRolesCount
(long userId, long groupId) List<com.liferay.portal.kernel.model.Role>
getUserGroupRoles
(long userId, long groupId) Returns all the user's roles within the user group.List<com.liferay.portal.kernel.model.Role>
getUserRelatedRoles
(long userId, long groupId) Returns all the user's roles within the group.List<com.liferay.portal.kernel.model.Role>
getUserRelatedRoles
(long userId, long[] groupIds) Returns the union of all the user's roles within the groups.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.List<com.liferay.portal.kernel.model.Role>
getUserTeamRoles
(long userId, long groupId) boolean
hasUserRole
(long userId, long companyId, String name, boolean inherited) Returnstrue
if the user is associated with the named regular role.boolean
hasUserRoles
(long userId, long companyId, String[] names, boolean inherited) Returnstrue
if the user has any one of the named regular roles.protected void
initAnalyticsAdministratorViewPermissions
(com.liferay.portal.kernel.model.Role role) protected void
initPersonalControlPanelPortletsPermissions
(com.liferay.portal.kernel.model.Role role) protected void
initPublicationsUserViewPermissions
(com.liferay.portal.kernel.model.Role role) protected void
reindex
(long userId) 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.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.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.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.int
searchCount
(long companyId, String keywords, Integer[] types) Returns the number of roles that match the keywords and types.int
searchCount
(long companyId, String keywords, Integer[] types, LinkedHashMap<String, Object> params) Returns the number of roles that match the keywords, types and params.int
searchCount
(long companyId, String name, String description, Integer[] types) Returns the number of roles that match the name, description, and types.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.protected void
setRolePermissions
(com.liferay.portal.kernel.model.Role role, String name, String[] actionIds) void
setUserRoles
(long userId, long[] roleIds) Sets the roles associated with the user, replacing the user's existing roles.void
unsetUserRoles
(long userId, long[] roleIds) Removes the matching roles associated with the user.com.liferay.portal.kernel.model.Role
updateExternalReferenceCode
(long roleId, String externalReferenceCode) com.liferay.portal.kernel.model.Role
updateExternalReferenceCode
(com.liferay.portal.kernel.model.Role role, String externalReferenceCode) 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) Updates the role with the primary key.protected void
void
validateName
(String name) Methods inherited from class com.liferay.portal.service.base.RoleLocalServiceBaseImpl
addGroupRole, addGroupRole, addGroupRoles, addGroupRoles, addRole, afterPropertiesSet, clearGroupRoles, createPersistedModel, createRole, deleteGroupRole, deleteGroupRole, deleteGroupRoles, deleteGroupRoles, deletePersistedModel, destroy, dslQuery, dslQueryCount, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, dynamicQueryCount, fetchRole, fetchRoleByExternalReferenceCode, fetchRoleByUuidAndCompanyId, getActionableDynamicQuery, getBasePersistence, getCounterLocalService, getCTPersistence, getExportActionableDynamicQuery, getGroupPrimaryKeys, getGroupRoles, getGroupRoles, getGroupRoles, getGroupRolesCount, getIndexableActionableDynamicQuery, getModelClass, getModelClassName, getOSGiServiceIdentifier, getPersistedModel, getRole, getRoleByExternalReferenceCode, getRoleByUuidAndCompanyId, getRoleFinder, getRoleLocalService, getRolePersistence, getRoles, getRolesCount, getUserPrimaryKeys, getUserRoles, getUserRoles, getUserRoles, getUserRolesCount, hasGroupRole, hasGroupRoles, hasUserRole, hasUserRoles, initActionableDynamicQuery, runSQL, setCounterLocalService, setGroupRoles, setRoleFinder, setRoleLocalService, setRolePersistence, updateRole, updateWithUnsafeFunction
Methods inherited from class com.liferay.portal.kernel.service.BaseLocalServiceImpl
getClassLoader, getLocalizationMap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.liferay.portal.kernel.service.PersistedModelLocalService
fetchPersistedModel
-
Constructor Details
-
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, throws com.liferay.portal.kernel.exception.PortalExceptionString> descriptionMap, int type, String subtype, com.liferay.portal.kernel.service.ServiceContext serviceContext) - 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
addUserRole
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userroleId
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
addUserRole
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userrole
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
addUserRoles
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userroles
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
addUserRoles
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userroleIds
- 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.PortalExceptionChecks 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
clearUserRoles
in classRoleLocalServiceBaseImpl
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
deleteRole
in classRoleLocalServiceBaseImpl
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
deleteRole
in classRoleLocalServiceBaseImpl
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
deleteUserRole
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userroleId
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
deleteUserRole
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userrole
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
deleteUserRoles
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userroles
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
deleteUserRoles
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userroleIds
- the primary keys of the roles- Throws:
com.liferay.portal.kernel.exception.PortalException
- See Also:
-
UserPersistence.removeRoles(long, long[])
-
fetchRole
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 companyname
- 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 isRoleConstants.ORGANIZATION_USER
. If the group is a user or user group, then the default role isRoleConstants.POWER_USER
. For all other group types, the default role isRoleConstants.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
-
getGroupRolesAndTeamRolesCount
-
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 companyname
- the resource namescope
- the permission scopeprimKey
- 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 companyname
- the resource namescope
- the permission scopeprimKey
- the primary key of the resource's classactionId
- 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 companyname
- the role's name- Returns:
- the role with the name
- Throws:
com.liferay.portal.kernel.exception.PortalException
-
getRoles
Returns all the roles of the type and subtype.- Parameters:
type
- the role's type (optionally0
)subtype
- the role's subtype (optionallynull
)- Returns:
- the roles of the type and subtype
-
getRoles
Returns all the roles in the company.- Parameters:
companyId
- the primary key of the company- Returns:
- the roles in the company
-
getRoles
Returns all the roles with the types.- Parameters:
companyId
- the primary key of the companytypes
- the role types (optionallynull
)- 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
Returns all the roles of the subtype.- Parameters:
subtype
- the role's subtype (optionallynull
)- Returns:
- the roles of the subtype
-
getSubtypeRolesCount
Returns the number of roles of the subtype.- Parameters:
subtype
- the role's subtype (optionallynull
)- 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 companyteamId
- 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 groupexcludedRoleIds
- the primary keys of the roles to exclude (optionallynull
)- 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 companyteamIds
- the primary keys of the teams- Returns:
- the team roles in the company
- Throws:
com.liferay.portal.kernel.exception.PortalException
-
getTypeRoles
Returns all the roles of the type.- Parameters:
type
- the role's type (optionally0
)- Returns:
- the range of the roles of the type
-
getTypeRoles
Returns a range of all the roles of the type.- Parameters:
type
- the role's type (optionally0
)start
- the lower bound of the range of roles to returnend
- 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 (optionally0
)- Returns:
- the number of roles of the type
-
getUserGroupGroupRoles
Returns all the user's roles within the user group.- Parameters:
userId
- the primary key of the usergroupId
- 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
Returns all the user's roles within the user group.- Parameters:
userId
- the primary key of the usergroupId
- 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 usergroups
- the groups (optionallynull
)- Returns:
- the union of all the user's roles within the groups
-
getUserRelatedRoles
Returns all the user's roles within the group.- Parameters:
userId
- the primary key of the usergroupId
- the primary key of the group- Returns:
- the user's roles within the group
-
getUserRelatedRoles
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 usergroupIds
- the primary keys of the groups- Returns:
- the union of all the user's roles within the groups
-
getUserTeamRoles
-
hasUserRole
@ThreadLocalCachable public boolean hasUserRole(long userId, long companyId, String name, boolean inherited) throws com.liferay.portal.kernel.exception.PortalException Returnstrue
if the user is associated with the named regular role.- Parameters:
userId
- the primary key of the usercompanyId
- the primary key of the companyname
- the name of the roleinherited
- 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 Returnstrue
if the user has any one of the named regular roles.- Parameters:
userId
- the primary key of the usercompanyId
- the primary key of the companynames
- the names of the rolesinherited
- 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
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil.ALL_POS
will return the full result set.- Parameters:
companyId
- the primary key of the companykeywords
- the keywords (space separated), which may occur in the role's name or description (optionallynull
)types
- the role types (optionallynull
)start
- the lower bound of the range of roles to returnend
- the upper bound of the range of roles to return (not inclusive)orderByComparator
- the comparator to order the roles (optionallynull
)- 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
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil.ALL_POS
will return the full result set.- Parameters:
companyId
- the primary key of the companykeywords
- the keywords (space separated), which may occur in the role's name or description (optionallynull
)types
- the role types (optionallynull
)params
- the finder parameters. Can specify values for the "usersRoles" key. For more information, seeRoleFinder
start
- the lower bound of the range of roles to returnend
- the upper bound of the range of roles to return (not inclusive)orderByComparator
- the comparator to order the roles (optionallynull
)- 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
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil.ALL_POS
will return the full result set.- Parameters:
companyId
- the primary key of the companyname
- the role's name (optionallynull
)description
- the role's description (optionallynull
)types
- the role types (optionallynull
)start
- the lower bound of the range of the roles to returnend
- the upper bound of the range of the roles to return (not inclusive)orderByComparator
- the comparator to order the roles (optionallynull
)- 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
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil.ALL_POS
will return the full result set.- Parameters:
companyId
- the primary key of the companyname
- the role's name (optionallynull
)description
- the role's description (optionallynull
)types
- the role types (optionallynull
)params
- the finder's parameters. Can specify values for the "usersRoles" key. For more information, seeRoleFinder
start
- the lower bound of the range of the roles to returnend
- the upper bound of the range of the roles to return (not inclusive)orderByComparator
- the comparator to order the roles (optionallynull
)- Returns:
- the ordered range of the matching roles, ordered by
orderByComparator
- See Also:
-
RoleFinder
-
searchCount
Returns the number of roles that match the keywords and types.- Parameters:
companyId
- the primary key of the companykeywords
- the keywords (space separated), which may occur in the role's name or description (optionallynull
)types
- the role types (optionallynull
)- 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 companykeywords
- the keywords (space separated), which may occur in the role's name or description (optionallynull
)types
- the role types (optionallynull
)params
- the finder parameters. For more information, seeRoleFinder
- Returns:
- the number of matching roles
-
searchCount
Returns the number of roles that match the name, description, and types.- Parameters:
companyId
- the primary key of the companyname
- the role's name (optionallynull
)description
- the role's description (optionallynull
)types
- the role types (optionallynull
)- 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 companyname
- the role's name (optionallynull
)description
- the role's description (optionallynull
)types
- the role types (optionallynull
)params
- the finder parameters. Can specify values for the "usersRoles" key. For more information, seeRoleFinder
- 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 interfacecom.liferay.portal.kernel.service.RoleLocalService
- Overrides:
setUserRoles
in classRoleLocalServiceBaseImpl
- Parameters:
userId
- the primary key of the userroleIds
- 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 userroleIds
- 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, throws com.liferay.portal.kernel.exception.PortalExceptionString> descriptionMap, String subtype, com.liferay.portal.kernel.service.ServiceContext serviceContext) Updates the role with the primary key.- Parameters:
roleId
- the primary key of the rolename
- the role's new nametitleMap
- the new localized titles (optionallynull
) to replace those existing for the roledescriptionMap
- the new localized descriptions (optionallynull
) to replace those existing for the rolesubtype
- the role's new subtype (optionallynull
)serviceContext
- the service context to be applied (optionallynull
). Can set expando bridge attributes for the role.- Returns:
- the role with the primary key
- Throws:
com.liferay.portal.kernel.exception.PortalException
-
validateName
- 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
-
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
-