mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 19:32:40 +01:00
3f5a55fa6e
Summary: Ref T4398. This adds a settings panel for account activity so users can review activity on their own account. Some goals are: - Make it easier for us to develop and support auth and credential information, see T4398. This is the primary driver. - Make it easier for users to understand and review auth and credential information (see T4842 for an example -- this isn't there yet, but builds toward it). - Improve user confidence in security by making logging more apparent and accessible. Minor corresponding changes: - Entering and exiting hisec mode is now logged. - This, sessions, and OAuth authorizations have moved to a new "Sessions and Logs" area, since "Authentication" was getting huge. Test Plan: - Viewed new panel. - Viewed old UI. - Entered/exited hisec and got prompted. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4398 Differential Revision: https://secure.phabricator.com/D8871
63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
final class PhabricatorPeopleLogsController extends PhabricatorPeopleController
|
|
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
|
|
private $queryKey;
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->queryKey = idx($data, 'queryKey');
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
|
->setQueryKey($this->queryKey)
|
|
->setSearchEngine(new PhabricatorPeopleLogSearchEngine())
|
|
->setNavigation($this->buildSideNavView());
|
|
|
|
return $this->delegateToController($controller);
|
|
}
|
|
|
|
public function renderResultsList(
|
|
array $logs,
|
|
PhabricatorSavedQuery $query) {
|
|
assert_instances_of($logs, 'PhabricatorUserLog');
|
|
|
|
$request = $this->getRequest();
|
|
$viewer = $request->getUser();
|
|
|
|
$phids = array();
|
|
foreach ($logs as $log) {
|
|
$phids[$log->getActorPHID()] = true;
|
|
$phids[$log->getUserPHID()] = true;
|
|
}
|
|
$phids = array_keys($phids);
|
|
$handles = $this->loadViewerHandles($phids);
|
|
|
|
$table = id(new PhabricatorUserLogView())
|
|
->setUser($viewer)
|
|
->setLogs($logs)
|
|
->setSearchBaseURI($this->getApplicationURI('logs/'))
|
|
->setHandles($handles);
|
|
|
|
return id(new PHUIObjectBoxView())
|
|
->setHeaderText(pht('User Activity Logs'))
|
|
->appendChild($table);
|
|
}
|
|
|
|
|
|
public function buildSideNavView() {
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
id(new PhabricatorPeopleLogSearchEngine())
|
|
->setViewer($viewer)
|
|
->addNavigationItems($nav->getMenu());
|
|
|
|
return $nav;
|
|
}
|
|
|
|
}
|