Skip to content

Commit

Permalink
Handle null ownerGroup for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerjmchugh committed Nov 25, 2024
1 parent b4722bc commit d0fbcc9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1503,12 +1503,14 @@ private void checkUserProfileToUnpublishMetadata(UserSession userSession) {
* @param group The {@link Group} to change the privileges for.
* @return True if the user can change the privileges for the group, false otherwise.
*/
private boolean canUserChangePrivilegesForGroup(final ServiceContext context, int metadataGroupOwner, Group group) {
private boolean canUserChangePrivilegesForGroup(final ServiceContext context, Integer metadataGroupOwner, Group group) {
Profile minimumProfileForPrivileges = group.getMinimumProfileForPrivileges();
if (minimumProfileForPrivileges == null) {
return true;
} else {
return (metadataGroupOwner == group.getId()) || (accessManager.isProfileOrMoreOnGroup(context, minimumProfileForPrivileges, group.getId()));
boolean isGroupOwner = metadataGroupOwner != null && metadataGroupOwner == group.getId();
boolean userIsMinimumProfile = accessManager.isProfileOrMoreOnGroup(context, minimumProfileForPrivileges, group.getId());
return isGroupOwner || userIsMinimumProfile;
}
}

Expand Down

0 comments on commit d0fbcc9

Please sign in to comment.