@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $json = file_get_contents('php://stdin'); |
| 113 | 113 | } else { |
| 114 | 114 | if (!file_exists($path)) { |
| 115 | - $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
| 115 | + $output->writeln('<error>File not found: '.$path.'</error>'); |
|
| 116 | 116 | return 1; |
| 117 | 117 | } |
| 118 | 118 | $json = file_get_contents($path); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && |
| 165 | 165 | $existingMount->getBackendOptions() === $mount->getBackendOptions() |
| 166 | 166 | ) { |
| 167 | - $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
| 167 | + $output->writeln("<error>Duplicate mount (".$mount->getMountPoint().")</error>"); |
|
| 168 | 168 | return 1; |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -40,187 +40,187 @@ |
||
| 40 | 40 | use Symfony\Component\Console\Output\OutputInterface; |
| 41 | 41 | |
| 42 | 42 | class Import extends Base { |
| 43 | - /** |
|
| 44 | - * @var GlobalStoragesService |
|
| 45 | - */ |
|
| 46 | - private $globalService; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @var UserStoragesService |
|
| 50 | - */ |
|
| 51 | - private $userService; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @var IUserSession |
|
| 55 | - */ |
|
| 56 | - private $userSession; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @var IUserManager |
|
| 60 | - */ |
|
| 61 | - private $userManager; |
|
| 62 | - |
|
| 63 | - /** @var ImportLegacyStoragesService */ |
|
| 64 | - private $importLegacyStorageService; |
|
| 65 | - |
|
| 66 | - /** @var BackendService */ |
|
| 67 | - private $backendService; |
|
| 68 | - |
|
| 69 | - public function __construct(GlobalStoragesService $globalService, |
|
| 70 | - UserStoragesService $userService, |
|
| 71 | - IUserSession $userSession, |
|
| 72 | - IUserManager $userManager, |
|
| 73 | - ImportLegacyStoragesService $importLegacyStorageService, |
|
| 74 | - BackendService $backendService |
|
| 75 | - ) { |
|
| 76 | - parent::__construct(); |
|
| 77 | - $this->globalService = $globalService; |
|
| 78 | - $this->userService = $userService; |
|
| 79 | - $this->userSession = $userSession; |
|
| 80 | - $this->userManager = $userManager; |
|
| 81 | - $this->importLegacyStorageService = $importLegacyStorageService; |
|
| 82 | - $this->backendService = $backendService; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - protected function configure() { |
|
| 86 | - $this |
|
| 87 | - ->setName('files_external:import') |
|
| 88 | - ->setDescription('Import mount configurations') |
|
| 89 | - ->addOption( |
|
| 90 | - 'user', |
|
| 91 | - '', |
|
| 92 | - InputOption::VALUE_OPTIONAL, |
|
| 93 | - 'user to add the mount configurations for, if not set the mount will be added as system mount' |
|
| 94 | - ) |
|
| 95 | - ->addArgument( |
|
| 96 | - 'path', |
|
| 97 | - InputArgument::REQUIRED, |
|
| 98 | - 'path to a json file containing the mounts to import, use "-" to read from stdin' |
|
| 99 | - ) |
|
| 100 | - ->addOption( |
|
| 101 | - 'dry', |
|
| 102 | - '', |
|
| 103 | - InputOption::VALUE_NONE, |
|
| 104 | - 'Don\'t save the imported mounts, only list the new mounts' |
|
| 105 | - ); |
|
| 106 | - parent::configure(); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 110 | - $user = (string) $input->getOption('user'); |
|
| 111 | - $path = $input->getArgument('path'); |
|
| 112 | - if ($path === '-') { |
|
| 113 | - $json = file_get_contents('php://stdin'); |
|
| 114 | - } else { |
|
| 115 | - if (!file_exists($path)) { |
|
| 116 | - $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
| 117 | - return 1; |
|
| 118 | - } |
|
| 119 | - $json = file_get_contents($path); |
|
| 120 | - } |
|
| 121 | - if (!is_string($json) || strlen($json) < 2) { |
|
| 122 | - $output->writeln('<error>Error while reading json</error>'); |
|
| 123 | - return 1; |
|
| 124 | - } |
|
| 125 | - $data = json_decode($json, true); |
|
| 126 | - if (!is_array($data)) { |
|
| 127 | - $output->writeln('<error>Error while parsing json</error>'); |
|
| 128 | - return 1; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $isLegacy = isset($data['user']) || isset($data['group']); |
|
| 132 | - if ($isLegacy) { |
|
| 133 | - $this->importLegacyStorageService->setData($data); |
|
| 134 | - $mounts = $this->importLegacyStorageService->getAllStorages(); |
|
| 135 | - foreach ($mounts as $mount) { |
|
| 136 | - if ($mount->getBackendOption('password') === false) { |
|
| 137 | - $output->writeln('<error>Failed to decrypt password</error>'); |
|
| 138 | - return 1; |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - } else { |
|
| 142 | - if (!isset($data[0])) { //normalize to an array of mounts |
|
| 143 | - $data = [$data]; |
|
| 144 | - } |
|
| 145 | - $mounts = array_map([$this, 'parseData'], $data); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - if ($user) { |
|
| 149 | - // ensure applicables are correct for personal mounts |
|
| 150 | - foreach ($mounts as $mount) { |
|
| 151 | - $mount->setApplicableGroups([]); |
|
| 152 | - $mount->setApplicableUsers([$user]); |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - $storageService = $this->getStorageService($user); |
|
| 157 | - |
|
| 158 | - $existingMounts = $storageService->getAllStorages(); |
|
| 159 | - |
|
| 160 | - foreach ($mounts as $mount) { |
|
| 161 | - foreach ($existingMounts as $existingMount) { |
|
| 162 | - if ( |
|
| 163 | - $existingMount->getMountPoint() === $mount->getMountPoint() && |
|
| 164 | - $existingMount->getApplicableGroups() === $mount->getApplicableGroups() && |
|
| 165 | - $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && |
|
| 166 | - $existingMount->getBackendOptions() === $mount->getBackendOptions() |
|
| 167 | - ) { |
|
| 168 | - $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
| 169 | - return 1; |
|
| 170 | - } |
|
| 171 | - } |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - if ($input->getOption('dry')) { |
|
| 175 | - if (count($mounts) === 0) { |
|
| 176 | - $output->writeln('<error>No mounts to be imported</error>'); |
|
| 177 | - return 1; |
|
| 178 | - } |
|
| 179 | - $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
| 180 | - $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
| 181 | - $listInput->setOption('output', $input->getOption('output')); |
|
| 182 | - $listInput->setOption('show-password', true); |
|
| 183 | - $listCommand->listMounts($user, $mounts, $listInput, $output); |
|
| 184 | - } else { |
|
| 185 | - foreach ($mounts as $mount) { |
|
| 186 | - $storageService->addStorage($mount); |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - return 0; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - private function parseData(array $data) { |
|
| 193 | - $mount = new StorageConfig($data['mount_id']); |
|
| 194 | - $mount->setMountPoint($data['mount_point']); |
|
| 195 | - $mount->setBackend($this->getBackendByClass($data['storage'])); |
|
| 196 | - $authBackend = $this->backendService->getAuthMechanism($data['authentication_type']); |
|
| 197 | - $mount->setAuthMechanism($authBackend); |
|
| 198 | - $mount->setBackendOptions($data['configuration']); |
|
| 199 | - $mount->setMountOptions($data['options']); |
|
| 200 | - $mount->setApplicableUsers(isset($data['applicable_users']) ? $data['applicable_users'] : []); |
|
| 201 | - $mount->setApplicableGroups(isset($data['applicable_groups']) ? $data['applicable_groups'] : []); |
|
| 202 | - return $mount; |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - private function getBackendByClass($className) { |
|
| 206 | - $backends = $this->backendService->getBackends(); |
|
| 207 | - foreach ($backends as $backend) { |
|
| 208 | - if ($backend->getStorageClass() === $className) { |
|
| 209 | - return $backend; |
|
| 210 | - } |
|
| 211 | - } |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - protected function getStorageService($userId) { |
|
| 215 | - if (!empty($userId)) { |
|
| 216 | - $user = $this->userManager->get($userId); |
|
| 217 | - if (is_null($user)) { |
|
| 218 | - throw new NoUserException("user $userId not found"); |
|
| 219 | - } |
|
| 220 | - $this->userSession->setUser($user); |
|
| 221 | - return $this->userService; |
|
| 222 | - } else { |
|
| 223 | - return $this->globalService; |
|
| 224 | - } |
|
| 225 | - } |
|
| 43 | + /** |
|
| 44 | + * @var GlobalStoragesService |
|
| 45 | + */ |
|
| 46 | + private $globalService; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @var UserStoragesService |
|
| 50 | + */ |
|
| 51 | + private $userService; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @var IUserSession |
|
| 55 | + */ |
|
| 56 | + private $userSession; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @var IUserManager |
|
| 60 | + */ |
|
| 61 | + private $userManager; |
|
| 62 | + |
|
| 63 | + /** @var ImportLegacyStoragesService */ |
|
| 64 | + private $importLegacyStorageService; |
|
| 65 | + |
|
| 66 | + /** @var BackendService */ |
|
| 67 | + private $backendService; |
|
| 68 | + |
|
| 69 | + public function __construct(GlobalStoragesService $globalService, |
|
| 70 | + UserStoragesService $userService, |
|
| 71 | + IUserSession $userSession, |
|
| 72 | + IUserManager $userManager, |
|
| 73 | + ImportLegacyStoragesService $importLegacyStorageService, |
|
| 74 | + BackendService $backendService |
|
| 75 | + ) { |
|
| 76 | + parent::__construct(); |
|
| 77 | + $this->globalService = $globalService; |
|
| 78 | + $this->userService = $userService; |
|
| 79 | + $this->userSession = $userSession; |
|
| 80 | + $this->userManager = $userManager; |
|
| 81 | + $this->importLegacyStorageService = $importLegacyStorageService; |
|
| 82 | + $this->backendService = $backendService; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + protected function configure() { |
|
| 86 | + $this |
|
| 87 | + ->setName('files_external:import') |
|
| 88 | + ->setDescription('Import mount configurations') |
|
| 89 | + ->addOption( |
|
| 90 | + 'user', |
|
| 91 | + '', |
|
| 92 | + InputOption::VALUE_OPTIONAL, |
|
| 93 | + 'user to add the mount configurations for, if not set the mount will be added as system mount' |
|
| 94 | + ) |
|
| 95 | + ->addArgument( |
|
| 96 | + 'path', |
|
| 97 | + InputArgument::REQUIRED, |
|
| 98 | + 'path to a json file containing the mounts to import, use "-" to read from stdin' |
|
| 99 | + ) |
|
| 100 | + ->addOption( |
|
| 101 | + 'dry', |
|
| 102 | + '', |
|
| 103 | + InputOption::VALUE_NONE, |
|
| 104 | + 'Don\'t save the imported mounts, only list the new mounts' |
|
| 105 | + ); |
|
| 106 | + parent::configure(); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 110 | + $user = (string) $input->getOption('user'); |
|
| 111 | + $path = $input->getArgument('path'); |
|
| 112 | + if ($path === '-') { |
|
| 113 | + $json = file_get_contents('php://stdin'); |
|
| 114 | + } else { |
|
| 115 | + if (!file_exists($path)) { |
|
| 116 | + $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
| 117 | + return 1; |
|
| 118 | + } |
|
| 119 | + $json = file_get_contents($path); |
|
| 120 | + } |
|
| 121 | + if (!is_string($json) || strlen($json) < 2) { |
|
| 122 | + $output->writeln('<error>Error while reading json</error>'); |
|
| 123 | + return 1; |
|
| 124 | + } |
|
| 125 | + $data = json_decode($json, true); |
|
| 126 | + if (!is_array($data)) { |
|
| 127 | + $output->writeln('<error>Error while parsing json</error>'); |
|
| 128 | + return 1; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $isLegacy = isset($data['user']) || isset($data['group']); |
|
| 132 | + if ($isLegacy) { |
|
| 133 | + $this->importLegacyStorageService->setData($data); |
|
| 134 | + $mounts = $this->importLegacyStorageService->getAllStorages(); |
|
| 135 | + foreach ($mounts as $mount) { |
|
| 136 | + if ($mount->getBackendOption('password') === false) { |
|
| 137 | + $output->writeln('<error>Failed to decrypt password</error>'); |
|
| 138 | + return 1; |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + } else { |
|
| 142 | + if (!isset($data[0])) { //normalize to an array of mounts |
|
| 143 | + $data = [$data]; |
|
| 144 | + } |
|
| 145 | + $mounts = array_map([$this, 'parseData'], $data); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + if ($user) { |
|
| 149 | + // ensure applicables are correct for personal mounts |
|
| 150 | + foreach ($mounts as $mount) { |
|
| 151 | + $mount->setApplicableGroups([]); |
|
| 152 | + $mount->setApplicableUsers([$user]); |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + $storageService = $this->getStorageService($user); |
|
| 157 | + |
|
| 158 | + $existingMounts = $storageService->getAllStorages(); |
|
| 159 | + |
|
| 160 | + foreach ($mounts as $mount) { |
|
| 161 | + foreach ($existingMounts as $existingMount) { |
|
| 162 | + if ( |
|
| 163 | + $existingMount->getMountPoint() === $mount->getMountPoint() && |
|
| 164 | + $existingMount->getApplicableGroups() === $mount->getApplicableGroups() && |
|
| 165 | + $existingMount->getApplicableUsers() === $mount->getApplicableUsers() && |
|
| 166 | + $existingMount->getBackendOptions() === $mount->getBackendOptions() |
|
| 167 | + ) { |
|
| 168 | + $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
| 169 | + return 1; |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + if ($input->getOption('dry')) { |
|
| 175 | + if (count($mounts) === 0) { |
|
| 176 | + $output->writeln('<error>No mounts to be imported</error>'); |
|
| 177 | + return 1; |
|
| 178 | + } |
|
| 179 | + $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager); |
|
| 180 | + $listInput = new ArrayInput([], $listCommand->getDefinition()); |
|
| 181 | + $listInput->setOption('output', $input->getOption('output')); |
|
| 182 | + $listInput->setOption('show-password', true); |
|
| 183 | + $listCommand->listMounts($user, $mounts, $listInput, $output); |
|
| 184 | + } else { |
|
| 185 | + foreach ($mounts as $mount) { |
|
| 186 | + $storageService->addStorage($mount); |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + return 0; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + private function parseData(array $data) { |
|
| 193 | + $mount = new StorageConfig($data['mount_id']); |
|
| 194 | + $mount->setMountPoint($data['mount_point']); |
|
| 195 | + $mount->setBackend($this->getBackendByClass($data['storage'])); |
|
| 196 | + $authBackend = $this->backendService->getAuthMechanism($data['authentication_type']); |
|
| 197 | + $mount->setAuthMechanism($authBackend); |
|
| 198 | + $mount->setBackendOptions($data['configuration']); |
|
| 199 | + $mount->setMountOptions($data['options']); |
|
| 200 | + $mount->setApplicableUsers(isset($data['applicable_users']) ? $data['applicable_users'] : []); |
|
| 201 | + $mount->setApplicableGroups(isset($data['applicable_groups']) ? $data['applicable_groups'] : []); |
|
| 202 | + return $mount; |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + private function getBackendByClass($className) { |
|
| 206 | + $backends = $this->backendService->getBackends(); |
|
| 207 | + foreach ($backends as $backend) { |
|
| 208 | + if ($backend->getStorageClass() === $className) { |
|
| 209 | + return $backend; |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + protected function getStorageService($userId) { |
|
| 215 | + if (!empty($userId)) { |
|
| 216 | + $user = $this->userManager->get($userId); |
|
| 217 | + if (is_null($user)) { |
|
| 218 | + throw new NoUserException("user $userId not found"); |
|
| 219 | + } |
|
| 220 | + $this->userSession->setUser($user); |
|
| 221 | + return $this->userService; |
|
| 222 | + } else { |
|
| 223 | + return $this->globalService; |
|
| 224 | + } |
|
| 225 | + } |
|
| 226 | 226 | } |
@@ -24,25 +24,25 @@ |
||
| 24 | 24 | namespace OC\Files\Cache\Wrapper; |
| 25 | 25 | |
| 26 | 26 | class CachePermissionsMask extends CacheWrapper { |
| 27 | - /** |
|
| 28 | - * @var int |
|
| 29 | - */ |
|
| 30 | - protected $mask; |
|
| 27 | + /** |
|
| 28 | + * @var int |
|
| 29 | + */ |
|
| 30 | + protected $mask; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @param \OCP\Files\Cache\ICache $cache |
|
| 34 | - * @param int $mask |
|
| 35 | - */ |
|
| 36 | - public function __construct($cache, $mask) { |
|
| 37 | - parent::__construct($cache); |
|
| 38 | - $this->mask = $mask; |
|
| 39 | - } |
|
| 32 | + /** |
|
| 33 | + * @param \OCP\Files\Cache\ICache $cache |
|
| 34 | + * @param int $mask |
|
| 35 | + */ |
|
| 36 | + public function __construct($cache, $mask) { |
|
| 37 | + parent::__construct($cache); |
|
| 38 | + $this->mask = $mask; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - protected function formatCacheEntry($entry) { |
|
| 42 | - if (isset($entry['permissions'])) { |
|
| 43 | - $entry['scan_permissions'] = $entry['permissions']; |
|
| 44 | - $entry['permissions'] &= $this->mask; |
|
| 45 | - } |
|
| 46 | - return $entry; |
|
| 47 | - } |
|
| 41 | + protected function formatCacheEntry($entry) { |
|
| 42 | + if (isset($entry['permissions'])) { |
|
| 43 | + $entry['scan_permissions'] = $entry['permissions']; |
|
| 44 | + $entry['permissions'] &= $this->mask; |
|
| 45 | + } |
|
| 46 | + return $entry; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -27,45 +27,45 @@ |
||
| 27 | 27 | |
| 28 | 28 | class Config implements \OCP\GlobalScale\IConfig { |
| 29 | 29 | |
| 30 | - /** @var IConfig */ |
|
| 31 | - private $config; |
|
| 30 | + /** @var IConfig */ |
|
| 31 | + private $config; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Config constructor. |
|
| 35 | - * |
|
| 36 | - * @param IConfig $config |
|
| 37 | - */ |
|
| 38 | - public function __construct(IConfig $config) { |
|
| 39 | - $this->config = $config; |
|
| 40 | - } |
|
| 33 | + /** |
|
| 34 | + * Config constructor. |
|
| 35 | + * |
|
| 36 | + * @param IConfig $config |
|
| 37 | + */ |
|
| 38 | + public function __construct(IConfig $config) { |
|
| 39 | + $this->config = $config; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * check if global scale is enabled |
|
| 44 | - * |
|
| 45 | - * @since 12.0.1 |
|
| 46 | - * @return bool |
|
| 47 | - */ |
|
| 48 | - public function isGlobalScaleEnabled() { |
|
| 49 | - $enabled = $this->config->getSystemValue('gs.enabled', false); |
|
| 50 | - return $enabled !== false; |
|
| 51 | - } |
|
| 42 | + /** |
|
| 43 | + * check if global scale is enabled |
|
| 44 | + * |
|
| 45 | + * @since 12.0.1 |
|
| 46 | + * @return bool |
|
| 47 | + */ |
|
| 48 | + public function isGlobalScaleEnabled() { |
|
| 49 | + $enabled = $this->config->getSystemValue('gs.enabled', false); |
|
| 50 | + return $enabled !== false; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * check if federation should only be used internally in a global scale setup |
|
| 55 | - * |
|
| 56 | - * @since 12.0.1 |
|
| 57 | - * @return bool |
|
| 58 | - */ |
|
| 59 | - public function onlyInternalFederation() { |
|
| 60 | - // if global scale is disabled federation works always globally |
|
| 61 | - $gsEnabled = $this->isGlobalScaleEnabled(); |
|
| 62 | - if ($gsEnabled === false) { |
|
| 63 | - return false; |
|
| 64 | - } |
|
| 53 | + /** |
|
| 54 | + * check if federation should only be used internally in a global scale setup |
|
| 55 | + * |
|
| 56 | + * @since 12.0.1 |
|
| 57 | + * @return bool |
|
| 58 | + */ |
|
| 59 | + public function onlyInternalFederation() { |
|
| 60 | + // if global scale is disabled federation works always globally |
|
| 61 | + $gsEnabled = $this->isGlobalScaleEnabled(); |
|
| 62 | + if ($gsEnabled === false) { |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - $enabled = $this->config->getSystemValue('gs.federation', 'internal'); |
|
| 66 | + $enabled = $this->config->getSystemValue('gs.federation', 'internal'); |
|
| 67 | 67 | |
| 68 | - return $enabled === 'internal'; |
|
| 69 | - } |
|
| 68 | + return $enabled === 'internal'; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | } |
@@ -32,20 +32,20 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | interface IConfig { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * check if global scale is enabled |
|
| 37 | - * |
|
| 38 | - * @since 12.0.1 |
|
| 39 | - * @return bool |
|
| 40 | - */ |
|
| 41 | - public function isGlobalScaleEnabled(); |
|
| 35 | + /** |
|
| 36 | + * check if global scale is enabled |
|
| 37 | + * |
|
| 38 | + * @since 12.0.1 |
|
| 39 | + * @return bool |
|
| 40 | + */ |
|
| 41 | + public function isGlobalScaleEnabled(); |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * check if federation should only be used internally in a global scale setup |
|
| 45 | - * |
|
| 46 | - * @since 12.0.1 |
|
| 47 | - * @return bool |
|
| 48 | - */ |
|
| 49 | - public function onlyInternalFederation(); |
|
| 43 | + /** |
|
| 44 | + * check if federation should only be used internally in a global scale setup |
|
| 45 | + * |
|
| 46 | + * @since 12.0.1 |
|
| 47 | + * @return bool |
|
| 48 | + */ |
|
| 49 | + public function onlyInternalFederation(); |
|
| 50 | 50 | |
| 51 | 51 | } |
@@ -33,14 +33,14 @@ |
||
| 33 | 33 | * @see \Sabre\DAV\Server |
| 34 | 34 | */ |
| 35 | 35 | class Server extends \Sabre\DAV\Server { |
| 36 | - /** @var CachingTree $tree */ |
|
| 36 | + /** @var CachingTree $tree */ |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @see \Sabre\DAV\Server |
|
| 40 | - */ |
|
| 41 | - public function __construct($treeOrNode = null) { |
|
| 42 | - parent::__construct($treeOrNode); |
|
| 43 | - self::$exposeVersion = false; |
|
| 44 | - $this->enablePropfindDepthInfinity = true; |
|
| 45 | - } |
|
| 38 | + /** |
|
| 39 | + * @see \Sabre\DAV\Server |
|
| 40 | + */ |
|
| 41 | + public function __construct($treeOrNode = null) { |
|
| 42 | + parent::__construct($treeOrNode); |
|
| 43 | + self::$exposeVersion = false; |
|
| 44 | + $this->enablePropfindDepthInfinity = true; |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -29,58 +29,58 @@ |
||
| 29 | 29 | use OCP\Settings\IIconSection; |
| 30 | 30 | |
| 31 | 31 | class PersonalSection implements IIconSection { |
| 32 | - /** @var IURLGenerator */ |
|
| 33 | - private $urlGenerator; |
|
| 34 | - /** @var IL10N */ |
|
| 35 | - private $l; |
|
| 32 | + /** @var IURLGenerator */ |
|
| 33 | + private $urlGenerator; |
|
| 34 | + /** @var IL10N */ |
|
| 35 | + private $l; |
|
| 36 | 36 | |
| 37 | - public function __construct(IURLGenerator $urlGenerator, IL10N $l) { |
|
| 38 | - $this->urlGenerator = $urlGenerator; |
|
| 39 | - $this->l = $l; |
|
| 40 | - } |
|
| 37 | + public function __construct(IURLGenerator $urlGenerator, IL10N $l) { |
|
| 38 | + $this->urlGenerator = $urlGenerator; |
|
| 39 | + $this->l = $l; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * returns the relative path to an 16*16 icon describing the section. |
|
| 44 | - * e.g. '/core/img/places/files.svg' |
|
| 45 | - * |
|
| 46 | - * @returns string |
|
| 47 | - * @since 13.0.0 |
|
| 48 | - */ |
|
| 49 | - public function getIcon() { |
|
| 50 | - return $this->urlGenerator->imagePath('core', 'actions/share.svg'); |
|
| 51 | - } |
|
| 42 | + /** |
|
| 43 | + * returns the relative path to an 16*16 icon describing the section. |
|
| 44 | + * e.g. '/core/img/places/files.svg' |
|
| 45 | + * |
|
| 46 | + * @returns string |
|
| 47 | + * @since 13.0.0 |
|
| 48 | + */ |
|
| 49 | + public function getIcon() { |
|
| 50 | + return $this->urlGenerator->imagePath('core', 'actions/share.svg'); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * returns the ID of the section. It is supposed to be a lower case string, |
|
| 55 | - * e.g. 'ldap' |
|
| 56 | - * |
|
| 57 | - * @returns string |
|
| 58 | - * @since 9.1 |
|
| 59 | - */ |
|
| 60 | - public function getID() { |
|
| 61 | - return 'sharing'; |
|
| 62 | - } |
|
| 53 | + /** |
|
| 54 | + * returns the ID of the section. It is supposed to be a lower case string, |
|
| 55 | + * e.g. 'ldap' |
|
| 56 | + * |
|
| 57 | + * @returns string |
|
| 58 | + * @since 9.1 |
|
| 59 | + */ |
|
| 60 | + public function getID() { |
|
| 61 | + return 'sharing'; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
| 66 | - * integration'. Use the L10N service to translate it. |
|
| 67 | - * |
|
| 68 | - * @return string |
|
| 69 | - * @since 9.1 |
|
| 70 | - */ |
|
| 71 | - public function getName() { |
|
| 72 | - return $this->l->t('Sharing'); |
|
| 73 | - } |
|
| 64 | + /** |
|
| 65 | + * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
| 66 | + * integration'. Use the L10N service to translate it. |
|
| 67 | + * |
|
| 68 | + * @return string |
|
| 69 | + * @since 9.1 |
|
| 70 | + */ |
|
| 71 | + public function getName() { |
|
| 72 | + return $this->l->t('Sharing'); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @return int whether the form should be rather on the top or bottom of |
|
| 77 | - * the settings navigation. The sections are arranged in ascending order of |
|
| 78 | - * the priority values. It is required to return a value between 0 and 99. |
|
| 79 | - * |
|
| 80 | - * E.g.: 70 |
|
| 81 | - * @since 9.1 |
|
| 82 | - */ |
|
| 83 | - public function getPriority() { |
|
| 84 | - return 15; |
|
| 85 | - } |
|
| 75 | + /** |
|
| 76 | + * @return int whether the form should be rather on the top or bottom of |
|
| 77 | + * the settings navigation. The sections are arranged in ascending order of |
|
| 78 | + * the priority values. It is required to return a value between 0 and 99. |
|
| 79 | + * |
|
| 80 | + * E.g.: 70 |
|
| 81 | + * @since 9.1 |
|
| 82 | + */ |
|
| 83 | + public function getPriority() { |
|
| 84 | + return 15; |
|
| 85 | + } |
|
| 86 | 86 | } |
@@ -29,25 +29,25 @@ |
||
| 29 | 29 | use OCP\IUserSession; |
| 30 | 30 | |
| 31 | 31 | class PersonalSection extends Section { |
| 32 | - /** @var IUserSession */ |
|
| 33 | - private $userSession; |
|
| 32 | + /** @var IUserSession */ |
|
| 33 | + private $userSession; |
|
| 34 | 34 | |
| 35 | - /** @var UserGlobalStoragesService */ |
|
| 36 | - private $userGlobalStoragesService; |
|
| 35 | + /** @var UserGlobalStoragesService */ |
|
| 36 | + private $userGlobalStoragesService; |
|
| 37 | 37 | |
| 38 | - /** @var BackendService */ |
|
| 39 | - private $backendService; |
|
| 38 | + /** @var BackendService */ |
|
| 39 | + private $backendService; |
|
| 40 | 40 | |
| 41 | - public function __construct( |
|
| 42 | - IURLGenerator $url, |
|
| 43 | - IL10N $l, |
|
| 44 | - IUserSession $userSession, |
|
| 45 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
| 46 | - BackendService $backendService |
|
| 47 | - ) { |
|
| 48 | - parent::__construct($url, $l); |
|
| 49 | - $this->userSession = $userSession; |
|
| 50 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 51 | - $this->backendService = $backendService; |
|
| 52 | - } |
|
| 41 | + public function __construct( |
|
| 42 | + IURLGenerator $url, |
|
| 43 | + IL10N $l, |
|
| 44 | + IUserSession $userSession, |
|
| 45 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
| 46 | + BackendService $backendService |
|
| 47 | + ) { |
|
| 48 | + parent::__construct($url, $l); |
|
| 49 | + $this->userSession = $userSession; |
|
| 50 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 51 | + $this->backendService = $backendService; |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -29,39 +29,39 @@ |
||
| 29 | 29 | |
| 30 | 30 | class ConfigController extends OCSController { |
| 31 | 31 | |
| 32 | - /** @var IConfig */ |
|
| 33 | - private $config; |
|
| 32 | + /** @var IConfig */ |
|
| 33 | + private $config; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @param string $appName |
|
| 37 | - * @param IRequest $request |
|
| 38 | - * @param IConfig $config |
|
| 39 | - */ |
|
| 40 | - public function __construct($appName, |
|
| 41 | - IRequest $request, |
|
| 42 | - IConfig $config) { |
|
| 43 | - parent::__construct($appName, $request); |
|
| 44 | - $this->config = $config; |
|
| 45 | - } |
|
| 35 | + /** |
|
| 36 | + * @param string $appName |
|
| 37 | + * @param IRequest $request |
|
| 38 | + * @param IConfig $config |
|
| 39 | + */ |
|
| 40 | + public function __construct($appName, |
|
| 41 | + IRequest $request, |
|
| 42 | + IConfig $config) { |
|
| 43 | + parent::__construct($appName, $request); |
|
| 44 | + $this->config = $config; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @param string $appid |
|
| 49 | - * @param string $configkey |
|
| 50 | - * @param string $value |
|
| 51 | - * @return DataResponse |
|
| 52 | - */ |
|
| 53 | - public function setAppValue($appid, $configkey, $value) { |
|
| 54 | - $this->config->setAppValue($appid, $configkey, $value); |
|
| 55 | - return new DataResponse(); |
|
| 56 | - } |
|
| 47 | + /** |
|
| 48 | + * @param string $appid |
|
| 49 | + * @param string $configkey |
|
| 50 | + * @param string $value |
|
| 51 | + * @return DataResponse |
|
| 52 | + */ |
|
| 53 | + public function setAppValue($appid, $configkey, $value) { |
|
| 54 | + $this->config->setAppValue($appid, $configkey, $value); |
|
| 55 | + return new DataResponse(); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @param string $appid |
|
| 60 | - * @param string $configkey |
|
| 61 | - * @return DataResponse |
|
| 62 | - */ |
|
| 63 | - public function deleteAppValue($appid, $configkey) { |
|
| 64 | - $this->config->deleteAppValue($appid, $configkey); |
|
| 65 | - return new DataResponse(); |
|
| 66 | - } |
|
| 58 | + /** |
|
| 59 | + * @param string $appid |
|
| 60 | + * @param string $configkey |
|
| 61 | + * @return DataResponse |
|
| 62 | + */ |
|
| 63 | + public function deleteAppValue($appid, $configkey) { |
|
| 64 | + $this->config->deleteAppValue($appid, $configkey); |
|
| 65 | + return new DataResponse(); |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -33,12 +33,12 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | interface ICallbackResponse { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Outputs the content that should be printed |
|
| 38 | - * |
|
| 39 | - * @param IOutput $output a small wrapper that handles output |
|
| 40 | - * @since 8.1.0 |
|
| 41 | - */ |
|
| 42 | - public function callback(IOutput $output); |
|
| 36 | + /** |
|
| 37 | + * Outputs the content that should be printed |
|
| 38 | + * |
|
| 39 | + * @param IOutput $output a small wrapper that handles output |
|
| 40 | + * @since 8.1.0 |
|
| 41 | + */ |
|
| 42 | + public function callback(IOutput $output); |
|
| 43 | 43 | |
| 44 | 44 | } |