Add a 'create' policy to Project
Summary: UX on this could probably be better 'disabled' crumbs don't appear to have any visible difference, and the policy error has to load the /create page rather than being a modal - not sure on the way to fix these. Test Plan: Tried to create a project with and without access, saw suitable error. Reviewers: epriestley, #blessed_reviewers CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7279
This commit is contained in:
@@ -24,11 +24,16 @@ abstract class PhabricatorProjectController extends PhabricatorController {
|
||||
public function buildApplicationCrumbs() {
|
||||
$crumbs = parent::buildApplicationCrumbs();
|
||||
|
||||
$can_create = $this->hasApplicationCapability(
|
||||
ProjectCapabilityCreateProjects::CAPABILITY);
|
||||
|
||||
$crumbs->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setName(pht('Create Project'))
|
||||
->setHref($this->getApplicationURI('create/'))
|
||||
->setIcon('create'));
|
||||
->setIcon('create')
|
||||
->setWorkflow(!$can_create)
|
||||
->setDisabled(!$can_create));
|
||||
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user