mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 18:51:12 +01:00
Trivial fixes from D14467
Summary: See D14467. Just teasing this apart so I can be a little more confident in my commandeering. These are the unambiguous cleanup changes from D14467. Test Plan: inspection / clicked stuff / no impact Reviewers: chad, joshuaspence Reviewed By: joshuaspence Differential Revision: https://secure.phabricator.com/D14868
This commit is contained in:
parent
8bacb3da23
commit
dc5397b2db
2 changed files with 13 additions and 9 deletions
|
@ -11,10 +11,6 @@ abstract class PhabricatorPolicyRule extends Phobject {
|
||||||
const CONTROL_TYPE_NONE = 'none';
|
const CONTROL_TYPE_NONE = 'none';
|
||||||
|
|
||||||
abstract public function getRuleDescription();
|
abstract public function getRuleDescription();
|
||||||
abstract public function applyRule(
|
|
||||||
PhabricatorUser $viewer,
|
|
||||||
$value,
|
|
||||||
PhabricatorPolicyInterface $object);
|
|
||||||
|
|
||||||
public function willApplyRules(
|
public function willApplyRules(
|
||||||
PhabricatorUser $viewer,
|
PhabricatorUser $viewer,
|
||||||
|
@ -23,6 +19,11 @@ abstract class PhabricatorPolicyRule extends Phobject {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract public function applyRule(
|
||||||
|
PhabricatorUser $viewer,
|
||||||
|
$value,
|
||||||
|
PhabricatorPolicyInterface $object);
|
||||||
|
|
||||||
public function getValueControlType() {
|
public function getValueControlType() {
|
||||||
return self::CONTROL_TYPE_TEXT;
|
return self::CONTROL_TYPE_TEXT;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +36,7 @@ abstract class PhabricatorPolicyRule extends Phobject {
|
||||||
* Return `true` if this rule can be applied to the given object.
|
* Return `true` if this rule can be applied to the given object.
|
||||||
*
|
*
|
||||||
* Some policy rules may only operation on certain kinds of objects. For
|
* Some policy rules may only operation on certain kinds of objects. For
|
||||||
* example, a "task author" rule
|
* example, a "task author" rule can only operate on tasks.
|
||||||
*/
|
*/
|
||||||
public function canApplyToObject(PhabricatorPolicyInterface $object) {
|
public function canApplyToObject(PhabricatorPolicyInterface $object) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -43,6 +44,7 @@ abstract class PhabricatorPolicyRule extends Phobject {
|
||||||
|
|
||||||
protected function getDatasourceTemplate(
|
protected function getDatasourceTemplate(
|
||||||
PhabricatorTypeaheadDatasource $datasource) {
|
PhabricatorTypeaheadDatasource $datasource) {
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'markup' => new AphrontTokenizerTemplateView(),
|
'markup' => new AphrontTokenizerTemplateView(),
|
||||||
'uri' => $datasource->getDatasourceURI(),
|
'uri' => $datasource->getDatasourceURI(),
|
||||||
|
@ -65,6 +67,7 @@ abstract class PhabricatorPolicyRule extends Phobject {
|
||||||
|
|
||||||
public function getRequiredHandlePHIDsForSummary($value) {
|
public function getRequiredHandlePHIDsForSummary($value) {
|
||||||
$phids = array();
|
$phids = array();
|
||||||
|
|
||||||
switch ($this->getValueControlType()) {
|
switch ($this->getValueControlType()) {
|
||||||
case self::CONTROL_TYPE_TOKENIZER:
|
case self::CONTROL_TYPE_TOKENIZER:
|
||||||
$phids = $value;
|
$phids = $value;
|
||||||
|
@ -86,7 +89,7 @@ abstract class PhabricatorPolicyRule extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the given value creates a rule with a meaningful effect.
|
* Return `true` if the given value creates a rule with a meaningful effect.
|
||||||
* An example of a rule with no meaningful effect is a "users" rule with no
|
* An example of a rule with no meaningful effect is a "users" rule with no
|
||||||
* users specified.
|
* users specified.
|
||||||
*
|
*
|
||||||
|
@ -131,7 +134,7 @@ abstract class PhabricatorPolicyRule extends Phobject {
|
||||||
$cache->setKey(self::getObjectPolicyCacheKey($object, $rule), $hint);
|
$cache->setKey(self::getObjectPolicyCacheKey($object, $rule), $hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTransactionHint(
|
final protected function getTransactionHint(
|
||||||
PhabricatorPolicyInterface $object) {
|
PhabricatorPolicyInterface $object) {
|
||||||
|
|
||||||
$cache = PhabricatorCaches::getRequestCache();
|
$cache = PhabricatorCaches::getRequestCache();
|
||||||
|
@ -164,7 +167,7 @@ abstract class PhabricatorPolicyRule extends Phobject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getObjectPolicyFullKey() {
|
final public function getObjectPolicyFullKey() {
|
||||||
$key = $this->getObjectPolicyKey();
|
$key = $this->getObjectPolicyKey();
|
||||||
|
|
||||||
if (!$key) {
|
if (!$key) {
|
||||||
|
|
|
@ -91,7 +91,8 @@ final class PhabricatorProjectProfileController
|
||||||
->setName(pht('Edit Details'))
|
->setName(pht('Edit Details'))
|
||||||
->setIcon('fa-pencil')
|
->setIcon('fa-pencil')
|
||||||
->setHref($this->getApplicationURI("details/{$id}/"))
|
->setHref($this->getApplicationURI("details/{$id}/"))
|
||||||
->setDisabled(!$can_edit));
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(!$can_edit));
|
||||||
|
|
||||||
$view->addAction(
|
$view->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
|
|
Loading…
Reference in a new issue