Feature #16190, avoid returning Liferay Site Roles in UserManagement Core Library
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@177343 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b089245f8d
commit
92e88560e2
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<version>2.4.0-SNAPSHOT</version>
|
||||
<version>2.4.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>User Management API</name>
|
||||
|
|
|
@ -41,7 +41,7 @@ public class LiferayRoleManager implements RoleManager {
|
|||
*/
|
||||
private static final Log _log = LogFactoryUtil.getLog(LiferayRoleManager.class);
|
||||
private static final String ADMINISTRATOR = "Administrator";
|
||||
private static final int ROLE_TYPE = 2; // role type. 1=regular, 2=site, 3=organization
|
||||
protected static final int ROLE_TYPE = 2; // role type. 1=regular, 2=site, 3=organization
|
||||
|
||||
//simple role mapping
|
||||
protected static GCubeRole mapLRRole(Role r) throws PortalException, SystemException {
|
||||
|
@ -327,8 +327,9 @@ public class LiferayRoleManager implements RoleManager {
|
|||
try {
|
||||
roles = RoleLocalServiceUtil.getRoles(ManagementUtils.getCompany().getCompanyId());
|
||||
for (Role role : roles) {
|
||||
if (role.getType()==ROLE_TYPE)
|
||||
if (role.getType()==ROLE_TYPE && !role.getName().startsWith("Site")) {
|
||||
toReturn.add(mapLRRole(role));
|
||||
}
|
||||
}
|
||||
} catch (SystemException | PortalException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -344,7 +345,7 @@ public class LiferayRoleManager implements RoleManager {
|
|||
try {
|
||||
List<UserGroupRole> roles = UserGroupRoleLocalServiceUtil.getUserGroupRolesByGroup(groupId);
|
||||
for (UserGroupRole ugr : roles) {
|
||||
if (ugr.getUserId()==userId)
|
||||
if (ugr.getUserId()==userId && !ugr.getRole().getName().startsWith("Site"))
|
||||
toReturn.add(mapLRRole(ugr.getRole()));
|
||||
}
|
||||
} catch (SystemException e) {
|
||||
|
|
|
@ -732,7 +732,9 @@ public class LiferayUserManager implements UserManager {
|
|||
List<Role> userRoles = RoleServiceUtil.getUserGroupRoles(userId, groupId);
|
||||
List<GCubeRole> toAdd = new ArrayList<GCubeRole>();
|
||||
for (Role role : userRoles) {
|
||||
toAdd.add(LiferayRoleManager.mapLRRole(role));
|
||||
if (! (role.getType() == LiferayRoleManager.ROLE_TYPE && role.getName().startsWith("Site"))) {
|
||||
toAdd.add(LiferayRoleManager.mapLRRole(role));
|
||||
}
|
||||
}
|
||||
toReturn.put(mapLRUser(user), toAdd);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue