Skip to content

Commit

Permalink
Leave out defaults in Swagger API
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Oct 18, 2024
1 parent 56cec05 commit 6004e06
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,7 @@ public ResponseEntity<Void> deleteRole(@PathVariable("id") Long id,
"intendedAuthority": "INVITER",
"message": "Personal message included in the email",
"language": "en",
"enforceEmailEquality": false,
"eduIDOnly": false,
"guestRoleIncluded": true,
"suppressSendingEmails": false,
"invites": [
"[email protected]"
],
Expand Down
1 change: 1 addition & 0 deletions server/src/main/java/access/provision/scim/GroupURN.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static String sanitizeRoleShortName(String shortName) {
.replaceAll(" +", " ")
.replaceAll(" ", "_")
.replaceAll("[^A-Za-z0-9_.]", "")
.replaceAll("_+", "_")
.toLowerCase();
}

Expand Down
27 changes: 27 additions & 0 deletions server/src/test/java/access/provision/scim/GroupURNTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package access.provision.scim;

import access.model.Role;
import org.junit.jupiter.api.Test;

import java.util.UUID;

import static org.junit.jupiter.api.Assertions.assertEquals;

class GroupURNTest {

@Test
void sanitizeRoleShortName() {
assertEquals("expected_short_name_yep",
GroupURN.sanitizeRoleShortName("expected SHORT name &&^*&%&^* yep"));
}

@Test
void urnFromRole() {
String identifier = UUID.randomUUID().toString();
Role role = new Role();
role.setShortName(GroupURN.sanitizeRoleShortName("expected SHORT name &&^*&%&^* yep"));
role.setIdentifier(identifier);
String urn = GroupURN.urnFromRole("prefix", role);
assertEquals(String.format("prefix:%s:expected_short_name_yep", identifier), urn);
}
}

0 comments on commit 6004e06

Please sign in to comment.