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."); }