Skip to content

Commit e5f2db2

Browse files
committed
Allowing authorities that can edit external identifiers to see all external identifiers.
1 parent 298563d commit e5f2db2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

app/model/view/UserViewFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(IUserPermissions $userAcl, Logins $logins, \Nette\Se
4545
*/
4646
private function getExternalIds(User $user, bool $canViewAllExternalIds = false)
4747
{
48-
if (!$canViewAllExternalIds) {
48+
if (!$canViewAllExternalIds && !$this->userAcl->canSetExternalIds($user)) {
4949
if (!$this->loggedInUser) {
5050
return [];
5151
}

tests/Presenters/UsersPresenter.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ class TestUsersPresenter extends Tester\TestCase
855855

856856
Assert::equal($user->getId(), $payload['id']);
857857
Assert::true($payload['privateData']['isExternal']);
858+
Assert::equal(['test-cas' => 'abc'], $payload['privateData']['externalIds']);
858859

859860
$els = $this->presenter->externalLogins->findAll();
860861
Assert::count(1, $els);
@@ -887,6 +888,7 @@ class TestUsersPresenter extends Tester\TestCase
887888

888889
Assert::equal($user->getId(), $payload['id']);
889890
Assert::true($payload['privateData']['isExternal']);
891+
Assert::equal(['test-cas' => 'abc'], $payload['privateData']['externalIds']);
890892

891893
$els = $this->presenter->externalLogins->findAll();
892894
Assert::count(1, $els);
@@ -918,6 +920,7 @@ class TestUsersPresenter extends Tester\TestCase
918920

919921
Assert::equal($user->getId(), $payload['id']);
920922
Assert::false($payload['privateData']['isExternal']);
923+
Assert::equal([], $payload['privateData']['externalIds']);
921924

922925
$els = $this->presenter->externalLogins->findAll();
923926
Assert::count(0, $els);

0 commit comments

Comments
 (0)