-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete all user group members if user is deleted (#2372)
* Delete all user group members if user is deleted Alternative Fix for issue 2398 TDD , test first * Fix and remove all entries for a given user id
- Loading branch information
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -462,6 +462,22 @@ void deleteIsAllowedWithCorrectVersionInEtag() { | |
new MockHttpServletRequest(), new MockHttpServletResponse()); | ||
} | ||
|
||
@Test | ||
void deleteAllGroupMemberEntriesIfUserIsDeleted() { | ||
ScimUser newUser = new ScimUser(null, "myuser", "given", "family"); | ||
newUser.addEmail("[email protected]"); | ||
newUser.setOrigin("testOrigin"); | ||
newUser = jdbcScimUserProvisioning.createUser(newUser, "exguyspassword", identityZone.getId()); | ||
ScimGroup g1 = new ScimGroup(null, "scimgroup", identityZone.getId()); | ||
g1 = jdbcScimGroupProvisioning.create(g1, identityZone.getId()); | ||
ScimGroupMember m1 = new ScimGroupMember(newUser.getId(), ScimGroupMember.Type.USER); | ||
ScimGroupMember m2 = scimGroupMembershipManager.addMember(g1.getId(), m1, identityZone.getId()); | ||
assertEquals(1, scimGroupMembershipManager.getMembers(g1.getId(), false, identityZone.getId()).size()); | ||
scimUserEndpoints.deleteUser(newUser.getId(), Integer.toString(newUser.getMeta().getVersion()), | ||
new MockHttpServletRequest(), new MockHttpServletResponse()); | ||
assertEquals(0, scimGroupMembershipManager.getMembers(g1.getId(), false, identityZone.getId()).size()); | ||
} | ||
|
||
@Test | ||
void deleteIsAllowedWithQuotedEtag() { | ||
ScimUser exGuy = new ScimUser(null, "deleteme", "Expendable", "Guy"); | ||
|