Skip to content

Commit

Permalink
Revert "SAK-49150 Gradebook TA not in group, but with permission to g…
Browse files Browse the repository at this point in the history
…rade a group, cannot actually grade (#12589)"

This reverts commit 30c295a.
  • Loading branch information
ern committed Jun 3, 2024
1 parent 7ca0102 commit 9f5b7e4
Showing 1 changed file with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,6 @@ public List<GbStudentGradeInfo> sortGradeMatrix(Map<String, GbStudentGradeInfo>
*/
public List<GbGroup> getSiteSectionsAndGroups() {
final String siteId = getCurrentSiteId();
final String userId = getCurrentUser().getId();

final List<GbGroup> rval = new ArrayList<>();

Expand All @@ -1810,22 +1809,7 @@ public List<GbGroup> getSiteSectionsAndGroups() {
// get groups (handles both groups and sections)
try {
final Site site = this.siteService.getSite(siteId);

final List<PermissionDefinition> perms = getPermissionsForUser(userId, siteId);

List<String> groupReferences = perms.stream().map(PermissionDefinition::getGroupReference).filter(Objects::nonNull).collect(Collectors.toList());

final Collection<Group> groups;

if (GbRole.INSTRUCTOR.equals(role)) {
groups = site.getGroups();
} else {
if (!groupReferences.isEmpty()) {
groups = site.getGroups().stream().filter(group -> groupReferences.contains(group.getReference())).collect(Collectors.toList());
} else {
groups = site.getGroupsWithMember(userDirectoryService.getCurrentUser().getId());
}
}
final Collection<Group> groups = isSuperUser() || role == GbRole.INSTRUCTOR ? site.getGroups() : site.getGroupsWithMember(userDirectoryService.getCurrentUser().getId());

for (final Group group : groups) {
rval.add(new GbGroup(group.getId(), group.getTitle(), group.getReference(), GbGroup.Type.GROUP));
Expand Down

0 comments on commit 9f5b7e4

Please sign in to comment.