2017-03-13 19:31:57 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialReviewer
|
|
|
|
extends DifferentialDAO {
|
|
|
|
|
|
|
|
protected $revisionPHID;
|
|
|
|
protected $reviewerPHID;
|
|
|
|
protected $reviewerStatus;
|
2017-03-20 17:54:48 +01:00
|
|
|
protected $lastActionDiffPHID;
|
|
|
|
protected $lastCommentDiffPHID;
|
|
|
|
|
2017-03-20 20:35:30 +01:00
|
|
|
private $authority = array();
|
|
|
|
|
2017-03-13 19:31:57 +01:00
|
|
|
protected function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
|
|
'reviewerStatus' => 'text64',
|
2017-03-20 17:54:48 +01:00
|
|
|
'lastActionDiffPHID' => 'phid?',
|
|
|
|
'lastCommentDiffPHID' => 'phid?',
|
2017-03-13 19:31:57 +01:00
|
|
|
),
|
|
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
|
|
'key_revision' => array(
|
|
|
|
'columns' => array('revisionPHID', 'reviewerPHID'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
2017-03-20 20:35:30 +01:00
|
|
|
public function isUser() {
|
|
|
|
$user_type = PhabricatorPeopleUserPHIDType::TYPECONST;
|
|
|
|
return (phid_get_type($this->getReviewerPHID()) == $user_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function attachAuthority(PhabricatorUser $user, $has_authority) {
|
|
|
|
$this->authority[$user->getCacheFragment()] = $has_authority;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAuthority(PhabricatorUser $viewer) {
|
|
|
|
$cache_fragment = $viewer->getCacheFragment();
|
|
|
|
return $this->assertAttachedKey($this->authority, $cache_fragment);
|
|
|
|
}
|
|
|
|
|
2017-03-13 19:31:57 +01:00
|
|
|
}
|