mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-07 20:38:32 +01:00
Summary: Depends on D19605. Ref T13189. See PHI642. This adds a separate "Can Disable Users" capability, and makes the underlying transaction use it. This doesn't actually let you weaken the permission, since all pathways need more permissions: - `user.edit` needs CAN_EDIT. - `user.disable/enable` need admin. - Web UI workflow needs admin. Upcoming changes will update these pathways. Without additional changes, this does let you //strengthen// the permission. This also fixes the inability to disable non-bot users via the web UI. Test Plan: - Set permission to "No One", tried to disable users. Got a tailored policy error. - Set permission to "All Users", disabled/enabled a non-bot user. Reviewers: amckinley Maniphest Tasks: T13189 Differential Revision: https://secure.phabricator.com/D19606
113 lines
3.4 KiB
PHP
113 lines
3.4 KiB
PHP
<?php
|
|
|
|
final class PhabricatorPeopleApplication extends PhabricatorApplication {
|
|
|
|
public function getName() {
|
|
return pht('People');
|
|
}
|
|
|
|
public function getShortDescription() {
|
|
return pht('User Accounts and Profiles');
|
|
}
|
|
|
|
public function getBaseURI() {
|
|
return '/people/';
|
|
}
|
|
|
|
public function getTitleGlyph() {
|
|
return "\xE2\x99\x9F";
|
|
}
|
|
|
|
public function getIcon() {
|
|
return 'fa-users';
|
|
}
|
|
|
|
public function isPinnedByDefault(PhabricatorUser $viewer) {
|
|
return $viewer->getIsAdmin();
|
|
}
|
|
|
|
public function getFlavorText() {
|
|
return pht('Sort of a social utility.');
|
|
}
|
|
|
|
public function getApplicationGroup() {
|
|
return self::GROUP_UTILITIES;
|
|
}
|
|
|
|
public function canUninstall() {
|
|
return false;
|
|
}
|
|
|
|
public function getRoutes() {
|
|
return array(
|
|
'/people/' => array(
|
|
$this->getQueryRoutePattern() => 'PhabricatorPeopleListController',
|
|
'logs/' => array(
|
|
$this->getQueryRoutePattern() => 'PhabricatorPeopleLogsController',
|
|
),
|
|
'invite/' => array(
|
|
'(?:query/(?P<queryKey>[^/]+)/)?'
|
|
=> 'PhabricatorPeopleInviteListController',
|
|
'send/'
|
|
=> 'PhabricatorPeopleInviteSendController',
|
|
),
|
|
'approve/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleApproveController',
|
|
'(?P<via>disapprove)/(?P<id>[1-9]\d*)/'
|
|
=> 'PhabricatorPeopleDisableController',
|
|
'(?P<via>disable)/(?P<id>[1-9]\d*)/'
|
|
=> 'PhabricatorPeopleDisableController',
|
|
'empower/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleEmpowerController',
|
|
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleDeleteController',
|
|
'rename/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleRenameController',
|
|
'welcome/(?P<id>[1-9]\d*)/' => 'PhabricatorPeopleWelcomeController',
|
|
'create/' => 'PhabricatorPeopleCreateController',
|
|
'new/(?P<type>[^/]+)/' => 'PhabricatorPeopleNewController',
|
|
'ldap/' => 'PhabricatorPeopleLdapController',
|
|
'editprofile/(?P<id>[1-9]\d*)/' =>
|
|
'PhabricatorPeopleProfileEditController',
|
|
'badges/(?P<id>[1-9]\d*)/' =>
|
|
'PhabricatorPeopleProfileBadgesController',
|
|
'tasks/(?P<id>[1-9]\d*)/' =>
|
|
'PhabricatorPeopleProfileTasksController',
|
|
'commits/(?P<id>[1-9]\d*)/' =>
|
|
'PhabricatorPeopleProfileCommitsController',
|
|
'revisions/(?P<id>[1-9]\d*)/' =>
|
|
'PhabricatorPeopleProfileRevisionsController',
|
|
'picture/(?P<id>[1-9]\d*)/' =>
|
|
'PhabricatorPeopleProfilePictureController',
|
|
'manage/(?P<id>[1-9]\d*)/' =>
|
|
'PhabricatorPeopleProfileManageController',
|
|
),
|
|
'/p/(?P<username>[\w._-]+)/' => array(
|
|
'' => 'PhabricatorPeopleProfileViewController',
|
|
'item/' => $this->getProfileMenuRouting(
|
|
'PhabricatorPeopleProfileMenuController'),
|
|
),
|
|
);
|
|
}
|
|
|
|
public function getRemarkupRules() {
|
|
return array(
|
|
new PhabricatorMentionRemarkupRule(),
|
|
);
|
|
}
|
|
|
|
protected function getCustomCapabilities() {
|
|
return array(
|
|
PeopleCreateUsersCapability::CAPABILITY => array(
|
|
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
|
),
|
|
PeopleDisableUsersCapability::CAPABILITY => array(
|
|
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
|
),
|
|
PeopleBrowseUserDirectoryCapability::CAPABILITY => array(),
|
|
);
|
|
}
|
|
|
|
public function getApplicationSearchDocumentTypes() {
|
|
return array(
|
|
PhabricatorPeopleUserPHIDType::TYPECONST,
|
|
);
|
|
}
|
|
|
|
}
|