Fixed assignTeamToUser function

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vo-management/usermanagement-core@128077 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-04-14 10:35:38 +00:00
parent e100fd23c8
commit 0fadebec81
1 changed files with 7 additions and 3 deletions

View File

@ -485,11 +485,15 @@ public class LiferayRoleManager implements RoleManager {
public boolean assignTeamToUser(long userId, long teamId) throws UserManagementSystemException, UserRetrievalFault, TeamRetrievalFault {
try {
List<Team> currentTeams = TeamLocalServiceUtil.getUserTeams(userId);
// add is not supported in the returned list, so we need a workaround
List<Team> currentTeamsArrayList = new ArrayList<Team>(currentTeams);
Team toAdd = TeamLocalServiceUtil.getTeam(teamId);
currentTeams.add(toAdd);
long[] teamIdstoSet = new long[currentTeams.size()];
currentTeamsArrayList.add(toAdd);
long[] teamIdstoSet = new long[currentTeamsArrayList.size()];
int i = 0;
for (Team t : currentTeams) {
for (Team t : currentTeamsArrayList) {
teamIdstoSet[i] = t.getTeamId();
i++;
}