Recognize merchant authority in Fund initiatives
Summary: Update fund for new merchant authority stuff. Test Plan: - Created a secret initiative. - Could see related activity as merchant. - Could not see it not-as-merchant. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11959
This commit is contained in:
@@ -125,7 +125,21 @@ final class FundInitiative extends FundDAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
||||||
return ($viewer->getPHID() == $this->getOwnerPHID());
|
if ($viewer->getPHID() == $this->getOwnerPHID()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($capability == PhabricatorPolicyCapability::CAN_VIEW) {
|
||||||
|
foreach ($viewer->getAuthorities() as $authority) {
|
||||||
|
if ($authority instanceof PhortuneMerchant) {
|
||||||
|
if ($authority->getPHID() == $this->getMerchantPHID()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAutomaticCapability($capability) {
|
public function describeAutomaticCapability($capability) {
|
||||||
|
|||||||
Reference in New Issue
Block a user