Files
phabricator/src/applications/spaces/application/PhabricatorSpacesApplication.php
epriestley 52f8756c3c Add a "template" parameter to application default policies
Summary:
Ref T5681. Ref T6860. This doesn't do anything interesting on its own, just makes the next diff smaller.

In the next diff, policies become aware of the types of objects they're acting on. We need to specify which object type all the "Default View/Edit" settings are for so they get the right rules.

For example, a rule like "Allow task author" is OK for "View Policy" on a task, and also OK for "Default View Policy" on ManiphestApplication. But it's not OK for "Can Create Tasks" on ManiphestApplication.

So annotate all the "template"/"default" policies with their types. The next diff will use these to let you select appropriate rules for the given object type.

Test Plan:
  - Used `grep` to find these.
  - This change has no effect.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5681, T6860

Differential Revision: https://secure.phabricator.com/D13251
2015-06-11 13:25:30 -07:00

87 lines
2.2 KiB
PHP

<?php
final class PhabricatorSpacesApplication extends PhabricatorApplication {
public function getBaseURI() {
return '/spaces/';
}
public function getName() {
return pht('Spaces');
}
public function getShortDescription() {
return pht('Policy Namespaces');
}
public function getFontIcon() {
return 'fa-th-large';
}
public function getTitleGlyph() {
return "\xE2\x97\x8B";
}
public function getFlavorText() {
return pht('Control access to groups of objects.');
}
public function getApplicationGroup() {
return self::GROUP_UTILITIES;
}
public function canUninstall() {
return true;
}
public function isPrototype() {
return true;
}
public function getHelpDocumentationArticles(PhabricatorUser $viewer) {
return array(
array(
'name' => pht('Spaces User Guide'),
'href' => PhabricatorEnv::getDoclink('Spaces User Guide'),
),
);
}
public function getRemarkupRules() {
return array(
new PhabricatorSpacesRemarkupRule(),
);
}
public function getRoutes() {
return array(
'/S(?P<id>[1-9]\d*)' => 'PhabricatorSpacesViewController',
'/spaces/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorSpacesListController',
'create/' => 'PhabricatorSpacesEditController',
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorSpacesEditController',
'(?P<action>activate|archive)/(?P<id>\d+)/'
=> 'PhabricatorSpacesArchiveController',
),
);
}
protected function getCustomCapabilities() {
return array(
PhabricatorSpacesCapabilityCreateSpaces::CAPABILITY => array(
'default' => PhabricatorPolicies::POLICY_ADMIN,
),
PhabricatorSpacesCapabilityDefaultView::CAPABILITY => array(
'caption' => pht('Default view policy for newly created spaces.'),
'template' => PhabricatorSpacesNamespacePHIDType::TYPECONST,
),
PhabricatorSpacesCapabilityDefaultEdit::CAPABILITY => array(
'caption' => pht('Default edit policy for newly created spaces.'),
'default' => PhabricatorPolicies::POLICY_ADMIN,
'template' => PhabricatorSpacesNamespacePHIDType::TYPECONST,
),
);
}
}