Page MenuHomeClusterLabs Projects
Diviner Tech Docs PhabricatorProjectsBasePolicyRule

abstract class PhabricatorProjectsBasePolicyRule
Phorge Technical Documentation (Projects)

This class is not documented.

Tasks

Implementing Object Policies

  • public function getObjectPolicyKey() — Return a unique string like "maniphest.author" to expose this rule as an object policy.

Other Methods

Methods

abstract public function getRuleDescription()
Inherited

This method is not documented.
Return
wild

public function willApplyRules($viewer, $values, $objects)

This method is not documented.
Parameters
PhabricatorUser$viewer
array$values
array$objects
Return
wild

abstract public function applyRule($viewer, $value, $object)
Inherited

This method is not documented.
Parameters
PhabricatorUser$viewer
$value
PhabricatorPolicyInterface$object
Return
wild

public function getValueControlType()

This method is not documented.
Return
wild

public function getValueControlTemplate()

This method is not documented.
Return
wild

public function canApplyToObject($object)
Inherited

PhabricatorPolicyRule

Return true if this rule can be applied to the given object.

Some policy rules may only operation on certain kinds of objects. For example, a "task author" rule can only operate on tasks.

Parameters
PhabricatorPolicyInterface$object
Return
wild

protected function getDatasourceTemplate($datasource)
Inherited

This method is not documented.
Parameters
PhabricatorTypeaheadDatasource$datasource
Return
wild

public function getRuleOrder()
Inherited

This method is not documented.
Return
wild

public function getValueForStorage($value)

This method is not documented.
Parameters
$value
Return
wild

public function getValueForDisplay($viewer, $value)

This method is not documented.
Parameters
PhabricatorUser$viewer
$value
Return
wild

public function getRequiredHandlePHIDsForSummary($value)
Inherited

This method is not documented.
Parameters
$value
Return
wild

public function ruleHasEffect($value)

PhabricatorPolicyRule

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 users specified.

PhabricatorProjectsBasePolicyRule
This method is not documented.
Parameters
$value
Return
boolTrue if the value creates a meaningful rule.

public static function passTransactionHintToRule($object, $rule, $hint)
Inherited

PhabricatorPolicyRule

Tell policy rules about upcoming transaction effects.

Before transaction effects are applied, we try to stop users from making edits which will lock them out of objects. We can't do this perfectly, since they can set a policy to "the moon is full" moments before it wanes, but we try to prevent as many mistakes as possible.

Some policy rules depend on complex checks against object state which we can't set up ahead of time. For example, subscriptions require database writes.

In cases like this, instead of doing writes, you can pass a hint about an object to a policy rule. The rule can then look for hints and use them in rendering a verdict about whether the user will be able to see the object or not after applying the policy change.

Parameters
PhabricatorPolicyInterface$objectObject to pass a hint about.
PhabricatorPolicyRule$ruleRule to pass hint to.
wild$hintHint.
Return
void

final protected function getTransactionHint($object)
Inherited

This method is not documented.
Parameters
PhabricatorPolicyInterface$object
Return
wild

private static function getObjectPolicyCacheKey($object, $rule)
Inherited

This method is not documented.
Parameters
PhabricatorPolicyInterface$object
PhabricatorPolicyRule$rule
Return
wild

public function getObjectPolicyKey()
Inherited

PhabricatorPolicyRule

Return a unique string like "maniphest.author" to expose this rule as an object policy.

Object policy rules, like "Task Author", are more advanced than basic policy rules (like "All Users") but not as powerful as custom rules.

Return
stringUnique identifier for this rule.

final public function getObjectPolicyFullKey()
Inherited

This method is not documented.
Return
wild

public function getObjectPolicyName()
Inherited

This method is not documented.
Return
wild

public function getObjectPolicyShortName()
Inherited

This method is not documented.
Return
wild

public function getObjectPolicyIcon()
Inherited

This method is not documented.
Return
wild

public function getPolicyExplanation()
Inherited

This method is not documented.
Return
wild

protected function getMemberships($viewer_phid)

This method is not documented.
Parameters
$viewer_phid
Return
wild