mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Conduit API: allow phriction.edit to modify viewPolicy and editPolicy
Summary: Closes T15858 Test Plan: See T15858 Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15858 Differential Revision: https://we.phorge.it/D25693
This commit is contained in:
parent
587530a9bf
commit
1f5c54c35a
3 changed files with 43 additions and 0 deletions
|
@ -5615,6 +5615,7 @@ phutil_register_library_map(array(
|
|||
'PhrictionDocumentDatasource' => 'applications/phriction/typeahead/PhrictionDocumentDatasource.php',
|
||||
'PhrictionDocumentDeleteTransaction' => 'applications/phriction/xaction/PhrictionDocumentDeleteTransaction.php',
|
||||
'PhrictionDocumentDraftTransaction' => 'applications/phriction/xaction/PhrictionDocumentDraftTransaction.php',
|
||||
'PhrictionDocumentEditConduitAPIMethod' => 'applications/phriction/conduit/PhrictionDocumentEditConduitAPIMethod.php',
|
||||
'PhrictionDocumentEditEngine' => 'applications/phriction/editor/PhrictionDocumentEditEngine.php',
|
||||
'PhrictionDocumentEditTransaction' => 'applications/phriction/xaction/PhrictionDocumentEditTransaction.php',
|
||||
'PhrictionDocumentFerretEngine' => 'applications/phriction/search/PhrictionDocumentFerretEngine.php',
|
||||
|
@ -12510,6 +12511,7 @@ phutil_register_library_map(array(
|
|||
'PhrictionDocumentDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||
'PhrictionDocumentDeleteTransaction' => 'PhrictionDocumentVersionTransaction',
|
||||
'PhrictionDocumentDraftTransaction' => 'PhrictionDocumentEditTransaction',
|
||||
'PhrictionDocumentEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
||||
'PhrictionDocumentEditEngine' => 'PhabricatorEditEngine',
|
||||
'PhrictionDocumentEditTransaction' => 'PhrictionDocumentVersionTransaction',
|
||||
'PhrictionDocumentFerretEngine' => 'PhabricatorFerretEngine',
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
final class PhrictionDocumentEditConduitAPIMethod
|
||||
extends PhabricatorEditEngineAPIMethod {
|
||||
|
||||
public function getAPIMethodName() {
|
||||
return 'phriction.document.edit';
|
||||
}
|
||||
|
||||
public function newEditEngine() {
|
||||
return new PhrictionDocumentEditEngine();
|
||||
}
|
||||
|
||||
public function getMethodSummary() {
|
||||
return pht(
|
||||
'Apply transactions to edit an existing phriction document.');
|
||||
}
|
||||
|
||||
}
|
|
@ -47,4 +47,26 @@ final class PhrictionDocumentPHIDType extends PhabricatorPHIDType {
|
|||
}
|
||||
}
|
||||
|
||||
public function canLoadNamedObject($name) {
|
||||
return preg_match('/.*\/$/', $name);
|
||||
}
|
||||
|
||||
public function loadNamedObjects(
|
||||
PhabricatorObjectQuery $query,
|
||||
array $names) {
|
||||
$objects = id(new PhrictionDocumentQuery())
|
||||
->setViewer($query->getViewer())
|
||||
->withSlugs($names)
|
||||
->execute();
|
||||
|
||||
$results = array();
|
||||
foreach ($objects as $id => $object) {
|
||||
foreach ($names as $name) {
|
||||
$results[$name] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue