@ProviderType @AccessControlled @JSONWebService @Transactional(isolation=PORTAL, rollbackFor={PortalException.class,SystemException.class}) public interface RoleService extends BaseService
RoleServiceUtil,
RoleServiceBaseImpl,
com.liferay.portal.service.impl.RoleServiceImpl| Modifier and Type | Method and Description |
|---|---|
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.
|
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) |
void |
addUserRoles(long userId,
long[] roleIds)
Adds the roles to the user.
|
void |
deleteRole(long roleId)
Deletes the role with the primary key and its associated permissions.
|
java.lang.String |
getBeanIdentifier()
Returns the Spring bean ID for this bean.
|
java.util.List<Role> |
getGroupRoles(long groupId)
Returns all the roles associated with the group.
|
Role |
getRole(long roleId)
Returns the role with the primary key.
|
Role |
getRole(long companyId,
java.lang.String name)
Returns the role with the name in the company.
|
java.util.List<Role> |
getUserGroupGroupRoles(long userId,
long groupId)
Returns all the user's roles within the user group.
|
java.util.List<Role> |
getUserGroupRoles(long userId,
long groupId)
Returns all the user's roles within the user group.
|
java.util.List<Role> |
getUserRelatedRoles(long userId,
java.util.List<Group> groups)
Returns the union of all the user's roles within the groups.
|
java.util.List<Role> |
getUserRoles(long userId)
Returns all the roles associated with the user.
|
boolean |
hasUserRole(long userId,
long companyId,
java.lang.String name,
boolean inherited)
Returns
true if the user is associated with the named
regular role. |
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. |
void |
setBeanIdentifier(java.lang.String beanIdentifier)
Sets the Spring bean ID for this bean.
|
void |
unsetUserRoles(long userId,
long[] roleIds)
Removes the matching roles associated with the user.
|
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.
|
java.lang.String getBeanIdentifier()
void setBeanIdentifier(java.lang.String beanIdentifier)
beanIdentifier - the Spring bean ID for this beanRole 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, SystemException
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 - if a user with the primary key could not be
found, if the user did not have permission to add roles, if the
class name or the role name were invalid, or if the role is a
duplicateSystemException - if a system exception occurredRole 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, SystemException
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)PortalException - if a user with the primary key could not be
found, if the user did not have permission to add roles, if
the class name or the role name were invalid, or if the role
is a duplicateSystemException - if a system exception occurredvoid addUserRoles(long userId,
long[] roleIds)
throws PortalException,
SystemException
userId - the primary key of the userroleIds - the primary keys of the rolesPortalException - if a user with the primary key could not be found
or if the user did not have permission to assign members to one
of the rolesSystemException - if a system exception occurredvoid deleteRole(long roleId)
throws PortalException,
SystemException
roleId - the primary key of the rolePortalException - if the user did not have permission to delete the
role, if a role with the primary key could not be found, if the
role is a default system role, or if the role's resource could
not be foundSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) java.util.List<Role> getGroupRoles(long groupId) throws PortalException, SystemException
groupId - the primary key of the groupPortalException - if a portal exception occurredSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) Role getRole(long roleId) throws PortalException, SystemException
roleId - the primary key of the rolePortalException - if a role with the primary key could not be found
or if the user did not have permission to view the roleSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) Role getRole(long companyId, java.lang.String name) throws PortalException, SystemException
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 namePortalException - if a role with the name could not be found in the
company or if the user did not have permission to view the roleSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) java.util.List<Role> getUserGroupGroupRoles(long userId, long groupId) throws PortalException, SystemException
userId - the primary key of the usergroupId - the primary key of the groupPortalException - if a portal exception occurredSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) java.util.List<Role> getUserGroupRoles(long userId, long groupId) throws PortalException, SystemException
userId - the primary key of the usergroupId - the primary key of the groupPortalException - if a portal exception occurredSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) java.util.List<Role> getUserRelatedRoles(long userId, java.util.List<Group> groups) throws PortalException, SystemException
userId - the primary key of the usergroups - the groups (optionally null)PortalException - if a portal exception occurredSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) java.util.List<Role> getUserRoles(long userId) throws PortalException, SystemException
userId - the primary key of the userPortalException - if a portal exception occurredSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) boolean hasUserRole(long userId, long companyId, java.lang.String name, boolean inherited) throws PortalException, SystemException
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 otherwisePortalException - if a role with the name could not be found in the
company or if a default user for the company could not be foundSystemException - if a system exception occurred@Transactional(propagation=SUPPORTS, readOnly=true) boolean hasUserRoles(long userId, long companyId, java.lang.String[] names, boolean inherited) throws PortalException, SystemException
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 otherwisePortalException - if any one of the roles with the names could not
be found in the company or if the default user for the company
could not be foundSystemException - if a system exception occurredvoid unsetUserRoles(long userId,
long[] roleIds)
throws PortalException,
SystemException
userId - the primary key of the userroleIds - the primary keys of the rolesPortalException - if a user with the primary key could not be
found, if the user did not have permission to remove members from
a role, or if a role with any one of the primary keys could not
be foundSystemException - if a system exception occurredRole 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, SystemException
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.PortalException - if the user did not have permission to update the
role, if a role with the primary could not be found, or if the
role's name was invalidSystemException - if a system exception occurred