2013-07-03 20:15:45 +02:00
|
|
|
<?php
|
|
|
|
|
2014-01-17 20:40:26 +01:00
|
|
|
final class LegalpadDocumentSignature
|
|
|
|
extends LegalpadDAO
|
|
|
|
implements PhabricatorPolicyInterface {
|
2013-07-03 20:15:45 +02:00
|
|
|
|
2014-01-15 02:17:18 +01:00
|
|
|
const VERIFIED = 0;
|
|
|
|
const UNVERIFIED = 1;
|
|
|
|
|
2013-07-03 20:15:45 +02:00
|
|
|
protected $documentPHID;
|
2013-07-10 20:46:39 +02:00
|
|
|
protected $documentVersion;
|
2013-07-03 20:15:45 +02:00
|
|
|
protected $signerPHID;
|
2013-07-10 20:46:39 +02:00
|
|
|
protected $signatureData = array();
|
2014-01-15 02:17:18 +01:00
|
|
|
protected $verified;
|
|
|
|
protected $secretKey;
|
2013-07-10 20:46:39 +02:00
|
|
|
|
|
|
|
public function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_SERIALIZATION => array(
|
|
|
|
'signatureData' => self::SERIALIZATION_JSON,
|
|
|
|
),
|
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
2014-01-15 02:17:18 +01:00
|
|
|
public function save() {
|
|
|
|
if (!$this->getSecretKey()) {
|
|
|
|
$this->setSecretKey(Filesystem::readRandomCharacters(20));
|
|
|
|
}
|
|
|
|
return parent::save();
|
|
|
|
}
|
2013-07-10 20:46:39 +02:00
|
|
|
|
2014-01-15 02:17:18 +01:00
|
|
|
public function isVerified() {
|
|
|
|
return $this->getVerified() != self::UNVERIFIED;
|
|
|
|
}
|
2014-01-17 20:40:26 +01:00
|
|
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
|
|
|
|
|
|
|
public function getCapabilities() {
|
|
|
|
return array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPolicy($capability) {
|
|
|
|
switch ($capability) {
|
|
|
|
case PhabricatorPolicyCapability::CAN_VIEW:
|
|
|
|
return PhabricatorPolicies::POLICY_USER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function describeAutomaticCapability($capability) {
|
|
|
|
return null;
|
|
|
|
}
|
2013-07-03 20:15:45 +02:00
|
|
|
|
|
|
|
}
|