Skip to content

Commit

Permalink
SHIBUI-2394
Browse files Browse the repository at this point in the history
Updated user check for which groups they can approve for to include ALL the groups a user belongs to
  • Loading branch information
chasegawa committed Oct 18, 2022
1 parent f6fd988 commit 006ac2e
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -145,8 +146,17 @@ public Group getCurrentUserGroup() {
}
}

/**
* @return a list of ALL groups that the user can approve for (checks ALL the users groups)
*/
public List<String> getGroupsCurrentUserCanApprove() {
return getCurrentUserGroup().getApproveForList();
HashSet<String> fullSet = new HashSet<>();
for (Group g : getCurrentUser().getUserGroups()) {
fullSet.addAll(g.getApproveForList());
}
ArrayList<String> result = new ArrayList<>();
result.addAll(fullSet);
return result;
}

public Set<String> getUserRoles(String username) {
Expand Down

0 comments on commit 006ac2e

Please sign in to comment.