Page MenuHomePhorge

AlmanacServiceEditor.php
No OneTemporary

AlmanacServiceEditor.php

<?php
final class AlmanacServiceEditor
extends AlmanacEditor {
public function getEditorObjectsDescription() {
return pht('Almanac Service');
}
public function getCreateObjectTitle($author, $object) {
return pht('%s created this service.', $author);
}
public function getCreateObjectTitleForFeed($author, $object) {
return pht('%s created %s.', $author, $object);
}
public function getTransactionTypes() {
$types = parent::getTransactionTypes();
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
return $types;
}
protected function validateAllTransactions(
PhabricatorLiskDAO $object,
array $xactions) {
$errors = parent::validateAllTransactions($object, $xactions);
if ($object->isClusterService()) {
$can_manage = PhabricatorPolicyFilter::hasCapability(
$this->getActor(),
new PhabricatorAlmanacApplication(),
AlmanacManageClusterServicesCapability::CAPABILITY);
if (!$can_manage) {
$errors[] = new PhabricatorApplicationTransactionValidationError(
null,
pht('Restricted'),
pht('You do not have permission to manage cluster services.'),
null);
}
}
return $errors;
}
}

File Metadata

Mime Type
text/x-php
Expires
Jan 19 2025, 23:20 (6 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129835
Default Alt Text
AlmanacServiceEditor.php (1 KB)

Event Timeline