@ProviderType
public class RoleServiceUtil
extends java.lang.Object
com.liferay.portal.service.impl.RoleServiceImpl and is the
primary access point for service operations in application layer code running
on a remote server. Methods of this service are expected to have security
checks based on the propagated JAAS credentials because this service can be
accessed remotely.RoleService,
RoleServiceBaseImpl,
com.liferay.portal.service.impl.RoleServiceImpl| Constructor and Description |
|---|
RoleServiceUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Role |
addRole(java.lang.String className,
long classPK,
java.lang.String name,
java.util.Map<java.util.Locale,java.lang.String> titleMap,
java.util.Map<java.util.Locale,java.lang.String> descriptionMap,
int type,
java.lang.String subtype,
ServiceContext serviceContext)
Adds a role.
|
static Role |
addRole(java.lang.String name,
java.util.Map<java.util.Locale,java.lang.String> titleMap,
java.util.Map<java.util.Locale,java.lang.String> descriptionMap,
int type)
Deprecated.
As of 6.2.0, replaced by
addRole(String, long,
String, Map, Map, int, String, ServiceContext) |
static void |
addUserRoles(long userId,
long[] roleIds)
Adds the roles to the user.
|
static void |
deleteRole(long roleId)
Deletes the role with the primary key and its associated permissions.
|
static Role |
fetchRole(long roleId) |
static java.util.List<Role> |
getGroupRoles(long groupId)
Returns all the roles associated with the group.
|
static java.lang.String |
getOSGiServiceIdentifier()
Returns the OSGi service identifier.
|
static Role |
getRole(long roleId)
Returns the role with the primary key.
|
static Role |
getRole(long companyId,
java.lang.String name)
Returns the role with the name in the company.
|
static java.util.List<Role> |
getRoles(int type,
java.lang.String subtype) |
static java.util.List<Role> |
getRoles(long companyId,
int[] types) |
static RoleService |
getService() |
static java.util.List<Role> |
getUserGroupGroupRoles(long userId,
long groupId)
Returns all the user's roles within the user group.
|
static java.util.List<Role> |
getUserGroupRoles(long userId,
long groupId)
Returns all the user's roles within the user group.
|
static java.util.List<Role> |
getUserRelatedRoles(long userId,
java.util.List<Group> groups)
Returns the union of all the user's roles within the groups.
|
static java.util.List<Role> |
getUserRoles(long userId)
Returns all the roles associated with the user.
|
static boolean |
hasUserRole(long userId,
long companyId,
java.lang.String name,
boolean inherited)
Returns
true if the user is associated with the named
regular role. |
static boolean |
hasUserRoles(long userId,
long companyId,
java.lang.String[] names,
boolean inherited)
Returns
true if the user has any one of the named regular
roles. |
static java.util.List<Role> |
search(long companyId,
java.lang.String keywords,
java.lang.Integer[] types,
java.util.LinkedHashMap<java.lang.String,java.lang.Object> params,
int start,
int end,
OrderByComparator<Role> obc) |
static int |
searchCount(long companyId,
java.lang.String keywords,
java.lang.Integer[] types,
java.util.LinkedHashMap<java.lang.String,java.lang.Object> params) |
static void |
unsetUserRoles(long userId,
long[] roleIds)
Removes the matching roles associated with the user.
|
static Role |
updateRole(long roleId,
java.lang.String name,
java.util.Map<java.util.Locale,java.lang.String> titleMap,
java.util.Map<java.util.Locale,java.lang.String> descriptionMap,
java.lang.String subtype,
ServiceContext serviceContext)
Updates the role with the primary key.
|
public static Role addRole(java.lang.String className, long classPK, java.lang.String name, java.util.Map<java.util.Locale,java.lang.String> titleMap, java.util.Map<java.util.Locale,java.lang.String> descriptionMap, int type, java.lang.String subtype, ServiceContext serviceContext) throws PortalException
className - the name of the class for which the role is createdclassPK - the primary key of the class for which the role is
created (optionally 0)name - the role's nametitleMap - the role's localized titles (optionally
null)descriptionMap - the role's localized descriptions (optionally
null)type - the role's type (optionally 0)subtype - the role's subtype (optionally null)serviceContext - the service context to be applied (optionally
null). Can set the expando bridge attributes for the
role.PortalException@Deprecated public static Role addRole(java.lang.String name, java.util.Map<java.util.Locale,java.lang.String> titleMap, java.util.Map<java.util.Locale,java.lang.String> descriptionMap, int type) throws PortalException
addRole(String, long,
String, Map, Map, int, String, ServiceContext)name - the role's nametitleMap - the role's localized titles (optionally
null)descriptionMap - the role's localized descriptions (optionally
null)type - the role's type (optionally 0)PortalExceptionpublic static void addUserRoles(long userId,
long[] roleIds)
throws PortalException
userId - the primary key of the userroleIds - the primary keys of the rolesPortalExceptionpublic static void deleteRole(long roleId)
throws PortalException
roleId - the primary key of the rolePortalExceptionpublic static Role fetchRole(long roleId) throws PortalException
PortalExceptionpublic static java.util.List<Role> getGroupRoles(long groupId) throws PortalException
groupId - the primary key of the groupPortalExceptionpublic static java.lang.String getOSGiServiceIdentifier()
public static Role getRole(long companyId, java.lang.String name) throws PortalException
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.
companyId - the primary key of the companyname - the role's namePortalExceptionpublic static Role getRole(long roleId) throws PortalException
roleId - the primary key of the rolePortalExceptionpublic static java.util.List<Role> getRoles(long companyId, int[] types) throws PortalException
PortalExceptionpublic static java.util.List<Role> getRoles(int type, java.lang.String subtype) throws PortalException
PortalExceptionpublic static java.util.List<Role> getUserGroupGroupRoles(long userId, long groupId) throws PortalException
userId - the primary key of the usergroupId - the primary key of the groupPortalExceptionpublic static java.util.List<Role> getUserGroupRoles(long userId, long groupId) throws PortalException
userId - the primary key of the usergroupId - the primary key of the groupPortalExceptionpublic static java.util.List<Role> getUserRelatedRoles(long userId, java.util.List<Group> groups) throws PortalException
userId - the primary key of the usergroups - the groups (optionally null)PortalExceptionpublic static java.util.List<Role> getUserRoles(long userId) throws PortalException
userId - the primary key of the userPortalExceptionpublic static boolean hasUserRole(long userId,
long companyId,
java.lang.String name,
boolean inherited)
throws PortalException
true if the user is associated with the named
regular role.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
searchtrue if the user is associated with the regular
role; false otherwisePortalExceptionpublic static boolean hasUserRoles(long userId,
long companyId,
java.lang.String[] names,
boolean inherited)
throws PortalException
true if the user has any one of the named regular
roles.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
searchtrue if the user has any one of the regular roles;
false otherwisePortalExceptionpublic static java.util.List<Role> search(long companyId, java.lang.String keywords, java.lang.Integer[] types, java.util.LinkedHashMap<java.lang.String,java.lang.Object> params, int start, int end, OrderByComparator<Role> obc)
public static int searchCount(long companyId,
java.lang.String keywords,
java.lang.Integer[] types,
java.util.LinkedHashMap<java.lang.String,java.lang.Object> params)
public static void unsetUserRoles(long userId,
long[] roleIds)
throws PortalException
userId - the primary key of the userroleIds - the primary keys of the rolesPortalExceptionpublic static Role updateRole(long roleId, java.lang.String name, java.util.Map<java.util.Locale,java.lang.String> titleMap, java.util.Map<java.util.Locale,java.lang.String> descriptionMap, java.lang.String subtype, ServiceContext serviceContext) throws PortalException
roleId - the primary key of the rolename - the role's new nametitleMap - the new localized titles (optionally null)
to replace those existing for the roledescriptionMap - the new localized descriptions (optionally
null) to replace those existing for the rolesubtype - the role's new subtype (optionally null)serviceContext - the service context to be applied (optionally
null). Can set the expando bridge attributes for the
role.PortalExceptionpublic static RoleService getService()