~ubuntu-branches/ubuntu/wily/phabricator/wily

« back to all changes in this revision

Viewing changes to phabricator/src/applications/almanac/storage/AlmanacInterface.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2015-01-29 00:15:58 UTC
  • mfrom: (0.14.1) (0.13.1) (0.10.2) (2.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20150129001558-7qklhtcc043y9mog
Tags: 0~git20150129-1
* New snapshot release
* restricted access to local config file (closes: #775479)
* moved local config file to /var/lib/phabricator (closes: #775478)
* switched mysql-server dependency to recommends (closes: #773536)
* use /run instead of /var/run (closes: #775803)
* prevent package reinstall from overwritting local changes (closes: #776288)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
final class AlmanacInterface
4
4
  extends AlmanacDAO
5
 
  implements PhabricatorPolicyInterface {
 
5
  implements
 
6
    PhabricatorPolicyInterface,
 
7
    PhabricatorDestructibleInterface {
6
8
 
7
9
  protected $devicePHID;
8
10
  protected $networkPHID;
16
18
    return id(new AlmanacInterface());
17
19
  }
18
20
 
19
 
  public function getConfiguration() {
 
21
  protected function getConfiguration() {
20
22
    return array(
21
23
      self::CONFIG_AUX_PHID => true,
22
24
      self::CONFIG_COLUMN_SCHEMA => array(
92
94
  }
93
95
 
94
96
  public function describeAutomaticCapability($capability) {
95
 
    return array(
 
97
    $notes = array(
96
98
      pht('An interface inherits the policies of the device it belongs to.'),
97
99
      pht(
98
100
        'You must be able to view the network an interface resides on to '.
99
101
        'view the interface.'),
100
102
    );
 
103
 
 
104
    if ($capability === PhabricatorPolicyCapability::CAN_EDIT) {
 
105
      if ($this->getDevice()->getIsLocked()) {
 
106
        $notes[] = pht(
 
107
          'The device for this interface is locked, so it can not be edited.');
 
108
      }
 
109
    }
 
110
 
 
111
    return $notes;
 
112
  }
 
113
 
 
114
 
 
115
/* -(  PhabricatorDestructibleInterface  )----------------------------------- */
 
116
 
 
117
 
 
118
  public function destroyObjectPermanently(
 
119
    PhabricatorDestructionEngine $engine) {
 
120
 
 
121
    $bindings = id(new AlmanacBindingQuery())
 
122
      ->setViewer($this->getViewer())
 
123
      ->withInterfacePHIDs(array($this->getPHID()))
 
124
      ->execute();
 
125
    foreach ($bindings as $binding) {
 
126
      $engine->destroyObject($binding);
 
127
    }
 
128
 
 
129
    $this->delete();
101
130
  }
102
131
 
103
132
}