mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 19:02:41 +01:00
8c1c6fec5a
Summary: Ref T603. Fixes T2823. This updates Paste and Macro. - **Paste** - Added default view policy. - I didn't add a "create" policy, since I can't come up with any realistic scenario where you'd give users access to pastes but not let them create them. - **Macro** - Added a "manage" policy, which covers creating and editing macros. This lets an install only allow "People With An Approved Sense of Humor" or whatever to create macros. - Removed the "edit" policy, since giving individual users access to specific macros doesn't make much sense to me. - Changed the view policy to the "most public" policy the install allows. - Added view policy information to the header. Also fix a couple of minor things in Maniphest. Test Plan: - Set Paste policy, created pastes via web and Conduit, saw they got the right default policies. - Set Macro policy, tried to create/edit macros with valid and unauthorized users. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2823, T603 Differential Revision: https://secure.phabricator.com/D7317
83 lines
1.9 KiB
PHP
83 lines
1.9 KiB
PHP
<?php
|
|
|
|
final class PhabricatorFileImageMacro extends PhabricatorFileDAO
|
|
implements
|
|
PhabricatorSubscribableInterface,
|
|
PhabricatorApplicationTransactionInterface,
|
|
PhabricatorPolicyInterface {
|
|
|
|
protected $authorPHID;
|
|
protected $filePHID;
|
|
protected $name;
|
|
protected $isDisabled = 0;
|
|
protected $audioPHID;
|
|
protected $audioBehavior = self::AUDIO_BEHAVIOR_NONE;
|
|
|
|
private $file = self::ATTACHABLE;
|
|
private $audio = self::ATTACHABLE;
|
|
|
|
const AUDIO_BEHAVIOR_NONE = 'audio:none';
|
|
const AUDIO_BEHAVIOR_ONCE = 'audio:once';
|
|
const AUDIO_BEHAVIOR_LOOP = 'audio:loop';
|
|
|
|
public function attachFile(PhabricatorFile $file) {
|
|
$this->file = $file;
|
|
return $this;
|
|
}
|
|
|
|
public function getFile() {
|
|
return $this->assertAttached($this->file);
|
|
}
|
|
|
|
public function attachAudio(PhabricatorFile $audio = null) {
|
|
$this->audio = $audio;
|
|
return $this;
|
|
}
|
|
|
|
public function getAudio() {
|
|
return $this->assertAttached($this->audio);
|
|
}
|
|
|
|
public function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_AUX_PHID => true,
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public function generatePHID() {
|
|
return PhabricatorPHID::generateNewPHID(
|
|
PhabricatorMacroPHIDTypeMacro::TYPECONST);
|
|
}
|
|
|
|
public function isAutomaticallySubscribed($phid) {
|
|
return false;
|
|
}
|
|
|
|
public function getApplicationTransactionEditor() {
|
|
return new PhabricatorMacroEditor();
|
|
}
|
|
|
|
public function getApplicationTransactionObject() {
|
|
return new PhabricatorMacroTransaction();
|
|
}
|
|
|
|
public function getCapabilities() {
|
|
return array(
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
);
|
|
}
|
|
|
|
public function getPolicy($capability) {
|
|
return PhabricatorPolicies::getMostOpenPolicy();
|
|
}
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
|
return false;
|
|
}
|
|
|
|
public function describeAutomaticCapability($capability) {
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|