Skip to content

Commit

Permalink
SHIBUI-2024
Browse files Browse the repository at this point in the history
fixing issue with test when there is no owner of an entity id
  • Loading branch information
chasegawa committed Aug 18, 2021
1 parent 130dd66 commit feb6e53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ class EntityDescriptorControllerVersionEndpointsIntegrationTests extends Specifi
private static resourceUriFor(String uriTemplate, String resourceId) {
String.format(uriTemplate, resourceId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import edu.internet2.tier.shibboleth.admin.util.MDDCConstants;
import edu.internet2.tier.shibboleth.admin.util.ModelRepresentationConversions;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand Down Expand Up @@ -376,6 +377,9 @@ public EntityDescriptorRepresentation update(EntityDescriptorRepresentation edRe
if (edRep.isServiceEnabled() && !userService.currentUserIsAdmin()) {
throw new ForbiddenException("You do not have the permissions necessary to enable this service.");
}
if (StringUtils.isEmpty(edRep.getIdOfOwner())) {
edRep.setIdOfOwner(StringUtils.isNotEmpty(existingEd.getIdOfOwner()) ? existingEd.getIdOfOwner() : userService.getCurrentUserGroup().getOwnerId());
}
if (!userService.isAuthorizedFor(existingEd)) {
throw new ForbiddenException();
}
Expand Down

0 comments on commit feb6e53

Please sign in to comment.