Page MenuHomec4science

DifferentialEditPolicyFieldSpecification.php
No OneTemporary

File Metadata

Created
Fri, Jan 24, 09:36

DifferentialEditPolicyFieldSpecification.php

<?php
final class DifferentialEditPolicyFieldSpecification
extends DifferentialFieldSpecification {
private $value;
public function shouldAppearOnEdit() {
return true;
}
protected function didSetRevision() {
$this->value = $this->getRevision()->getEditPolicy();
}
public function setValueFromRequest(AphrontRequest $request) {
$this->value = $request->getStr('editPolicy');
return $this;
}
public function renderEditControl() {
$viewer = $this->getUser();
$revision = $this->getRevision();
$policies = id(new PhabricatorPolicyQuery())
->setViewer($viewer)
->setObject($revision)
->execute();
return id(new AphrontFormPolicyControl())
->setUser($viewer)
->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
->setPolicyObject($revision)
->setPolicies($policies)
->setName('editPolicy');
}
}

Event Timeline