Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict who can use the lastSeenAt user sort #2634

Merged
merged 9 commits into from
Mar 2, 2021
7 changes: 6 additions & 1 deletion src/Api/Controller/ListUsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class ListUsersController extends AbstractListController
'username',
'commentCount',
'discussionCount',
'lastSeenAt',
'joinedAt'
];

Expand Down Expand Up @@ -69,6 +68,12 @@ protected function data(ServerRequestInterface $request, Document $document)

$actor->assertCan('viewUserList');

if ($actor->hasPermission('user.viewLastSeenAt')) {
// At the moment, only people able to see everyone's last online date can sort by it. Ref #2519
// Otherwise this sort field would defeat the privacy setting discloseOnline
$this->addSortField('lastSeenAt');
}
clarkwinkelmann marked this conversation as resolved.
Show resolved Hide resolved

$query = Arr::get($this->extractFilter($request), 'q');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might have messed up the merge. I think this line has disappeared from master

$sort = $this->extractSort($request);

Expand Down