@@ -33,46 +33,46 @@ |
||
| 33 | 33 | |
| 34 | 34 | class ContactsMenuController extends Controller { |
| 35 | 35 | |
| 36 | - /** @var Manager */ |
|
| 37 | - private $manager; |
|
| 36 | + /** @var Manager */ |
|
| 37 | + private $manager; |
|
| 38 | 38 | |
| 39 | - /** @var IUserSession */ |
|
| 40 | - private $userSession; |
|
| 39 | + /** @var IUserSession */ |
|
| 40 | + private $userSession; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @param IRequest $request |
|
| 44 | - * @param IUserSession $userSession |
|
| 45 | - * @param Manager $manager |
|
| 46 | - */ |
|
| 47 | - public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) { |
|
| 48 | - parent::__construct('core', $request); |
|
| 49 | - $this->userSession = $userSession; |
|
| 50 | - $this->manager = $manager; |
|
| 51 | - } |
|
| 42 | + /** |
|
| 43 | + * @param IRequest $request |
|
| 44 | + * @param IUserSession $userSession |
|
| 45 | + * @param Manager $manager |
|
| 46 | + */ |
|
| 47 | + public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) { |
|
| 48 | + parent::__construct('core', $request); |
|
| 49 | + $this->userSession = $userSession; |
|
| 50 | + $this->manager = $manager; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @NoAdminRequired |
|
| 55 | - * |
|
| 56 | - * @param string|null filter |
|
| 57 | - * @return \JsonSerializable[] |
|
| 58 | - */ |
|
| 59 | - public function index($filter = null) { |
|
| 60 | - return $this->manager->getEntries($this->userSession->getUser(), $filter); |
|
| 61 | - } |
|
| 53 | + /** |
|
| 54 | + * @NoAdminRequired |
|
| 55 | + * |
|
| 56 | + * @param string|null filter |
|
| 57 | + * @return \JsonSerializable[] |
|
| 58 | + */ |
|
| 59 | + public function index($filter = null) { |
|
| 60 | + return $this->manager->getEntries($this->userSession->getUser(), $filter); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @NoAdminRequired |
|
| 65 | - * |
|
| 66 | - * @param integer $shareType |
|
| 67 | - * @param string $shareWith |
|
| 68 | - * @return JSONResponse|\JsonSerializable |
|
| 69 | - */ |
|
| 70 | - public function findOne($shareType, $shareWith) { |
|
| 71 | - $contact = $this->manager->findOne($this->userSession->getUser(), $shareType, $shareWith); |
|
| 63 | + /** |
|
| 64 | + * @NoAdminRequired |
|
| 65 | + * |
|
| 66 | + * @param integer $shareType |
|
| 67 | + * @param string $shareWith |
|
| 68 | + * @return JSONResponse|\JsonSerializable |
|
| 69 | + */ |
|
| 70 | + public function findOne($shareType, $shareWith) { |
|
| 71 | + $contact = $this->manager->findOne($this->userSession->getUser(), $shareType, $shareWith); |
|
| 72 | 72 | |
| 73 | - if ($contact) { |
|
| 74 | - return $contact; |
|
| 75 | - } |
|
| 76 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 77 | - } |
|
| 73 | + if ($contact) { |
|
| 74 | + return $contact; |
|
| 75 | + } |
|
| 76 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | return [ |
| 24 | - 'routes' => [ |
|
| 25 | - ['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'], |
|
| 26 | - ] |
|
| 24 | + 'routes' => [ |
|
| 25 | + ['name' => 'Notifications#view', 'url' => '/notifications/view/{id}', 'verb' => 'GET'], |
|
| 26 | + ] |
|
| 27 | 27 | ]; |
@@ -31,129 +31,129 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | trait FrontendDefinitionTrait { |
| 33 | 33 | |
| 34 | - /** @var string human-readable mechanism name */ |
|
| 35 | - private $text; |
|
| 36 | - |
|
| 37 | - /** @var DefinitionParameter[] parameters for mechanism */ |
|
| 38 | - private $parameters = []; |
|
| 39 | - |
|
| 40 | - /** @var string[] custom JS */ |
|
| 41 | - private $customJs = []; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @return string |
|
| 45 | - */ |
|
| 46 | - public function getText() { |
|
| 47 | - return $this->text; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @param string $text |
|
| 52 | - * @return $this |
|
| 53 | - */ |
|
| 54 | - public function setText($text) { |
|
| 55 | - $this->text = $text; |
|
| 56 | - return $this; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @param FrontendDefinitionTrait $a |
|
| 61 | - * @param FrontendDefinitionTrait $b |
|
| 62 | - * @return int |
|
| 63 | - */ |
|
| 64 | - public static function lexicalCompare(FrontendDefinitionTrait $a, FrontendDefinitionTrait $b) { |
|
| 65 | - return strcmp($a->getText(), $b->getText()); |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @return DefinitionParameter[] |
|
| 70 | - */ |
|
| 71 | - public function getParameters() { |
|
| 72 | - return $this->parameters; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * @param DefinitionParameter[] $parameters |
|
| 77 | - * @return self |
|
| 78 | - */ |
|
| 79 | - public function addParameters(array $parameters) { |
|
| 80 | - foreach ($parameters as $parameter) { |
|
| 81 | - $this->addParameter($parameter); |
|
| 82 | - } |
|
| 83 | - return $this; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * @param DefinitionParameter $parameter |
|
| 88 | - * @return self |
|
| 89 | - */ |
|
| 90 | - public function addParameter(DefinitionParameter $parameter) { |
|
| 91 | - $this->parameters[$parameter->getName()] = $parameter; |
|
| 92 | - return $this; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @return string[] |
|
| 97 | - */ |
|
| 98 | - public function getCustomJs() { |
|
| 99 | - return $this->customJs; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @param string $custom |
|
| 104 | - * @return self |
|
| 105 | - */ |
|
| 106 | - public function addCustomJs($custom) { |
|
| 107 | - $this->customJs[] = $custom; |
|
| 108 | - return $this; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @param string $custom |
|
| 113 | - * @return self |
|
| 114 | - * @deprecated 9.1.0, use addCustomJs() instead |
|
| 115 | - */ |
|
| 116 | - public function setCustomJs($custom) { |
|
| 117 | - $this->customJs = [$custom]; |
|
| 118 | - return $this; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Serialize into JSON for client-side JS |
|
| 123 | - * |
|
| 124 | - * @return array |
|
| 125 | - */ |
|
| 126 | - public function jsonSerializeDefinition() { |
|
| 127 | - $configuration = []; |
|
| 128 | - foreach ($this->getParameters() as $parameter) { |
|
| 129 | - $configuration[$parameter->getName()] = $parameter; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - $data = [ |
|
| 133 | - 'name' => $this->getText(), |
|
| 134 | - 'configuration' => $configuration, |
|
| 135 | - 'custom' => $this->getCustomJs(), |
|
| 136 | - ]; |
|
| 137 | - return $data; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * Check if parameters are satisfied in a StorageConfig |
|
| 142 | - * |
|
| 143 | - * @param StorageConfig $storage |
|
| 144 | - * @return bool |
|
| 145 | - */ |
|
| 146 | - public function validateStorageDefinition(StorageConfig $storage) { |
|
| 147 | - foreach ($this->getParameters() as $name => $parameter) { |
|
| 148 | - $value = $storage->getBackendOption($name); |
|
| 149 | - if (!is_null($value) || !$parameter->isOptional()) { |
|
| 150 | - if (!$parameter->validateValue($value)) { |
|
| 151 | - return false; |
|
| 152 | - } |
|
| 153 | - $storage->setBackendOption($name, $value); |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - return true; |
|
| 157 | - } |
|
| 34 | + /** @var string human-readable mechanism name */ |
|
| 35 | + private $text; |
|
| 36 | + |
|
| 37 | + /** @var DefinitionParameter[] parameters for mechanism */ |
|
| 38 | + private $parameters = []; |
|
| 39 | + |
|
| 40 | + /** @var string[] custom JS */ |
|
| 41 | + private $customJs = []; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @return string |
|
| 45 | + */ |
|
| 46 | + public function getText() { |
|
| 47 | + return $this->text; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @param string $text |
|
| 52 | + * @return $this |
|
| 53 | + */ |
|
| 54 | + public function setText($text) { |
|
| 55 | + $this->text = $text; |
|
| 56 | + return $this; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @param FrontendDefinitionTrait $a |
|
| 61 | + * @param FrontendDefinitionTrait $b |
|
| 62 | + * @return int |
|
| 63 | + */ |
|
| 64 | + public static function lexicalCompare(FrontendDefinitionTrait $a, FrontendDefinitionTrait $b) { |
|
| 65 | + return strcmp($a->getText(), $b->getText()); |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @return DefinitionParameter[] |
|
| 70 | + */ |
|
| 71 | + public function getParameters() { |
|
| 72 | + return $this->parameters; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * @param DefinitionParameter[] $parameters |
|
| 77 | + * @return self |
|
| 78 | + */ |
|
| 79 | + public function addParameters(array $parameters) { |
|
| 80 | + foreach ($parameters as $parameter) { |
|
| 81 | + $this->addParameter($parameter); |
|
| 82 | + } |
|
| 83 | + return $this; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * @param DefinitionParameter $parameter |
|
| 88 | + * @return self |
|
| 89 | + */ |
|
| 90 | + public function addParameter(DefinitionParameter $parameter) { |
|
| 91 | + $this->parameters[$parameter->getName()] = $parameter; |
|
| 92 | + return $this; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @return string[] |
|
| 97 | + */ |
|
| 98 | + public function getCustomJs() { |
|
| 99 | + return $this->customJs; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @param string $custom |
|
| 104 | + * @return self |
|
| 105 | + */ |
|
| 106 | + public function addCustomJs($custom) { |
|
| 107 | + $this->customJs[] = $custom; |
|
| 108 | + return $this; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @param string $custom |
|
| 113 | + * @return self |
|
| 114 | + * @deprecated 9.1.0, use addCustomJs() instead |
|
| 115 | + */ |
|
| 116 | + public function setCustomJs($custom) { |
|
| 117 | + $this->customJs = [$custom]; |
|
| 118 | + return $this; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Serialize into JSON for client-side JS |
|
| 123 | + * |
|
| 124 | + * @return array |
|
| 125 | + */ |
|
| 126 | + public function jsonSerializeDefinition() { |
|
| 127 | + $configuration = []; |
|
| 128 | + foreach ($this->getParameters() as $parameter) { |
|
| 129 | + $configuration[$parameter->getName()] = $parameter; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + $data = [ |
|
| 133 | + 'name' => $this->getText(), |
|
| 134 | + 'configuration' => $configuration, |
|
| 135 | + 'custom' => $this->getCustomJs(), |
|
| 136 | + ]; |
|
| 137 | + return $data; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * Check if parameters are satisfied in a StorageConfig |
|
| 142 | + * |
|
| 143 | + * @param StorageConfig $storage |
|
| 144 | + * @return bool |
|
| 145 | + */ |
|
| 146 | + public function validateStorageDefinition(StorageConfig $storage) { |
|
| 147 | + foreach ($this->getParameters() as $name => $parameter) { |
|
| 148 | + $value = $storage->getBackendOption($name); |
|
| 149 | + if (!is_null($value) || !$parameter->isOptional()) { |
|
| 150 | + if (!$parameter->validateValue($value)) { |
|
| 151 | + return false; |
|
| 152 | + } |
|
| 153 | + $storage->setBackendOption($name, $value); |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + return true; |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | 159 | } |
@@ -29,15 +29,15 @@ |
||
| 29 | 29 | * Authentication mechanism or backend has insufficient data |
| 30 | 30 | */ |
| 31 | 31 | class InsufficientDataForMeaningfulAnswerException extends StorageNotAvailableException { |
| 32 | - /** |
|
| 33 | - * StorageNotAvailableException constructor. |
|
| 34 | - * |
|
| 35 | - * @param string $message |
|
| 36 | - * @param int $code |
|
| 37 | - * @param \Exception|null $previous |
|
| 38 | - * @since 6.0.0 |
|
| 39 | - */ |
|
| 40 | - public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) { |
|
| 41 | - parent::__construct($message, $code, $previous); |
|
| 42 | - } |
|
| 32 | + /** |
|
| 33 | + * StorageNotAvailableException constructor. |
|
| 34 | + * |
|
| 35 | + * @param string $message |
|
| 36 | + * @param int $code |
|
| 37 | + * @param \Exception|null $previous |
|
| 38 | + * @since 6.0.0 |
|
| 39 | + */ |
|
| 40 | + public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) { |
|
| 41 | + parent::__construct($message, $code, $previous); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -28,76 +28,76 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | trait IdentifierTrait { |
| 30 | 30 | |
| 31 | - /** @var string */ |
|
| 32 | - protected $identifier; |
|
| 31 | + /** @var string */ |
|
| 32 | + protected $identifier; |
|
| 33 | 33 | |
| 34 | - /** @var string[] */ |
|
| 35 | - protected $identifierAliases = []; |
|
| 34 | + /** @var string[] */ |
|
| 35 | + protected $identifierAliases = []; |
|
| 36 | 36 | |
| 37 | - /** @var IdentifierTrait */ |
|
| 38 | - protected $deprecateTo = null; |
|
| 37 | + /** @var IdentifierTrait */ |
|
| 38 | + protected $deprecateTo = null; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function getIdentifier() { |
|
| 44 | - return $this->identifier; |
|
| 45 | - } |
|
| 40 | + /** |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function getIdentifier() { |
|
| 44 | + return $this->identifier; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @param string $identifier |
|
| 49 | - * @return $this |
|
| 50 | - */ |
|
| 51 | - public function setIdentifier($identifier) { |
|
| 52 | - $this->identifier = $identifier; |
|
| 53 | - $this->identifierAliases[] = $identifier; |
|
| 54 | - return $this; |
|
| 55 | - } |
|
| 47 | + /** |
|
| 48 | + * @param string $identifier |
|
| 49 | + * @return $this |
|
| 50 | + */ |
|
| 51 | + public function setIdentifier($identifier) { |
|
| 52 | + $this->identifier = $identifier; |
|
| 53 | + $this->identifierAliases[] = $identifier; |
|
| 54 | + return $this; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @return string[] |
|
| 59 | - */ |
|
| 60 | - public function getIdentifierAliases() { |
|
| 61 | - return $this->identifierAliases; |
|
| 62 | - } |
|
| 57 | + /** |
|
| 58 | + * @return string[] |
|
| 59 | + */ |
|
| 60 | + public function getIdentifierAliases() { |
|
| 61 | + return $this->identifierAliases; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @param string $alias |
|
| 66 | - * @return $this |
|
| 67 | - */ |
|
| 68 | - public function addIdentifierAlias($alias) { |
|
| 69 | - $this->identifierAliases[] = $alias; |
|
| 70 | - return $this; |
|
| 71 | - } |
|
| 64 | + /** |
|
| 65 | + * @param string $alias |
|
| 66 | + * @return $this |
|
| 67 | + */ |
|
| 68 | + public function addIdentifierAlias($alias) { |
|
| 69 | + $this->identifierAliases[] = $alias; |
|
| 70 | + return $this; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @return object|null |
|
| 75 | - */ |
|
| 76 | - public function getDeprecateTo() { |
|
| 77 | - return $this->deprecateTo; |
|
| 78 | - } |
|
| 73 | + /** |
|
| 74 | + * @return object|null |
|
| 75 | + */ |
|
| 76 | + public function getDeprecateTo() { |
|
| 77 | + return $this->deprecateTo; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @param object $destinationObject |
|
| 82 | - * @return self |
|
| 83 | - */ |
|
| 84 | - public function deprecateTo($destinationObject) { |
|
| 85 | - $this->deprecateTo = $destinationObject; |
|
| 86 | - return $this; |
|
| 87 | - } |
|
| 80 | + /** |
|
| 81 | + * @param object $destinationObject |
|
| 82 | + * @return self |
|
| 83 | + */ |
|
| 84 | + public function deprecateTo($destinationObject) { |
|
| 85 | + $this->deprecateTo = $destinationObject; |
|
| 86 | + return $this; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @return array |
|
| 91 | - */ |
|
| 92 | - public function jsonSerializeIdentifier() { |
|
| 93 | - $data = [ |
|
| 94 | - 'identifier' => $this->identifier, |
|
| 95 | - 'identifierAliases' => $this->identifierAliases, |
|
| 96 | - ]; |
|
| 97 | - if ($this->deprecateTo) { |
|
| 98 | - $data['deprecateTo'] = $this->deprecateTo->getIdentifier(); |
|
| 99 | - } |
|
| 100 | - return $data; |
|
| 101 | - } |
|
| 89 | + /** |
|
| 90 | + * @return array |
|
| 91 | + */ |
|
| 92 | + public function jsonSerializeIdentifier() { |
|
| 93 | + $data = [ |
|
| 94 | + 'identifier' => $this->identifier, |
|
| 95 | + 'identifierAliases' => $this->identifierAliases, |
|
| 96 | + ]; |
|
| 97 | + if ($this->deprecateTo) { |
|
| 98 | + $data['deprecateTo'] = $this->deprecateTo->getIdentifier(); |
|
| 99 | + } |
|
| 100 | + return $data; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | 103 | } |
@@ -128,32 +128,32 @@ discard block |
||
| 128 | 128 | $authBackend = $this->backendService->getAuthMechanism($authIdentifier); |
| 129 | 129 | |
| 130 | 130 | if (!Filesystem::isValidPath($mountPoint)) { |
| 131 | - $output->writeln('<error>Invalid mountpoint "' . $mountPoint . '"</error>'); |
|
| 131 | + $output->writeln('<error>Invalid mountpoint "'.$mountPoint.'"</error>'); |
|
| 132 | 132 | return 1; |
| 133 | 133 | } |
| 134 | 134 | if (is_null($storageBackend)) { |
| 135 | - $output->writeln('<error>Storage backend with identifier "' . $storageIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
| 135 | + $output->writeln('<error>Storage backend with identifier "'.$storageIdentifier.'" not found (see `occ files_external:backends` for possible values)</error>'); |
|
| 136 | 136 | return 404; |
| 137 | 137 | } |
| 138 | 138 | if (is_null($authBackend)) { |
| 139 | - $output->writeln('<error>Authentication backend with identifier "' . $authIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
| 139 | + $output->writeln('<error>Authentication backend with identifier "'.$authIdentifier.'" not found (see `occ files_external:backends` for possible values)</error>'); |
|
| 140 | 140 | return 404; |
| 141 | 141 | } |
| 142 | 142 | $supportedSchemes = array_keys($storageBackend->getAuthSchemes()); |
| 143 | 143 | if (!in_array($authBackend->getScheme(), $supportedSchemes)) { |
| 144 | - $output->writeln('<error>Authentication backend "' . $authIdentifier . '" not valid for storage backend "' . $storageIdentifier . '" (see `occ files_external:backends storage ' . $storageIdentifier . '` for possible values)</error>'); |
|
| 144 | + $output->writeln('<error>Authentication backend "'.$authIdentifier.'" not valid for storage backend "'.$storageIdentifier.'" (see `occ files_external:backends storage '.$storageIdentifier.'` for possible values)</error>'); |
|
| 145 | 145 | return 1; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | $config = []; |
| 149 | 149 | foreach ($configInput as $configOption) { |
| 150 | 150 | if (!strpos($configOption, '=')) { |
| 151 | - $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
| 151 | + $output->writeln('<error>Invalid mount configuration option "'.$configOption.'"</error>'); |
|
| 152 | 152 | return 1; |
| 153 | 153 | } |
| 154 | 154 | list($key, $value) = explode('=', $configOption, 2); |
| 155 | 155 | if (!$this->validateParam($key, $value, $storageBackend, $authBackend)) { |
| 156 | - $output->writeln('<error>Unknown configuration for backends "' . $key . '"</error>'); |
|
| 156 | + $output->writeln('<error>Unknown configuration for backends "'.$key.'"</error>'); |
|
| 157 | 157 | return 1; |
| 158 | 158 | } |
| 159 | 159 | $config[$key] = $value; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | if ($user) { |
| 169 | 169 | if (!$this->userManager->userExists($user)) { |
| 170 | - $output->writeln('<error>User "' . $user . '" not found</error>'); |
|
| 170 | + $output->writeln('<error>User "'.$user.'" not found</error>'); |
|
| 171 | 171 | return 1; |
| 172 | 172 | } |
| 173 | 173 | $mount->setApplicableUsers([$user]); |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | } else { |
| 179 | 179 | $this->getStorageService($user)->addStorage($mount); |
| 180 | 180 | if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { |
| 181 | - $output->writeln('<info>Storage created with id ' . $mount->getId() . '</info>'); |
|
| 181 | + $output->writeln('<info>Storage created with id '.$mount->getId().'</info>'); |
|
| 182 | 182 | } else { |
| 183 | - $output->writeln((string)$mount->getId()); |
|
| 183 | + $output->writeln((string) $mount->getId()); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | return 0; |
@@ -43,182 +43,182 @@ |
||
| 43 | 43 | use Symfony\Component\Console\Output\OutputInterface; |
| 44 | 44 | |
| 45 | 45 | class Create extends Base { |
| 46 | - /** |
|
| 47 | - * @var GlobalStoragesService |
|
| 48 | - */ |
|
| 49 | - private $globalService; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * @var UserStoragesService |
|
| 53 | - */ |
|
| 54 | - private $userService; |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * @var IUserManager |
|
| 58 | - */ |
|
| 59 | - private $userManager; |
|
| 60 | - |
|
| 61 | - /** @var BackendService */ |
|
| 62 | - private $backendService; |
|
| 63 | - |
|
| 64 | - /** @var IUserSession */ |
|
| 65 | - private $userSession; |
|
| 66 | - |
|
| 67 | - public function __construct(GlobalStoragesService $globalService, |
|
| 68 | - UserStoragesService $userService, |
|
| 69 | - IUserManager $userManager, |
|
| 70 | - IUserSession $userSession, |
|
| 71 | - BackendService $backendService |
|
| 72 | - ) { |
|
| 73 | - parent::__construct(); |
|
| 74 | - $this->globalService = $globalService; |
|
| 75 | - $this->userService = $userService; |
|
| 76 | - $this->userManager = $userManager; |
|
| 77 | - $this->userSession = $userSession; |
|
| 78 | - $this->backendService = $backendService; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - protected function configure() { |
|
| 82 | - $this |
|
| 83 | - ->setName('files_external:create') |
|
| 84 | - ->setDescription('Create a new mount configuration') |
|
| 85 | - ->addOption( |
|
| 86 | - 'user', |
|
| 87 | - '', |
|
| 88 | - InputOption::VALUE_OPTIONAL, |
|
| 89 | - 'user to add the mount configuration for, if not set the mount will be added as system mount' |
|
| 90 | - ) |
|
| 91 | - ->addArgument( |
|
| 92 | - 'mount_point', |
|
| 93 | - InputArgument::REQUIRED, |
|
| 94 | - 'mount point for the new mount' |
|
| 95 | - ) |
|
| 96 | - ->addArgument( |
|
| 97 | - 'storage_backend', |
|
| 98 | - InputArgument::REQUIRED, |
|
| 99 | - 'storage backend identifier for the new mount, see `occ files_external:backends` for possible values' |
|
| 100 | - ) |
|
| 101 | - ->addArgument( |
|
| 102 | - 'authentication_backend', |
|
| 103 | - InputArgument::REQUIRED, |
|
| 104 | - 'authentication backend identifier for the new mount, see `occ files_external:backends` for possible values' |
|
| 105 | - ) |
|
| 106 | - ->addOption( |
|
| 107 | - 'config', |
|
| 108 | - 'c', |
|
| 109 | - InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
|
| 110 | - 'Mount configuration option in key=value format' |
|
| 111 | - ) |
|
| 112 | - ->addOption( |
|
| 113 | - 'dry', |
|
| 114 | - '', |
|
| 115 | - InputOption::VALUE_NONE, |
|
| 116 | - 'Don\'t save the created mount, only list the new mount' |
|
| 117 | - ); |
|
| 118 | - parent::configure(); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 122 | - $user = $input->getOption('user'); |
|
| 123 | - $mountPoint = $input->getArgument('mount_point'); |
|
| 124 | - $storageIdentifier = $input->getArgument('storage_backend'); |
|
| 125 | - $authIdentifier = $input->getArgument('authentication_backend'); |
|
| 126 | - $configInput = $input->getOption('config'); |
|
| 127 | - |
|
| 128 | - $storageBackend = $this->backendService->getBackend($storageIdentifier); |
|
| 129 | - $authBackend = $this->backendService->getAuthMechanism($authIdentifier); |
|
| 130 | - |
|
| 131 | - if (!Filesystem::isValidPath($mountPoint)) { |
|
| 132 | - $output->writeln('<error>Invalid mountpoint "' . $mountPoint . '"</error>'); |
|
| 133 | - return 1; |
|
| 134 | - } |
|
| 135 | - if (is_null($storageBackend)) { |
|
| 136 | - $output->writeln('<error>Storage backend with identifier "' . $storageIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
| 137 | - return 404; |
|
| 138 | - } |
|
| 139 | - if (is_null($authBackend)) { |
|
| 140 | - $output->writeln('<error>Authentication backend with identifier "' . $authIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
| 141 | - return 404; |
|
| 142 | - } |
|
| 143 | - $supportedSchemes = array_keys($storageBackend->getAuthSchemes()); |
|
| 144 | - if (!in_array($authBackend->getScheme(), $supportedSchemes)) { |
|
| 145 | - $output->writeln('<error>Authentication backend "' . $authIdentifier . '" not valid for storage backend "' . $storageIdentifier . '" (see `occ files_external:backends storage ' . $storageIdentifier . '` for possible values)</error>'); |
|
| 146 | - return 1; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - $config = []; |
|
| 150 | - foreach ($configInput as $configOption) { |
|
| 151 | - if (!strpos($configOption, '=')) { |
|
| 152 | - $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
| 153 | - return 1; |
|
| 154 | - } |
|
| 155 | - list($key, $value) = explode('=', $configOption, 2); |
|
| 156 | - if (!$this->validateParam($key, $value, $storageBackend, $authBackend)) { |
|
| 157 | - $output->writeln('<error>Unknown configuration for backends "' . $key . '"</error>'); |
|
| 158 | - return 1; |
|
| 159 | - } |
|
| 160 | - $config[$key] = $value; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - $mount = new StorageConfig(); |
|
| 164 | - $mount->setMountPoint($mountPoint); |
|
| 165 | - $mount->setBackend($storageBackend); |
|
| 166 | - $mount->setAuthMechanism($authBackend); |
|
| 167 | - $mount->setBackendOptions($config); |
|
| 168 | - |
|
| 169 | - if ($user) { |
|
| 170 | - if (!$this->userManager->userExists($user)) { |
|
| 171 | - $output->writeln('<error>User "' . $user . '" not found</error>'); |
|
| 172 | - return 1; |
|
| 173 | - } |
|
| 174 | - $mount->setApplicableUsers([$user]); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - if ($input->getOption('dry')) { |
|
| 178 | - $this->showMount($user, $mount, $input, $output); |
|
| 179 | - } else { |
|
| 180 | - $this->getStorageService($user)->addStorage($mount); |
|
| 181 | - if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { |
|
| 182 | - $output->writeln('<info>Storage created with id ' . $mount->getId() . '</info>'); |
|
| 183 | - } else { |
|
| 184 | - $output->writeln((string)$mount->getId()); |
|
| 185 | - } |
|
| 186 | - } |
|
| 187 | - return 0; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - private function validateParam($key, &$value, Backend $storageBackend, AuthMechanism $authBackend) { |
|
| 191 | - $params = array_merge($storageBackend->getParameters(), $authBackend->getParameters()); |
|
| 192 | - foreach ($params as $param) { |
|
| 193 | - /** @var DefinitionParameter $param */ |
|
| 194 | - if ($param->getName() === $key) { |
|
| 195 | - if ($param->getType() === DefinitionParameter::VALUE_BOOLEAN) { |
|
| 196 | - $value = ($value === 'true'); |
|
| 197 | - } |
|
| 198 | - return true; |
|
| 199 | - } |
|
| 200 | - } |
|
| 201 | - return false; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - private function showMount($user, StorageConfig $mount, InputInterface $input, OutputInterface $output) { |
|
| 205 | - $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
| 206 | - $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
| 207 | - $listInput->setOption('output', $input->getOption('output')); |
|
| 208 | - $listInput->setOption('show-password', true); |
|
| 209 | - $listCommand->listMounts($user, [$mount], $listInput, $output); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - protected function getStorageService($userId) { |
|
| 213 | - if (!empty($userId)) { |
|
| 214 | - $user = $this->userManager->get($userId); |
|
| 215 | - if (is_null($user)) { |
|
| 216 | - throw new NoUserException("user $userId not found"); |
|
| 217 | - } |
|
| 218 | - $this->userSession->setUser($user); |
|
| 219 | - return $this->userService; |
|
| 220 | - } else { |
|
| 221 | - return $this->globalService; |
|
| 222 | - } |
|
| 223 | - } |
|
| 46 | + /** |
|
| 47 | + * @var GlobalStoragesService |
|
| 48 | + */ |
|
| 49 | + private $globalService; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @var UserStoragesService |
|
| 53 | + */ |
|
| 54 | + private $userService; |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * @var IUserManager |
|
| 58 | + */ |
|
| 59 | + private $userManager; |
|
| 60 | + |
|
| 61 | + /** @var BackendService */ |
|
| 62 | + private $backendService; |
|
| 63 | + |
|
| 64 | + /** @var IUserSession */ |
|
| 65 | + private $userSession; |
|
| 66 | + |
|
| 67 | + public function __construct(GlobalStoragesService $globalService, |
|
| 68 | + UserStoragesService $userService, |
|
| 69 | + IUserManager $userManager, |
|
| 70 | + IUserSession $userSession, |
|
| 71 | + BackendService $backendService |
|
| 72 | + ) { |
|
| 73 | + parent::__construct(); |
|
| 74 | + $this->globalService = $globalService; |
|
| 75 | + $this->userService = $userService; |
|
| 76 | + $this->userManager = $userManager; |
|
| 77 | + $this->userSession = $userSession; |
|
| 78 | + $this->backendService = $backendService; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + protected function configure() { |
|
| 82 | + $this |
|
| 83 | + ->setName('files_external:create') |
|
| 84 | + ->setDescription('Create a new mount configuration') |
|
| 85 | + ->addOption( |
|
| 86 | + 'user', |
|
| 87 | + '', |
|
| 88 | + InputOption::VALUE_OPTIONAL, |
|
| 89 | + 'user to add the mount configuration for, if not set the mount will be added as system mount' |
|
| 90 | + ) |
|
| 91 | + ->addArgument( |
|
| 92 | + 'mount_point', |
|
| 93 | + InputArgument::REQUIRED, |
|
| 94 | + 'mount point for the new mount' |
|
| 95 | + ) |
|
| 96 | + ->addArgument( |
|
| 97 | + 'storage_backend', |
|
| 98 | + InputArgument::REQUIRED, |
|
| 99 | + 'storage backend identifier for the new mount, see `occ files_external:backends` for possible values' |
|
| 100 | + ) |
|
| 101 | + ->addArgument( |
|
| 102 | + 'authentication_backend', |
|
| 103 | + InputArgument::REQUIRED, |
|
| 104 | + 'authentication backend identifier for the new mount, see `occ files_external:backends` for possible values' |
|
| 105 | + ) |
|
| 106 | + ->addOption( |
|
| 107 | + 'config', |
|
| 108 | + 'c', |
|
| 109 | + InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
|
| 110 | + 'Mount configuration option in key=value format' |
|
| 111 | + ) |
|
| 112 | + ->addOption( |
|
| 113 | + 'dry', |
|
| 114 | + '', |
|
| 115 | + InputOption::VALUE_NONE, |
|
| 116 | + 'Don\'t save the created mount, only list the new mount' |
|
| 117 | + ); |
|
| 118 | + parent::configure(); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 122 | + $user = $input->getOption('user'); |
|
| 123 | + $mountPoint = $input->getArgument('mount_point'); |
|
| 124 | + $storageIdentifier = $input->getArgument('storage_backend'); |
|
| 125 | + $authIdentifier = $input->getArgument('authentication_backend'); |
|
| 126 | + $configInput = $input->getOption('config'); |
|
| 127 | + |
|
| 128 | + $storageBackend = $this->backendService->getBackend($storageIdentifier); |
|
| 129 | + $authBackend = $this->backendService->getAuthMechanism($authIdentifier); |
|
| 130 | + |
|
| 131 | + if (!Filesystem::isValidPath($mountPoint)) { |
|
| 132 | + $output->writeln('<error>Invalid mountpoint "' . $mountPoint . '"</error>'); |
|
| 133 | + return 1; |
|
| 134 | + } |
|
| 135 | + if (is_null($storageBackend)) { |
|
| 136 | + $output->writeln('<error>Storage backend with identifier "' . $storageIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
| 137 | + return 404; |
|
| 138 | + } |
|
| 139 | + if (is_null($authBackend)) { |
|
| 140 | + $output->writeln('<error>Authentication backend with identifier "' . $authIdentifier . '" not found (see `occ files_external:backends` for possible values)</error>'); |
|
| 141 | + return 404; |
|
| 142 | + } |
|
| 143 | + $supportedSchemes = array_keys($storageBackend->getAuthSchemes()); |
|
| 144 | + if (!in_array($authBackend->getScheme(), $supportedSchemes)) { |
|
| 145 | + $output->writeln('<error>Authentication backend "' . $authIdentifier . '" not valid for storage backend "' . $storageIdentifier . '" (see `occ files_external:backends storage ' . $storageIdentifier . '` for possible values)</error>'); |
|
| 146 | + return 1; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + $config = []; |
|
| 150 | + foreach ($configInput as $configOption) { |
|
| 151 | + if (!strpos($configOption, '=')) { |
|
| 152 | + $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); |
|
| 153 | + return 1; |
|
| 154 | + } |
|
| 155 | + list($key, $value) = explode('=', $configOption, 2); |
|
| 156 | + if (!$this->validateParam($key, $value, $storageBackend, $authBackend)) { |
|
| 157 | + $output->writeln('<error>Unknown configuration for backends "' . $key . '"</error>'); |
|
| 158 | + return 1; |
|
| 159 | + } |
|
| 160 | + $config[$key] = $value; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + $mount = new StorageConfig(); |
|
| 164 | + $mount->setMountPoint($mountPoint); |
|
| 165 | + $mount->setBackend($storageBackend); |
|
| 166 | + $mount->setAuthMechanism($authBackend); |
|
| 167 | + $mount->setBackendOptions($config); |
|
| 168 | + |
|
| 169 | + if ($user) { |
|
| 170 | + if (!$this->userManager->userExists($user)) { |
|
| 171 | + $output->writeln('<error>User "' . $user . '" not found</error>'); |
|
| 172 | + return 1; |
|
| 173 | + } |
|
| 174 | + $mount->setApplicableUsers([$user]); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + if ($input->getOption('dry')) { |
|
| 178 | + $this->showMount($user, $mount, $input, $output); |
|
| 179 | + } else { |
|
| 180 | + $this->getStorageService($user)->addStorage($mount); |
|
| 181 | + if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { |
|
| 182 | + $output->writeln('<info>Storage created with id ' . $mount->getId() . '</info>'); |
|
| 183 | + } else { |
|
| 184 | + $output->writeln((string)$mount->getId()); |
|
| 185 | + } |
|
| 186 | + } |
|
| 187 | + return 0; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + private function validateParam($key, &$value, Backend $storageBackend, AuthMechanism $authBackend) { |
|
| 191 | + $params = array_merge($storageBackend->getParameters(), $authBackend->getParameters()); |
|
| 192 | + foreach ($params as $param) { |
|
| 193 | + /** @var DefinitionParameter $param */ |
|
| 194 | + if ($param->getName() === $key) { |
|
| 195 | + if ($param->getType() === DefinitionParameter::VALUE_BOOLEAN) { |
|
| 196 | + $value = ($value === 'true'); |
|
| 197 | + } |
|
| 198 | + return true; |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | + return false; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + private function showMount($user, StorageConfig $mount, InputInterface $input, OutputInterface $output) { |
|
| 205 | + $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
| 206 | + $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
| 207 | + $listInput->setOption('output', $input->getOption('output')); |
|
| 208 | + $listInput->setOption('show-password', true); |
|
| 209 | + $listCommand->listMounts($user, [$mount], $listInput, $output); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + protected function getStorageService($userId) { |
|
| 213 | + if (!empty($userId)) { |
|
| 214 | + $user = $this->userManager->get($userId); |
|
| 215 | + if (is_null($user)) { |
|
| 216 | + throw new NoUserException("user $userId not found"); |
|
| 217 | + } |
|
| 218 | + $this->userSession->setUser($user); |
|
| 219 | + return $this->userService; |
|
| 220 | + } else { |
|
| 221 | + return $this->globalService; |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | 224 | } |
@@ -21,62 +21,62 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | return [ |
| 24 | - 'routes' => [ |
|
| 25 | - [ |
|
| 26 | - 'name' => 'RateLimitTest#userAndAnonProtected', |
|
| 27 | - 'url' => '/userAndAnonProtected', |
|
| 28 | - 'verb' => 'GET', |
|
| 29 | - ], |
|
| 30 | - [ |
|
| 31 | - 'name' => 'RateLimitTest#onlyAnonProtected', |
|
| 32 | - 'url' => '/anonProtected', |
|
| 33 | - 'verb' => 'GET', |
|
| 34 | - ], |
|
| 35 | - ], |
|
| 24 | + 'routes' => [ |
|
| 25 | + [ |
|
| 26 | + 'name' => 'RateLimitTest#userAndAnonProtected', |
|
| 27 | + 'url' => '/userAndAnonProtected', |
|
| 28 | + 'verb' => 'GET', |
|
| 29 | + ], |
|
| 30 | + [ |
|
| 31 | + 'name' => 'RateLimitTest#onlyAnonProtected', |
|
| 32 | + 'url' => '/anonProtected', |
|
| 33 | + 'verb' => 'GET', |
|
| 34 | + ], |
|
| 35 | + ], |
|
| 36 | 36 | |
| 37 | - 'ocs' => [ |
|
| 38 | - [ |
|
| 39 | - 'name' => 'Config#setAppValue', |
|
| 40 | - 'url' => '/api/v1/app/{appid}/{configkey}', |
|
| 41 | - 'verb' => 'POST', |
|
| 42 | - ], |
|
| 43 | - [ |
|
| 44 | - 'name' => 'Config#deleteAppValue', |
|
| 45 | - 'url' => '/api/v1/app/{appid}/{configkey}', |
|
| 46 | - 'verb' => 'DELETE', |
|
| 47 | - ], |
|
| 48 | - [ |
|
| 49 | - 'name' => 'Locking#isLockingEnabled', |
|
| 50 | - 'url' => '/api/v1/lockprovisioning', |
|
| 51 | - 'verb' => 'GET', |
|
| 52 | - ], |
|
| 53 | - [ |
|
| 54 | - 'name' => 'Locking#isLocked', |
|
| 55 | - 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
| 56 | - 'verb' => 'GET', |
|
| 57 | - ], |
|
| 58 | - [ |
|
| 59 | - 'name' => 'Locking#acquireLock', |
|
| 60 | - 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
| 61 | - 'verb' => 'POST', |
|
| 62 | - ], |
|
| 63 | - [ |
|
| 64 | - 'name' => 'Locking#changeLock', |
|
| 65 | - 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
| 66 | - 'verb' => 'PUT', |
|
| 67 | - ], |
|
| 68 | - [ |
|
| 69 | - 'name' => 'Locking#releaseLock', |
|
| 70 | - 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
| 71 | - 'verb' => 'DELETE', |
|
| 72 | - ], |
|
| 73 | - [ |
|
| 74 | - 'name' => 'Locking#releaseAll', |
|
| 75 | - 'url' => '/api/v1/lockprovisioning/{type}', |
|
| 76 | - 'verb' => 'DELETE', |
|
| 77 | - 'defaults' => [ |
|
| 78 | - 'type' => null |
|
| 79 | - ] |
|
| 80 | - ], |
|
| 81 | - ], |
|
| 37 | + 'ocs' => [ |
|
| 38 | + [ |
|
| 39 | + 'name' => 'Config#setAppValue', |
|
| 40 | + 'url' => '/api/v1/app/{appid}/{configkey}', |
|
| 41 | + 'verb' => 'POST', |
|
| 42 | + ], |
|
| 43 | + [ |
|
| 44 | + 'name' => 'Config#deleteAppValue', |
|
| 45 | + 'url' => '/api/v1/app/{appid}/{configkey}', |
|
| 46 | + 'verb' => 'DELETE', |
|
| 47 | + ], |
|
| 48 | + [ |
|
| 49 | + 'name' => 'Locking#isLockingEnabled', |
|
| 50 | + 'url' => '/api/v1/lockprovisioning', |
|
| 51 | + 'verb' => 'GET', |
|
| 52 | + ], |
|
| 53 | + [ |
|
| 54 | + 'name' => 'Locking#isLocked', |
|
| 55 | + 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
| 56 | + 'verb' => 'GET', |
|
| 57 | + ], |
|
| 58 | + [ |
|
| 59 | + 'name' => 'Locking#acquireLock', |
|
| 60 | + 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
| 61 | + 'verb' => 'POST', |
|
| 62 | + ], |
|
| 63 | + [ |
|
| 64 | + 'name' => 'Locking#changeLock', |
|
| 65 | + 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
| 66 | + 'verb' => 'PUT', |
|
| 67 | + ], |
|
| 68 | + [ |
|
| 69 | + 'name' => 'Locking#releaseLock', |
|
| 70 | + 'url' => '/api/v1/lockprovisioning/{type}/{user}', |
|
| 71 | + 'verb' => 'DELETE', |
|
| 72 | + ], |
|
| 73 | + [ |
|
| 74 | + 'name' => 'Locking#releaseAll', |
|
| 75 | + 'url' => '/api/v1/lockprovisioning/{type}', |
|
| 76 | + 'verb' => 'DELETE', |
|
| 77 | + 'defaults' => [ |
|
| 78 | + 'type' => null |
|
| 79 | + ] |
|
| 80 | + ], |
|
| 81 | + ], |
|
| 82 | 82 | ]; |
@@ -36,91 +36,91 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | interface IRouter { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Get the files to load the routes from |
|
| 41 | - * |
|
| 42 | - * @return string[] |
|
| 43 | - * @since 7.0.0 |
|
| 44 | - * @deprecated 9.0.0 |
|
| 45 | - */ |
|
| 46 | - public function getRoutingFiles(); |
|
| 39 | + /** |
|
| 40 | + * Get the files to load the routes from |
|
| 41 | + * |
|
| 42 | + * @return string[] |
|
| 43 | + * @since 7.0.0 |
|
| 44 | + * @deprecated 9.0.0 |
|
| 45 | + */ |
|
| 46 | + public function getRoutingFiles(); |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @return string |
|
| 50 | - * @since 7.0.0 |
|
| 51 | - * @deprecated 9.0.0 |
|
| 52 | - */ |
|
| 53 | - public function getCacheKey(); |
|
| 48 | + /** |
|
| 49 | + * @return string |
|
| 50 | + * @since 7.0.0 |
|
| 51 | + * @deprecated 9.0.0 |
|
| 52 | + */ |
|
| 53 | + public function getCacheKey(); |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Loads the routes |
|
| 57 | - * |
|
| 58 | - * @param null|string $app |
|
| 59 | - * @since 7.0.0 |
|
| 60 | - * @deprecated 9.0.0 |
|
| 61 | - */ |
|
| 62 | - public function loadRoutes($app = null); |
|
| 55 | + /** |
|
| 56 | + * Loads the routes |
|
| 57 | + * |
|
| 58 | + * @param null|string $app |
|
| 59 | + * @since 7.0.0 |
|
| 60 | + * @deprecated 9.0.0 |
|
| 61 | + */ |
|
| 62 | + public function loadRoutes($app = null); |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Sets the collection to use for adding routes |
|
| 66 | - * |
|
| 67 | - * @param string $name Name of the collection to use. |
|
| 68 | - * @return void |
|
| 69 | - * @since 7.0.0 |
|
| 70 | - * @deprecated 9.0.0 |
|
| 71 | - */ |
|
| 72 | - public function useCollection($name); |
|
| 64 | + /** |
|
| 65 | + * Sets the collection to use for adding routes |
|
| 66 | + * |
|
| 67 | + * @param string $name Name of the collection to use. |
|
| 68 | + * @return void |
|
| 69 | + * @since 7.0.0 |
|
| 70 | + * @deprecated 9.0.0 |
|
| 71 | + */ |
|
| 72 | + public function useCollection($name); |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * returns the current collection name in use for adding routes |
|
| 76 | - * |
|
| 77 | - * @return string the collection name |
|
| 78 | - * @since 8.0.0 |
|
| 79 | - * @deprecated 9.0.0 |
|
| 80 | - */ |
|
| 81 | - public function getCurrentCollection(); |
|
| 74 | + /** |
|
| 75 | + * returns the current collection name in use for adding routes |
|
| 76 | + * |
|
| 77 | + * @return string the collection name |
|
| 78 | + * @since 8.0.0 |
|
| 79 | + * @deprecated 9.0.0 |
|
| 80 | + */ |
|
| 81 | + public function getCurrentCollection(); |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Create a \OCP\Route\IRoute. |
|
| 85 | - * |
|
| 86 | - * @param string $name Name of the route to create. |
|
| 87 | - * @param string $pattern The pattern to match |
|
| 88 | - * @param array $defaults An array of default parameter values |
|
| 89 | - * @param array $requirements An array of requirements for parameters (regexes) |
|
| 90 | - * @return \OCP\Route\IRoute |
|
| 91 | - * @since 7.0.0 |
|
| 92 | - * @deprecated 9.0.0 |
|
| 93 | - */ |
|
| 94 | - public function create($name, $pattern, array $defaults = [], array $requirements = []); |
|
| 83 | + /** |
|
| 84 | + * Create a \OCP\Route\IRoute. |
|
| 85 | + * |
|
| 86 | + * @param string $name Name of the route to create. |
|
| 87 | + * @param string $pattern The pattern to match |
|
| 88 | + * @param array $defaults An array of default parameter values |
|
| 89 | + * @param array $requirements An array of requirements for parameters (regexes) |
|
| 90 | + * @return \OCP\Route\IRoute |
|
| 91 | + * @since 7.0.0 |
|
| 92 | + * @deprecated 9.0.0 |
|
| 93 | + */ |
|
| 94 | + public function create($name, $pattern, array $defaults = [], array $requirements = []); |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Find the route matching $url. |
|
| 98 | - * |
|
| 99 | - * @param string $url The url to find |
|
| 100 | - * @throws \Exception |
|
| 101 | - * @return void |
|
| 102 | - * @since 7.0.0 |
|
| 103 | - * @deprecated 9.0.0 |
|
| 104 | - */ |
|
| 105 | - public function match($url); |
|
| 96 | + /** |
|
| 97 | + * Find the route matching $url. |
|
| 98 | + * |
|
| 99 | + * @param string $url The url to find |
|
| 100 | + * @throws \Exception |
|
| 101 | + * @return void |
|
| 102 | + * @since 7.0.0 |
|
| 103 | + * @deprecated 9.0.0 |
|
| 104 | + */ |
|
| 105 | + public function match($url); |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Get the url generator |
|
| 109 | - * |
|
| 110 | - * @since 7.0.0 |
|
| 111 | - * @deprecated 9.0.0 |
|
| 112 | - */ |
|
| 113 | - public function getGenerator(); |
|
| 107 | + /** |
|
| 108 | + * Get the url generator |
|
| 109 | + * |
|
| 110 | + * @since 7.0.0 |
|
| 111 | + * @deprecated 9.0.0 |
|
| 112 | + */ |
|
| 113 | + public function getGenerator(); |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Generate url based on $name and $parameters |
|
| 117 | - * |
|
| 118 | - * @param string $name Name of the route to use. |
|
| 119 | - * @param array $parameters Parameters for the route |
|
| 120 | - * @param bool $absolute |
|
| 121 | - * @return string |
|
| 122 | - * @since 7.0.0 |
|
| 123 | - * @deprecated 9.0.0 |
|
| 124 | - */ |
|
| 125 | - public function generate($name, $parameters = [], $absolute = false); |
|
| 115 | + /** |
|
| 116 | + * Generate url based on $name and $parameters |
|
| 117 | + * |
|
| 118 | + * @param string $name Name of the route to use. |
|
| 119 | + * @param array $parameters Parameters for the route |
|
| 120 | + * @param bool $absolute |
|
| 121 | + * @return string |
|
| 122 | + * @since 7.0.0 |
|
| 123 | + * @deprecated 9.0.0 |
|
| 124 | + */ |
|
| 125 | + public function generate($name, $parameters = [], $absolute = false); |
|
| 126 | 126 | } |
@@ -28,39 +28,39 @@ |
||
| 28 | 28 | * @since 8.2.0 |
| 29 | 29 | */ |
| 30 | 30 | interface ICompositeExpression { |
| 31 | - /** |
|
| 32 | - * Adds multiple parts to composite expression. |
|
| 33 | - * |
|
| 34 | - * @param array $parts |
|
| 35 | - * |
|
| 36 | - * @return ICompositeExpression |
|
| 37 | - * @since 8.2.0 |
|
| 38 | - */ |
|
| 39 | - public function addMultiple(array $parts = []); |
|
| 31 | + /** |
|
| 32 | + * Adds multiple parts to composite expression. |
|
| 33 | + * |
|
| 34 | + * @param array $parts |
|
| 35 | + * |
|
| 36 | + * @return ICompositeExpression |
|
| 37 | + * @since 8.2.0 |
|
| 38 | + */ |
|
| 39 | + public function addMultiple(array $parts = []); |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Adds an expression to composite expression. |
|
| 43 | - * |
|
| 44 | - * @param mixed $part |
|
| 45 | - * |
|
| 46 | - * @return ICompositeExpression |
|
| 47 | - * @since 8.2.0 |
|
| 48 | - */ |
|
| 49 | - public function add($part); |
|
| 41 | + /** |
|
| 42 | + * Adds an expression to composite expression. |
|
| 43 | + * |
|
| 44 | + * @param mixed $part |
|
| 45 | + * |
|
| 46 | + * @return ICompositeExpression |
|
| 47 | + * @since 8.2.0 |
|
| 48 | + */ |
|
| 49 | + public function add($part); |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Retrieves the amount of expressions on composite expression. |
|
| 53 | - * |
|
| 54 | - * @return integer |
|
| 55 | - * @since 8.2.0 |
|
| 56 | - */ |
|
| 57 | - public function count(); |
|
| 51 | + /** |
|
| 52 | + * Retrieves the amount of expressions on composite expression. |
|
| 53 | + * |
|
| 54 | + * @return integer |
|
| 55 | + * @since 8.2.0 |
|
| 56 | + */ |
|
| 57 | + public function count(); |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Returns the type of this composite expression (AND/OR). |
|
| 61 | - * |
|
| 62 | - * @return string |
|
| 63 | - * @since 8.2.0 |
|
| 64 | - */ |
|
| 65 | - public function getType(); |
|
| 59 | + /** |
|
| 60 | + * Returns the type of this composite expression (AND/OR). |
|
| 61 | + * |
|
| 62 | + * @return string |
|
| 63 | + * @since 8.2.0 |
|
| 64 | + */ |
|
| 65 | + public function getType(); |
|
| 66 | 66 | } |