Skip to content

Commit

Permalink
Strip space test
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Dec 13, 2024
1 parent 9250353 commit fc9a34e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/src/main/java/access/security/UserPermissions.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ public static void assertAuthority(User user, Authority authority) {
throw new UserRestrictionException();
}

if (user.isSuperUser()) {
return;
}

if (user.isInstitutionAdmin() && Authority.INSTITUTION_ADMIN.hasEqualOrHigherRights(authority)) {
return;
}
if (!user.isSuperUser() && user.getUserRoles().stream()
.noneMatch(userRole -> userRole.getAuthority().hasEqualOrHigherRights(authority)))
if (user.getUserRoles().stream()
.noneMatch(userRole -> userRole.getAuthority().hasEqualOrHigherRights(authority)))
throw new UserRestrictionException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ void parse() {

String emailParsed = FullSearchQueryParser.parse("[email protected]");
assertEquals("+brand +ms +play*", emailParsed);

String strippedWhiteSpace = FullSearchQueryParser.parse(" [email protected] ");
assertEquals("+Leitndhireedisvea +example*", strippedWhiteSpace);
}

@Test
Expand Down

0 comments on commit fc9a34e

Please sign in to comment.