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:
Asher Baker
2013-10-10 04:29:07 -07:00
committed by epriestley
parent c39b10aa7a
commit 8cc64a9678
5 changed files with 38 additions and 1 deletions

View File

@@ -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;
}