mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 01:32:42 +01:00
cbff913432
Summary: Ref T13151. See PHI702. An install is interested in a "members of all projects" (vs "members of any project", which is currently implemented) rule. Although this is fairly niche, I think it's reasonable and doesn't have much of a maintenance cost. This could already be implemented as an extension, but it would have to copy/paste a bunch of code. Test Plan: - Ran unit tests. - Used the UI to select this policy for a task, with various values. Joined/left projects to satisfy/fail the rule. Behavior seemed correct. - Used the UI to select the existing policy rule ("any project"), joined/left projects to satisfy/fail the rule. Doesn't look like I broke anything. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13151 Differential Revision: https://secure.phabricator.com/D19486
29 lines
568 B
PHP
29 lines
568 B
PHP
<?php
|
|
|
|
final class PhabricatorProjectsAllPolicyRule
|
|
extends PhabricatorProjectsBasePolicyRule {
|
|
|
|
public function getRuleDescription() {
|
|
return pht('members of all projects');
|
|
}
|
|
|
|
public function applyRule(
|
|
PhabricatorUser $viewer,
|
|
$value,
|
|
PhabricatorPolicyInterface $object) {
|
|
|
|
$memberships = $this->getMemberships($viewer->getPHID());
|
|
foreach ($value as $project_phid) {
|
|
if (empty($memberships[$project_phid])) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public function getRuleOrder() {
|
|
return 205;
|
|
}
|
|
|
|
}
|