3 final class PhabricatorRepositoryAuditRequest
4 extends PhabricatorRepositoryDAO
5 implements PhabricatorPolicyInterface
{
7 protected $auditorPHID;
9 protected $auditReasons = array();
10 protected $auditStatus;
12 private $commit = self
::ATTACHABLE
;
14 protected function getConfiguration() {
16 self
::CONFIG_TIMESTAMPS
=> false,
17 self
::CONFIG_SERIALIZATION
=> array(
18 'auditReasons' => self
::SERIALIZATION_JSON
,
20 self
::CONFIG_COLUMN_SCHEMA
=> array(
21 'auditStatus' => 'text64',
23 self
::CONFIG_KEY_SCHEMA
=> array(
24 'commitPHID' => array(
25 'columns' => array('commitPHID'),
27 'auditorPHID' => array(
28 'columns' => array('auditorPHID', 'auditStatus'),
30 'key_unique' => array(
31 'columns' => array('commitPHID', 'auditorPHID'),
35 ) + parent
::getConfiguration();
38 public function isUser() {
39 $user_type = PhabricatorPeopleUserPHIDType
::TYPECONST
;
40 return (phid_get_type($this->getAuditorPHID()) == $user_type);
43 public function attachCommit(PhabricatorRepositoryCommit
$commit) {
44 $this->commit
= $commit;
48 public function getCommit() {
49 return $this->assertAttached($this->commit
);
52 public function isResigned() {
53 return $this->getAuditRequestStatusObject()->isResigned();
56 public function getAuditRequestStatusObject() {
57 $status = $this->getAuditStatus();
58 return PhabricatorAuditRequestStatus
::newForStatus($status);
61 /* -( PhabricatorPolicyInterface )----------------------------------------- */
64 public function getCapabilities() {
66 PhabricatorPolicyCapability
::CAN_VIEW
,
70 public function getPolicy($capability) {
71 return $this->getCommit()->getPolicy($capability);
74 public function hasAutomaticCapability($capability, PhabricatorUser
$viewer) {
75 return $this->getCommit()->hasAutomaticCapability($capability, $viewer);
78 public function describeAutomaticCapability($capability) {
80 'This audit is attached to a commit, and inherits its policies.');