Differential D14467 Diff 35018 src/applications/project/policyrule/PhabricatorProjectMembersOfProjectPolicyRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/policyrule/PhabricatorProjectMembersOfProjectPolicyRule.php
- This file was added.
<?php | |||||
final class PhabricatorProjectMembersOfProjectPolicyRule | |||||
extends PhabricatorPolicyRule { | |||||
public function getObjectPolicyKey() { | |||||
return 'project.members'; | |||||
} | |||||
public function getObjectPolicyName() { | |||||
return pht('Members'); | |||||
} | |||||
public function getPolicyExplanation() { | |||||
return pht('Members can take this action.'); | |||||
} | |||||
public function getRuleDescription() { | |||||
return pht('members of project'); | |||||
} | |||||
public function canApplyToObject(PhabricatorPolicyInterface $object) { | |||||
return $object instanceof PhabricatorProject; | |||||
} | |||||
public function applyRule( | |||||
PhabricatorUser $viewer, | |||||
$value, | |||||
PhabricatorPolicyInterface $object) { | |||||
$edge_query = id(new PhabricatorEdgeQuery()) | |||||
->withSourcePHIDs(array($viewer->getPHID())) | |||||
->withDestinationPHIDs(array($object->getPHID())) | |||||
->withEdgeTypes( | |||||
array( | |||||
PhabricatorProjectMemberOfProjectEdgeType::EDGECONST, | |||||
)); | |||||
$edge_query->execute(); | |||||
return (bool)$edge_query->getDestinationPHIDs(); | |||||
} | |||||
public function getValueControlType() { | |||||
return self::CONTROL_TYPE_NONE; | |||||
} | |||||
} |