From ef7eb92f78ed8ab6f1ee5b91a0f23645229d44db Mon Sep 17 00:00:00 2001 From: chasegawa Date: Fri, 28 Oct 2022 15:03:53 -0700 Subject: [PATCH] SHIBUI-2394 Changes for 2440 odd behavior in fetch lists for action required screens --- .../admin/ui/service/JPAEntityDescriptorServiceImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityDescriptorServiceImpl.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityDescriptorServiceImpl.java index b40c934cd..b57e517dd 100644 --- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityDescriptorServiceImpl.java +++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityDescriptorServiceImpl.java @@ -181,9 +181,11 @@ public EntityDescriptorRepresentation changeApproveStatusOfEntityDescriptor(Stri if (status) { // approve int approvedCount = ed.approvedCount(); List approversList = groupService.find(ed.getIdOfOwner()).getApproversList(); - if (!approversList.isEmpty() && approversList.size() > approvedCount) { - Approvers approvers = approversList.get( - approvedCount); // yea for index zero - use the count to get the next approvers + if (approversList.isEmpty() && userService.currentUserIsAdmin()){ + ed.setApproved(true); + ed = entityDescriptorRepository.save(ed); + } else if (!approversList.isEmpty() && approversList.size() > approvedCount) { + Approvers approvers = approversList.get(approvedCount); // yea for index zero - use the count to get the next approvers if (!userService.currentUserCanApprove(approvers.getApproverGroups())) { throw new ForbiddenException("You do not have the permissions necessary to approve this entity descriptor."); }