@AccessControlled @CTAware @JSONWebService @ProviderType @Transactional(isolation=PORTAL, rollbackFor={PortalException.class,SystemException.class}) public interface RoleService extends BaseService
RoleServiceUtil| Modifier and Type | Method and Description |
|---|---|
Role |
addRole(String className,
long classPK,
String name,
Map<Locale,String> titleMap,
Map<Locale,String> descriptionMap,
int type,
String subtype,
ServiceContext serviceContext)
Adds a role.
|
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.
|
Role |
fetchRole(long roleId) |
List<Role> |
getGroupRoles(long groupId)
Returns all the roles associated with the group.
|
List<Role> |
getGroupRolesAndTeamRoles(long companyId,
String keywords,
List<String> excludedNames,
int[] types,
long excludedTeamRoleId,
long teamGroupId,
int start,
int end) |
int |
getGroupRolesAndTeamRolesCount(long companyId,
String keywords,
List<String> excludedNames,
int[] types,
long excludedTeamRoleId,
long teamGroupId) |
String |
getOSGiServiceIdentifier()
Returns the OSGi service identifier.
|
Role |
getRole(long roleId)
Returns the role with the primary key.
|
Role |
getRole(long companyId,
String name)
Returns the role with the name in the company.
|
List<Role> |
getRoles(int type,
String subtype) |
List<Role> |
getRoles(long companyId,
int[] types) |
List<Role> |
getUserGroupGroupRoles(long userId,
long groupId)
Returns all the user's roles within the user group.
|
List<Role> |
getUserGroupRoles(long userId,
long groupId)
Returns all the user's roles within the user group.
|
List<Role> |
getUserRelatedRoles(long userId,
List<Group> groups)
Returns the union of all the user's roles within the groups.
|
List<Role> |
getUserRoles(long userId)
Returns all the roles associated with the user.
|
boolean |
hasUserRole(long userId,
long companyId,
String name,
boolean inherited)
Returns
true if the user is associated with the named
regular role. |
boolean |
hasUserRoles(long userId,
long companyId,
String[] names,
boolean inherited)
Returns
true if the user has any one of the named regular
roles. |
List<Role> |
search(long companyId,
String keywords,
Integer[] types,
LinkedHashMap<String,Object> params,
int start,
int end,
OrderByComparator<Role> orderByComparator) |
int |
searchCount(long companyId,
String keywords,
Integer[] types,
LinkedHashMap<String,Object> params) |
void |
unsetUserRoles(long userId,
long[] roleIds)
Removes the matching roles associated with the user.
|
Role |
updateRole(long roleId,
String name,
Map<Locale,String> titleMap,
Map<Locale,String> descriptionMap,
String subtype,
ServiceContext serviceContext)
Updates the role with the primary key.
|
Role addRole(String className, long classPK, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, int type, 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.PortalExceptionvoid addUserRoles(long userId,
long[] roleIds)
throws PortalException
userId - the primary key of the userroleIds - the primary keys of the rolesPortalExceptionvoid deleteRole(long roleId)
throws PortalException
roleId - the primary key of the rolePortalException@Transactional(propagation=SUPPORTS, readOnly=true) Role fetchRole(long roleId) throws PortalException
PortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getGroupRoles(long groupId) throws PortalException
groupId - the primary key of the groupPortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getGroupRolesAndTeamRoles(long companyId, String keywords, List<String> excludedNames, int[] types, long excludedTeamRoleId, long teamGroupId, int start, int end)
@Transactional(propagation=SUPPORTS, readOnly=true) int getGroupRolesAndTeamRolesCount(long companyId, String keywords, List<String> excludedNames, int[] types, long excludedTeamRoleId, long teamGroupId)
String getOSGiServiceIdentifier()
@Transactional(propagation=SUPPORTS, readOnly=true) Role getRole(long roleId) throws PortalException
roleId - the primary key of the rolePortalException@Transactional(propagation=SUPPORTS, readOnly=true) Role getRole(long companyId, 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 namePortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getRoles(int type, String subtype) throws PortalException
PortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getRoles(long companyId, int[] types) throws PortalException
PortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getUserGroupGroupRoles(long userId, long groupId) throws PortalException
userId - the primary key of the usergroupId - the primary key of the groupPortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getUserGroupRoles(long userId, long groupId) throws PortalException
userId - the primary key of the usergroupId - the primary key of the groupPortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getUserRelatedRoles(long userId, List<Group> groups) throws PortalException
userId - the primary key of the usergroups - the groups (optionally null)PortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> getUserRoles(long userId) throws PortalException
userId - the primary key of the userPortalException@Transactional(propagation=SUPPORTS, readOnly=true) boolean hasUserRole(long userId, long companyId, 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 otherwisePortalException@Transactional(propagation=SUPPORTS, readOnly=true) boolean hasUserRoles(long userId, long companyId, 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 otherwisePortalException@Transactional(propagation=SUPPORTS, readOnly=true) List<Role> search(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator<Role> orderByComparator)
@Transactional(propagation=SUPPORTS, readOnly=true) int searchCount(long companyId, String keywords, Integer[] types, LinkedHashMap<String,Object> params)
void unsetUserRoles(long userId,
long[] roleIds)
throws PortalException
userId - the primary key of the userroleIds - the primary keys of the rolesPortalExceptionRole updateRole(long roleId, String name, Map<Locale,String> titleMap, Map<Locale,String> descriptionMap, 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.PortalException