From 9f5b7e484045efc0d5f92615b84af45a6ab93937 Mon Sep 17 00:00:00 2001 From: Earle Nietzel Date: Mon, 3 Jun 2024 15:16:00 -0400 Subject: [PATCH] Revert "SAK-49150 Gradebook TA not in group, but with permission to grade a group, cannot actually grade (#12589)" This reverts commit 30c295a746c70b6d8d550ee37becce1edacbd8ed. --- .../business/GradebookNgBusinessService.java | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/business/GradebookNgBusinessService.java b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/business/GradebookNgBusinessService.java index 9e9c72089c3e..4300c3d9b78c 100644 --- a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/business/GradebookNgBusinessService.java +++ b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/business/GradebookNgBusinessService.java @@ -1795,7 +1795,6 @@ public List sortGradeMatrix(Map */ public List getSiteSectionsAndGroups() { final String siteId = getCurrentSiteId(); - final String userId = getCurrentUser().getId(); final List rval = new ArrayList<>(); @@ -1810,22 +1809,7 @@ public List getSiteSectionsAndGroups() { // get groups (handles both groups and sections) try { final Site site = this.siteService.getSite(siteId); - - final List perms = getPermissionsForUser(userId, siteId); - - List groupReferences = perms.stream().map(PermissionDefinition::getGroupReference).filter(Objects::nonNull).collect(Collectors.toList()); - - final Collection 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 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));