added assignTeamUser
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@128076 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8b748fe964
commit
e100fd23c8
|
@ -227,6 +227,17 @@ public interface RoleManager {
|
||||||
* @throws TeamRetrievalFault if a system exception occurred or a team does not exists
|
* @throws TeamRetrievalFault if a system exception occurred or a team does not exists
|
||||||
*/
|
*/
|
||||||
boolean setUserTeams(long userId, long[] teamIds) throws TeamRetrievalFault;
|
boolean setUserTeams(long userId, long[] teamIds) throws TeamRetrievalFault;
|
||||||
|
/**
|
||||||
|
* associate one team to the existing teams of user
|
||||||
|
* @param userId
|
||||||
|
* @param teamId
|
||||||
|
* @return
|
||||||
|
* @throws UserManagementSystemException
|
||||||
|
* @throws UserRetrievalFault
|
||||||
|
* @throws GroupRetrievalFault
|
||||||
|
* @throws TeamRetrievalFault
|
||||||
|
*/
|
||||||
|
boolean assignTeamToUser(long userId, long teamId) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault,TeamRetrievalFault;
|
||||||
/**
|
/**
|
||||||
* @return a list of {@link GCubeTeam} belonging to a give group
|
* @return a list of {@link GCubeTeam} belonging to a give group
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -474,10 +474,31 @@ public class LiferayRoleManager implements RoleManager {
|
||||||
try {
|
try {
|
||||||
toReturn = mapLRTeam(TeamLocalServiceUtil.getTeam(groupId, teamName));
|
toReturn = mapLRTeam(TeamLocalServiceUtil.getTeam(groupId, teamName));
|
||||||
} catch (PortalException e) {
|
} catch (PortalException e) {
|
||||||
throw new TeamRetrievalFault("The teamId or groupdid does not exists", e);
|
throw new TeamRetrievalFault("The teamname or groupdid does not exists", e);
|
||||||
} catch (SystemException e) {
|
} catch (SystemException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean assignTeamToUser(long userId, long teamId) throws UserManagementSystemException, UserRetrievalFault, TeamRetrievalFault {
|
||||||
|
try {
|
||||||
|
List<Team> currentTeams = TeamLocalServiceUtil.getUserTeams(userId);
|
||||||
|
Team toAdd = TeamLocalServiceUtil.getTeam(teamId);
|
||||||
|
currentTeams.add(toAdd);
|
||||||
|
long[] teamIdstoSet = new long[currentTeams.size()];
|
||||||
|
int i = 0;
|
||||||
|
for (Team t : currentTeams) {
|
||||||
|
teamIdstoSet[i] = t.getTeamId();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return setUserTeams(userId, teamIdstoSet);
|
||||||
|
} catch (SystemException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (PortalException e) {
|
||||||
|
throw new TeamRetrievalFault("The teamId or groupdid does not exists", e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue