added has Team and has Role methods to RolesManger
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@128599 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
92cb11ad2d
commit
37262ce263
|
@ -28,6 +28,22 @@ public interface RoleManager {
|
||||||
* @throws UserRetrievalFault
|
* @throws UserRetrievalFault
|
||||||
*/
|
*/
|
||||||
boolean isAdmin(long userId) throws UserRetrievalFault;
|
boolean isAdmin(long userId) throws UserRetrievalFault;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param userId userId the LR UserId, not the username
|
||||||
|
* @param groupId the LR groupId
|
||||||
|
* @param roleId the LR roleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean hasRole(long userId, long groupId, long roleId);
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param userId userId the LR UserId, not the username
|
||||||
|
* @param teamId the LR teamId
|
||||||
|
* @param roleId the LR roleId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean hasTeam(long userId, long teamId);
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param userId the LR UserId
|
* @param userId the LR UserId
|
||||||
|
|
|
@ -132,6 +132,30 @@ public class LiferayRoleManager implements RoleManager {
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasRole(long userId, long groupId, long roleId) {
|
||||||
|
try {
|
||||||
|
List<GCubeRole> roles = listRolesByUserAndGroup(userId, groupId);
|
||||||
|
for (GCubeRole gCubeRole : roles) {
|
||||||
|
if (gCubeRole.getRoleId() == roleId)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (GroupRetrievalFault | UserRetrievalFault e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasTeam(long userId, long teamId) {
|
||||||
|
try {
|
||||||
|
return UserLocalServiceUtil.hasTeamUser(teamId, userId);
|
||||||
|
} catch (SystemException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -512,4 +536,5 @@ public class LiferayRoleManager implements RoleManager {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue