-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
imp: Allow admin to change the LDAP identifiers
- Loading branch information
1 parent
09be036
commit 5f28d8f
Showing
6 changed files
with
159 additions
and
32 deletions.
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
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 |
---|---|---|
|
@@ -321,6 +321,50 @@ public function testPostUpdateDoesNotChangePasswordIfEmpty(): void | |
$this->assertSame($newOrganization->getId(), $otherUser->getOrganization()->getId()); | ||
} | ||
|
||
public function testPostUpdateDoesNotChangeEmailNameOrPasswordIfLdapIsEnabled(): void | ||
{ | ||
$client = static::createClient(); | ||
/** @var \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface */ | ||
$passwordHasher = self::getContainer()->get('security.user_password_hasher'); | ||
$user = UserFactory::createOne(); | ||
$client->loginUser($user->object()); | ||
$this->grantAdmin($user->object(), ['admin:manage:users']); | ||
$oldEmail = '[email protected]'; | ||
$newEmail = '[email protected]'; | ||
$oldName = 'Alix Pataquès'; | ||
$newName = 'Benedict Aphone'; | ||
$oldPassword = 'secret'; | ||
$newPassword = 'super secret'; | ||
$oldLdapIdentifier = 'alix'; | ||
$newLdapIdentifier = 'benedict'; | ||
$oldOrganization = OrganizationFactory::createOne(); | ||
$newOrganization = OrganizationFactory::createOne(); | ||
$otherUser = UserFactory::createOne([ | ||
'email' => $oldEmail, | ||
'name' => $oldName, | ||
'password' => $oldPassword, | ||
'organization' => $oldOrganization, | ||
'ldapIdentifier' => $oldLdapIdentifier, | ||
]); | ||
|
||
$client->request('POST', "/users/{$otherUser->getUid()}/edit", [ | ||
'_csrf_token' => $this->generateCsrfToken($client, 'update user'), | ||
'email' => $newEmail, | ||
'name' => $newName, | ||
'password' => $newPassword, | ||
'organization' => $newOrganization->getUid(), | ||
'ldapIdentifier' => $newLdapIdentifier, | ||
]); | ||
|
||
$this->assertResponseRedirects('/users', 302); | ||
$otherUser->refresh(); | ||
$this->assertSame($oldEmail, $otherUser->getEmail()); | ||
$this->assertSame($oldName, $otherUser->getName()); | ||
$this->assertTrue($passwordHasher->isPasswordValid($otherUser->object(), $oldPassword)); | ||
$this->assertSame($newOrganization->getId(), $otherUser->getOrganization()->getId()); | ||
$this->assertSame($newLdapIdentifier, $otherUser->getLdapIdentifier()); | ||
} | ||
|
||
public function testPostUpdateAcceptsEmptyOrganization(): void | ||
{ | ||
$client = static::createClient(); | ||
|
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