@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class NuanceImportCursorData
4 extends NuanceDAO
5 implements PhabricatorPolicyInterface {
6
7 protected $sourcePHID;
8 protected $cursorKey;
9 protected $cursorType;
10 protected $properties = array();
11
12 protected function getConfiguration() {
13 return array(
14 self::CONFIG_AUX_PHID => true,
15 self::CONFIG_SERIALIZATION => array(
16 'properties' => self::SERIALIZATION_JSON,
17 ),
18 self::CONFIG_COLUMN_SCHEMA => array(
19 'cursorType' => 'text32',
20 'cursorKey' => 'text32',
21 ),
22 self::CONFIG_KEY_SCHEMA => array(
23 'key_source' => array(
24 'columns' => array('sourcePHID', 'cursorKey'),
25 'unique' => true,
26 ),
27 ),
28 ) + parent::getConfiguration();
29 }
30
31 public function generatePHID() {
32 return PhabricatorPHID::generateNewPHID(
33 NuanceImportCursorPHIDType::TYPECONST);
34 }
35
36 public function getCursorProperty($key, $default = null) {
37 return idx($this->properties, $key, $default);
38 }
39
40 public function setCursorProperty($key, $value) {
41 $this->properties[$key] = $value;
42 return $this;
43 }
44
45
46/* -( PhabricatorPolicyInterface )----------------------------------------- */
47
48
49 public function getCapabilities() {
50 return array(
51 PhabricatorPolicyCapability::CAN_VIEW,
52 );
53 }
54
55 public function getPolicy($capability) {
56 switch ($capability) {
57 case PhabricatorPolicyCapability::CAN_VIEW:
58 return PhabricatorPolicies::POLICY_USER;
59 }
60 }
61
62 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
63 return false;
64 }
65
66}