public function getExtendedPolicy($capability, $viewer)
Get the extended policy for an object.
Return a list of additional policy checks that the viewer must satisfy in order to have the specified capability. This allows you to encode rules like "to see a revision, the viewer must also be able to see the repository it belongs to".
For example, to specify that the viewer must be able to see some other object in order to see this one, you could return:
return array( array($other_object, PhabricatorPolicyCapability::CAN_VIEW), // ... );
If you don't have the actual object you want to check, you can return its PHID instead:
return array( array($other_phid, PhabricatorPolicyCapability::CAN_VIEW), // ... );
You can return a list of capabilities instead of a single capability if you want to require multiple capabilities on a single object:
return array( array( $other_object, array( PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, ), ), // ... );
const | $capability | Capability being tested. |
PhabricatorUser | $viewer | Viewer whose capabilities are being tested. |
list<pair<wild, wild>> | List of extended policies. |