@@ -31,31 +31,31 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | interface ICredentials { |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Get the user UID |
|
| 36 | - * |
|
| 37 | - * @since 12 |
|
| 38 | - * |
|
| 39 | - * @return string |
|
| 40 | - */ |
|
| 41 | - public function getUID(); |
|
| 34 | + /** |
|
| 35 | + * Get the user UID |
|
| 36 | + * |
|
| 37 | + * @since 12 |
|
| 38 | + * |
|
| 39 | + * @return string |
|
| 40 | + */ |
|
| 41 | + public function getUID(); |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Get the login name the users used to login |
|
| 45 | - * |
|
| 46 | - * @since 12 |
|
| 47 | - * |
|
| 48 | - * @return string |
|
| 49 | - */ |
|
| 50 | - public function getLoginName(); |
|
| 43 | + /** |
|
| 44 | + * Get the login name the users used to login |
|
| 45 | + * |
|
| 46 | + * @since 12 |
|
| 47 | + * |
|
| 48 | + * @return string |
|
| 49 | + */ |
|
| 50 | + public function getLoginName(); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Get the password |
|
| 54 | - * |
|
| 55 | - * @since 12 |
|
| 56 | - * |
|
| 57 | - * @return string |
|
| 58 | - * @throws PasswordUnavailableException |
|
| 59 | - */ |
|
| 60 | - public function getPassword(); |
|
| 52 | + /** |
|
| 53 | + * Get the password |
|
| 54 | + * |
|
| 55 | + * @since 12 |
|
| 56 | + * |
|
| 57 | + * @return string |
|
| 58 | + * @throws PasswordUnavailableException |
|
| 59 | + */ |
|
| 60 | + public function getPassword(); |
|
| 61 | 61 | } |
@@ -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 | } |
@@ -35,161 +35,161 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | interface IEncryptionModule { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @return string defining the technical unique id |
|
| 40 | - * @since 8.1.0 |
|
| 41 | - */ |
|
| 42 | - public function getId(); |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
| 46 | - * |
|
| 47 | - * @return string |
|
| 48 | - * @since 8.1.0 |
|
| 49 | - */ |
|
| 50 | - public function getDisplayName(); |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * start receiving chunks from a file. This is the place where you can |
|
| 54 | - * perform some initial step before starting encrypting/decrypting the |
|
| 55 | - * chunks |
|
| 56 | - * |
|
| 57 | - * @param string $path to the file |
|
| 58 | - * @param string $user who read/write the file (null for public access) |
|
| 59 | - * @param string $mode php stream open mode |
|
| 60 | - * @param array $header contains the header data read from the file |
|
| 61 | - * @param array $accessList who has access to the file contains the key 'users' and 'public' |
|
| 62 | - * |
|
| 63 | - * $return array $header contain data as key-value pairs which should be |
|
| 64 | - * written to the header, in case of a write operation |
|
| 65 | - * or if no additional data is needed return a empty array |
|
| 66 | - * @since 8.1.0 |
|
| 67 | - */ |
|
| 68 | - public function begin($path, $user, $mode, array $header, array $accessList); |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * last chunk received. This is the place where you can perform some final |
|
| 72 | - * operation and return some remaining data if something is left in your |
|
| 73 | - * buffer. |
|
| 74 | - * |
|
| 75 | - * @param string $path to the file |
|
| 76 | - * @param string $position id of the last block (looks like "<Number>end") |
|
| 77 | - * |
|
| 78 | - * @return string remained data which should be written to the file in case |
|
| 79 | - * of a write operation |
|
| 80 | - * |
|
| 81 | - * @since 8.1.0 |
|
| 82 | - * @since 9.0.0 parameter $position added |
|
| 83 | - */ |
|
| 84 | - public function end($path, $position); |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * encrypt data |
|
| 88 | - * |
|
| 89 | - * @param string $data you want to encrypt |
|
| 90 | - * @param string $position position of the block we want to encrypt (starts with '0') |
|
| 91 | - * |
|
| 92 | - * @return mixed encrypted data |
|
| 93 | - * |
|
| 94 | - * @since 8.1.0 |
|
| 95 | - * @since 9.0.0 parameter $position added |
|
| 96 | - */ |
|
| 97 | - public function encrypt($data, $position); |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * decrypt data |
|
| 101 | - * |
|
| 102 | - * @param string $data you want to decrypt |
|
| 103 | - * @param string $position position of the block we want to decrypt |
|
| 104 | - * |
|
| 105 | - * @return mixed decrypted data |
|
| 106 | - * |
|
| 107 | - * @since 8.1.0 |
|
| 108 | - * @since 9.0.0 parameter $position added |
|
| 109 | - */ |
|
| 110 | - public function decrypt($data, $position); |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * update encrypted file, e.g. give additional users access to the file |
|
| 114 | - * |
|
| 115 | - * @param string $path path to the file which should be updated |
|
| 116 | - * @param string $uid of the user who performs the operation |
|
| 117 | - * @param array $accessList who has access to the file contains the key 'users' and 'public' |
|
| 118 | - * @return boolean |
|
| 119 | - * @since 8.1.0 |
|
| 120 | - */ |
|
| 121 | - public function update($path, $uid, array $accessList); |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * should the file be encrypted or not |
|
| 125 | - * |
|
| 126 | - * @param string $path |
|
| 127 | - * @return boolean |
|
| 128 | - * @since 8.1.0 |
|
| 129 | - */ |
|
| 130 | - public function shouldEncrypt($path); |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * get size of the unencrypted payload per block. |
|
| 134 | - * ownCloud read/write files with a block size of 8192 byte |
|
| 135 | - * |
|
| 136 | - * @param bool $signed |
|
| 137 | - * @return int |
|
| 138 | - * @since 8.1.0 optional parameter $signed was added in 9.0.0 |
|
| 139 | - */ |
|
| 140 | - public function getUnencryptedBlockSize($signed = false); |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * check if the encryption module is able to read the file, |
|
| 144 | - * e.g. if all encryption keys exists |
|
| 145 | - * |
|
| 146 | - * @param string $path |
|
| 147 | - * @param string $uid user for whom we want to check if he can read the file |
|
| 148 | - * @return boolean |
|
| 149 | - * @since 8.1.0 |
|
| 150 | - */ |
|
| 151 | - public function isReadable($path, $uid); |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Initial encryption of all files |
|
| 155 | - * |
|
| 156 | - * @param InputInterface $input |
|
| 157 | - * @param OutputInterface $output write some status information to the terminal during encryption |
|
| 158 | - * @since 8.2.0 |
|
| 159 | - */ |
|
| 160 | - public function encryptAll(InputInterface $input, OutputInterface $output); |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * prepare encryption module to decrypt all files |
|
| 164 | - * |
|
| 165 | - * @param InputInterface $input |
|
| 166 | - * @param OutputInterface $output write some status information to the terminal during encryption |
|
| 167 | - * @param $user (optional) for which the files should be decrypted, default = all users |
|
| 168 | - * @return bool return false on failure or if it isn't supported by the module |
|
| 169 | - * @since 8.2.0 |
|
| 170 | - */ |
|
| 171 | - public function prepareDecryptAll(InputInterface $input, OutputInterface $output, $user = ''); |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Check if the module is ready to be used by that specific user. |
|
| 175 | - * In case a module is not ready - because e.g. key pairs have not been generated |
|
| 176 | - * upon login this method can return false before any operation starts and might |
|
| 177 | - * cause issues during operations. |
|
| 178 | - * |
|
| 179 | - * @param string $user |
|
| 180 | - * @return boolean |
|
| 181 | - * @since 9.1.0 |
|
| 182 | - */ |
|
| 183 | - public function isReadyForUser($user); |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * Does the encryption module needs a detailed list of users with access to the file? |
|
| 187 | - * For example if the encryption module uses per-user encryption keys and needs to know |
|
| 188 | - * the users with access to the file to encrypt/decrypt it. |
|
| 189 | - * |
|
| 190 | - * @since 13.0.0 |
|
| 191 | - * @return bool |
|
| 192 | - */ |
|
| 193 | - public function needDetailedAccessList(); |
|
| 38 | + /** |
|
| 39 | + * @return string defining the technical unique id |
|
| 40 | + * @since 8.1.0 |
|
| 41 | + */ |
|
| 42 | + public function getId(); |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
| 46 | + * |
|
| 47 | + * @return string |
|
| 48 | + * @since 8.1.0 |
|
| 49 | + */ |
|
| 50 | + public function getDisplayName(); |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * start receiving chunks from a file. This is the place where you can |
|
| 54 | + * perform some initial step before starting encrypting/decrypting the |
|
| 55 | + * chunks |
|
| 56 | + * |
|
| 57 | + * @param string $path to the file |
|
| 58 | + * @param string $user who read/write the file (null for public access) |
|
| 59 | + * @param string $mode php stream open mode |
|
| 60 | + * @param array $header contains the header data read from the file |
|
| 61 | + * @param array $accessList who has access to the file contains the key 'users' and 'public' |
|
| 62 | + * |
|
| 63 | + * $return array $header contain data as key-value pairs which should be |
|
| 64 | + * written to the header, in case of a write operation |
|
| 65 | + * or if no additional data is needed return a empty array |
|
| 66 | + * @since 8.1.0 |
|
| 67 | + */ |
|
| 68 | + public function begin($path, $user, $mode, array $header, array $accessList); |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * last chunk received. This is the place where you can perform some final |
|
| 72 | + * operation and return some remaining data if something is left in your |
|
| 73 | + * buffer. |
|
| 74 | + * |
|
| 75 | + * @param string $path to the file |
|
| 76 | + * @param string $position id of the last block (looks like "<Number>end") |
|
| 77 | + * |
|
| 78 | + * @return string remained data which should be written to the file in case |
|
| 79 | + * of a write operation |
|
| 80 | + * |
|
| 81 | + * @since 8.1.0 |
|
| 82 | + * @since 9.0.0 parameter $position added |
|
| 83 | + */ |
|
| 84 | + public function end($path, $position); |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * encrypt data |
|
| 88 | + * |
|
| 89 | + * @param string $data you want to encrypt |
|
| 90 | + * @param string $position position of the block we want to encrypt (starts with '0') |
|
| 91 | + * |
|
| 92 | + * @return mixed encrypted data |
|
| 93 | + * |
|
| 94 | + * @since 8.1.0 |
|
| 95 | + * @since 9.0.0 parameter $position added |
|
| 96 | + */ |
|
| 97 | + public function encrypt($data, $position); |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * decrypt data |
|
| 101 | + * |
|
| 102 | + * @param string $data you want to decrypt |
|
| 103 | + * @param string $position position of the block we want to decrypt |
|
| 104 | + * |
|
| 105 | + * @return mixed decrypted data |
|
| 106 | + * |
|
| 107 | + * @since 8.1.0 |
|
| 108 | + * @since 9.0.0 parameter $position added |
|
| 109 | + */ |
|
| 110 | + public function decrypt($data, $position); |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * update encrypted file, e.g. give additional users access to the file |
|
| 114 | + * |
|
| 115 | + * @param string $path path to the file which should be updated |
|
| 116 | + * @param string $uid of the user who performs the operation |
|
| 117 | + * @param array $accessList who has access to the file contains the key 'users' and 'public' |
|
| 118 | + * @return boolean |
|
| 119 | + * @since 8.1.0 |
|
| 120 | + */ |
|
| 121 | + public function update($path, $uid, array $accessList); |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * should the file be encrypted or not |
|
| 125 | + * |
|
| 126 | + * @param string $path |
|
| 127 | + * @return boolean |
|
| 128 | + * @since 8.1.0 |
|
| 129 | + */ |
|
| 130 | + public function shouldEncrypt($path); |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * get size of the unencrypted payload per block. |
|
| 134 | + * ownCloud read/write files with a block size of 8192 byte |
|
| 135 | + * |
|
| 136 | + * @param bool $signed |
|
| 137 | + * @return int |
|
| 138 | + * @since 8.1.0 optional parameter $signed was added in 9.0.0 |
|
| 139 | + */ |
|
| 140 | + public function getUnencryptedBlockSize($signed = false); |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * check if the encryption module is able to read the file, |
|
| 144 | + * e.g. if all encryption keys exists |
|
| 145 | + * |
|
| 146 | + * @param string $path |
|
| 147 | + * @param string $uid user for whom we want to check if he can read the file |
|
| 148 | + * @return boolean |
|
| 149 | + * @since 8.1.0 |
|
| 150 | + */ |
|
| 151 | + public function isReadable($path, $uid); |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Initial encryption of all files |
|
| 155 | + * |
|
| 156 | + * @param InputInterface $input |
|
| 157 | + * @param OutputInterface $output write some status information to the terminal during encryption |
|
| 158 | + * @since 8.2.0 |
|
| 159 | + */ |
|
| 160 | + public function encryptAll(InputInterface $input, OutputInterface $output); |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * prepare encryption module to decrypt all files |
|
| 164 | + * |
|
| 165 | + * @param InputInterface $input |
|
| 166 | + * @param OutputInterface $output write some status information to the terminal during encryption |
|
| 167 | + * @param $user (optional) for which the files should be decrypted, default = all users |
|
| 168 | + * @return bool return false on failure or if it isn't supported by the module |
|
| 169 | + * @since 8.2.0 |
|
| 170 | + */ |
|
| 171 | + public function prepareDecryptAll(InputInterface $input, OutputInterface $output, $user = ''); |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Check if the module is ready to be used by that specific user. |
|
| 175 | + * In case a module is not ready - because e.g. key pairs have not been generated |
|
| 176 | + * upon login this method can return false before any operation starts and might |
|
| 177 | + * cause issues during operations. |
|
| 178 | + * |
|
| 179 | + * @param string $user |
|
| 180 | + * @return boolean |
|
| 181 | + * @since 9.1.0 |
|
| 182 | + */ |
|
| 183 | + public function isReadyForUser($user); |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * Does the encryption module needs a detailed list of users with access to the file? |
|
| 187 | + * For example if the encryption module uses per-user encryption keys and needs to know |
|
| 188 | + * the users with access to the file to encrypt/decrypt it. |
|
| 189 | + * |
|
| 190 | + * @since 13.0.0 |
|
| 191 | + * @return bool |
|
| 192 | + */ |
|
| 193 | + public function needDetailedAccessList(); |
|
| 194 | 194 | |
| 195 | 195 | } |
@@ -35,43 +35,43 @@ |
||
| 35 | 35 | class SetMasterKeyStatus implements IRepairStep { |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - /** @var IConfig */ |
|
| 39 | - private $config; |
|
| 38 | + /** @var IConfig */ |
|
| 39 | + private $config; |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | - public function __construct(IConfig $config) { |
|
| 43 | - $this->config = $config; |
|
| 44 | - } |
|
| 42 | + public function __construct(IConfig $config) { |
|
| 43 | + $this->config = $config; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Returns the step's name |
|
| 48 | - * |
|
| 49 | - * @return string |
|
| 50 | - * @since 9.1.0 |
|
| 51 | - */ |
|
| 52 | - public function getName() { |
|
| 53 | - return 'Write default encryption module configuration to the database'; |
|
| 54 | - } |
|
| 46 | + /** |
|
| 47 | + * Returns the step's name |
|
| 48 | + * |
|
| 49 | + * @return string |
|
| 50 | + * @since 9.1.0 |
|
| 51 | + */ |
|
| 52 | + public function getName() { |
|
| 53 | + return 'Write default encryption module configuration to the database'; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @param IOutput $output |
|
| 58 | - */ |
|
| 59 | - public function run(IOutput $output) { |
|
| 60 | - if (!$this->shouldRun()) { |
|
| 61 | - return; |
|
| 62 | - } |
|
| 56 | + /** |
|
| 57 | + * @param IOutput $output |
|
| 58 | + */ |
|
| 59 | + public function run(IOutput $output) { |
|
| 60 | + if (!$this->shouldRun()) { |
|
| 61 | + return; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - // if no config for the master key is set we set it explicitly to '0' in |
|
| 65 | - // order not to break old installations because the default changed to '1'. |
|
| 66 | - $configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', false); |
|
| 67 | - if ($configAlreadySet === false) { |
|
| 68 | - $this->config->setAppValue('encryption', 'useMasterKey', '0'); |
|
| 69 | - } |
|
| 70 | - } |
|
| 64 | + // if no config for the master key is set we set it explicitly to '0' in |
|
| 65 | + // order not to break old installations because the default changed to '1'. |
|
| 66 | + $configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', false); |
|
| 67 | + if ($configAlreadySet === false) { |
|
| 68 | + $this->config->setAppValue('encryption', 'useMasterKey', '0'); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - protected function shouldRun() { |
|
| 73 | - $appVersion = $this->config->getAppValue('encryption', 'installed_version', '0.0.0'); |
|
| 74 | - return version_compare($appVersion, '2.0.0', '<'); |
|
| 75 | - } |
|
| 72 | + protected function shouldRun() { |
|
| 73 | + $appVersion = $this->config->getAppValue('encryption', 'installed_version', '0.0.0'); |
|
| 74 | + return version_compare($appVersion, '2.0.0', '<'); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | } |
@@ -32,72 +32,72 @@ |
||
| 32 | 32 | |
| 33 | 33 | class Personal implements ISettings { |
| 34 | 34 | |
| 35 | - /** @var IManager */ |
|
| 36 | - private $encryptionManager; |
|
| 35 | + /** @var IManager */ |
|
| 36 | + private $encryptionManager; |
|
| 37 | 37 | |
| 38 | - /** @var UserGlobalStoragesService */ |
|
| 39 | - private $userGlobalStoragesService; |
|
| 38 | + /** @var UserGlobalStoragesService */ |
|
| 39 | + private $userGlobalStoragesService; |
|
| 40 | 40 | |
| 41 | - /** @var BackendService */ |
|
| 42 | - private $backendService; |
|
| 41 | + /** @var BackendService */ |
|
| 42 | + private $backendService; |
|
| 43 | 43 | |
| 44 | - /** @var GlobalAuth */ |
|
| 45 | - private $globalAuth; |
|
| 44 | + /** @var GlobalAuth */ |
|
| 45 | + private $globalAuth; |
|
| 46 | 46 | |
| 47 | - /** @var IUserSession */ |
|
| 48 | - private $userSession; |
|
| 47 | + /** @var IUserSession */ |
|
| 48 | + private $userSession; |
|
| 49 | 49 | |
| 50 | - public function __construct( |
|
| 51 | - IManager $encryptionManager, |
|
| 52 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
| 53 | - BackendService $backendService, |
|
| 54 | - GlobalAuth $globalAuth, |
|
| 55 | - IUserSession $userSession |
|
| 56 | - ) { |
|
| 57 | - $this->encryptionManager = $encryptionManager; |
|
| 58 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 59 | - $this->backendService = $backendService; |
|
| 60 | - $this->globalAuth = $globalAuth; |
|
| 61 | - $this->userSession = $userSession; |
|
| 62 | - } |
|
| 50 | + public function __construct( |
|
| 51 | + IManager $encryptionManager, |
|
| 52 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
| 53 | + BackendService $backendService, |
|
| 54 | + GlobalAuth $globalAuth, |
|
| 55 | + IUserSession $userSession |
|
| 56 | + ) { |
|
| 57 | + $this->encryptionManager = $encryptionManager; |
|
| 58 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 59 | + $this->backendService = $backendService; |
|
| 60 | + $this->globalAuth = $globalAuth; |
|
| 61 | + $this->userSession = $userSession; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @return TemplateResponse |
|
| 66 | - */ |
|
| 67 | - public function getForm() { |
|
| 68 | - $uid = $this->userSession->getUser()->getUID(); |
|
| 64 | + /** |
|
| 65 | + * @return TemplateResponse |
|
| 66 | + */ |
|
| 67 | + public function getForm() { |
|
| 68 | + $uid = $this->userSession->getUser()->getUID(); |
|
| 69 | 69 | |
| 70 | - $parameters = [ |
|
| 71 | - 'encryptionEnabled' => $this->encryptionManager->isEnabled(), |
|
| 72 | - 'visibilityType' => BackendService::VISIBILITY_PERSONAL, |
|
| 73 | - 'storages' => $this->userGlobalStoragesService->getStorages(), |
|
| 74 | - 'backends' => $this->backendService->getAvailableBackends(), |
|
| 75 | - 'authMechanisms' => $this->backendService->getAuthMechanisms(), |
|
| 76 | - 'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()), |
|
| 77 | - 'allowUserMounting' => $this->backendService->isUserMountingAllowed(), |
|
| 78 | - 'globalCredentials' => $this->globalAuth->getAuth($uid), |
|
| 79 | - 'globalCredentialsUid' => $uid, |
|
| 80 | - ]; |
|
| 70 | + $parameters = [ |
|
| 71 | + 'encryptionEnabled' => $this->encryptionManager->isEnabled(), |
|
| 72 | + 'visibilityType' => BackendService::VISIBILITY_PERSONAL, |
|
| 73 | + 'storages' => $this->userGlobalStoragesService->getStorages(), |
|
| 74 | + 'backends' => $this->backendService->getAvailableBackends(), |
|
| 75 | + 'authMechanisms' => $this->backendService->getAuthMechanisms(), |
|
| 76 | + 'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()), |
|
| 77 | + 'allowUserMounting' => $this->backendService->isUserMountingAllowed(), |
|
| 78 | + 'globalCredentials' => $this->globalAuth->getAuth($uid), |
|
| 79 | + 'globalCredentialsUid' => $uid, |
|
| 80 | + ]; |
|
| 81 | 81 | |
| 82 | - return new TemplateResponse('files_external', 'settings', $parameters, ''); |
|
| 83 | - } |
|
| 82 | + return new TemplateResponse('files_external', 'settings', $parameters, ''); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * @return string the section ID, e.g. 'sharing' |
|
| 87 | - */ |
|
| 88 | - public function getSection() { |
|
| 89 | - return 'externalstorages'; |
|
| 90 | - } |
|
| 85 | + /** |
|
| 86 | + * @return string the section ID, e.g. 'sharing' |
|
| 87 | + */ |
|
| 88 | + public function getSection() { |
|
| 89 | + return 'externalstorages'; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * @return int whether the form should be rather on the top or bottom of |
|
| 94 | - * the admin section. The forms are arranged in ascending order of the |
|
| 95 | - * priority values. It is required to return a value between 0 and 100. |
|
| 96 | - * |
|
| 97 | - * E.g.: 70 |
|
| 98 | - */ |
|
| 99 | - public function getPriority() { |
|
| 100 | - return 40; |
|
| 101 | - } |
|
| 92 | + /** |
|
| 93 | + * @return int whether the form should be rather on the top or bottom of |
|
| 94 | + * the admin section. The forms are arranged in ascending order of the |
|
| 95 | + * priority values. It is required to return a value between 0 and 100. |
|
| 96 | + * |
|
| 97 | + * E.g.: 70 |
|
| 98 | + */ |
|
| 99 | + public function getPriority() { |
|
| 100 | + return 40; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | 103 | } |
@@ -36,49 +36,49 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class SimpleOutput implements IOutput { |
| 38 | 38 | |
| 39 | - /** @var ILogger */ |
|
| 40 | - private $logger; |
|
| 41 | - private $appName; |
|
| 39 | + /** @var ILogger */ |
|
| 40 | + private $logger; |
|
| 41 | + private $appName; |
|
| 42 | 42 | |
| 43 | - public function __construct(ILogger $logger, $appName) { |
|
| 44 | - $this->logger = $logger; |
|
| 45 | - $this->appName = $appName; |
|
| 46 | - } |
|
| 43 | + public function __construct(ILogger $logger, $appName) { |
|
| 44 | + $this->logger = $logger; |
|
| 45 | + $this->appName = $appName; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @param string $message |
|
| 50 | - * @since 9.1.0 |
|
| 51 | - */ |
|
| 52 | - public function info($message) { |
|
| 53 | - $this->logger->info($message, ['app' => $this->appName]); |
|
| 54 | - } |
|
| 48 | + /** |
|
| 49 | + * @param string $message |
|
| 50 | + * @since 9.1.0 |
|
| 51 | + */ |
|
| 52 | + public function info($message) { |
|
| 53 | + $this->logger->info($message, ['app' => $this->appName]); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @param string $message |
|
| 58 | - * @since 9.1.0 |
|
| 59 | - */ |
|
| 60 | - public function warning($message) { |
|
| 61 | - $this->logger->warning($message, ['app' => $this->appName]); |
|
| 62 | - } |
|
| 56 | + /** |
|
| 57 | + * @param string $message |
|
| 58 | + * @since 9.1.0 |
|
| 59 | + */ |
|
| 60 | + public function warning($message) { |
|
| 61 | + $this->logger->warning($message, ['app' => $this->appName]); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @param int $max |
|
| 66 | - * @since 9.1.0 |
|
| 67 | - */ |
|
| 68 | - public function startProgress($max = 0) { |
|
| 69 | - } |
|
| 64 | + /** |
|
| 65 | + * @param int $max |
|
| 66 | + * @since 9.1.0 |
|
| 67 | + */ |
|
| 68 | + public function startProgress($max = 0) { |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @param int $step |
|
| 73 | - * @param string $description |
|
| 74 | - * @since 9.1.0 |
|
| 75 | - */ |
|
| 76 | - public function advance($step = 1, $description = '') { |
|
| 77 | - } |
|
| 71 | + /** |
|
| 72 | + * @param int $step |
|
| 73 | + * @param string $description |
|
| 74 | + * @since 9.1.0 |
|
| 75 | + */ |
|
| 76 | + public function advance($step = 1, $description = '') { |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @since 9.1.0 |
|
| 81 | - */ |
|
| 82 | - public function finishProgress() { |
|
| 83 | - } |
|
| 79 | + /** |
|
| 80 | + * @since 9.1.0 |
|
| 81 | + */ |
|
| 82 | + public function finishProgress() { |
|
| 83 | + } |
|
| 84 | 84 | } |
@@ -30,33 +30,33 @@ |
||
| 30 | 30 | |
| 31 | 31 | class ManagerFactory implements ICommentsManagerFactory { |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Server container |
|
| 35 | - * |
|
| 36 | - * @var IServerContainer |
|
| 37 | - */ |
|
| 38 | - private $serverContainer; |
|
| 33 | + /** |
|
| 34 | + * Server container |
|
| 35 | + * |
|
| 36 | + * @var IServerContainer |
|
| 37 | + */ |
|
| 38 | + private $serverContainer; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Constructor for the comments manager factory |
|
| 42 | - * |
|
| 43 | - * @param IServerContainer $serverContainer server container |
|
| 44 | - */ |
|
| 45 | - public function __construct(IServerContainer $serverContainer) { |
|
| 46 | - $this->serverContainer = $serverContainer; |
|
| 47 | - } |
|
| 40 | + /** |
|
| 41 | + * Constructor for the comments manager factory |
|
| 42 | + * |
|
| 43 | + * @param IServerContainer $serverContainer server container |
|
| 44 | + */ |
|
| 45 | + public function __construct(IServerContainer $serverContainer) { |
|
| 46 | + $this->serverContainer = $serverContainer; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * creates and returns an instance of the ICommentsManager |
|
| 51 | - * |
|
| 52 | - * @return ICommentsManager |
|
| 53 | - * @since 9.0.0 |
|
| 54 | - */ |
|
| 55 | - public function getManager() { |
|
| 56 | - return new Manager( |
|
| 57 | - $this->serverContainer->getDatabaseConnection(), |
|
| 58 | - $this->serverContainer->getLogger(), |
|
| 59 | - $this->serverContainer->getConfig() |
|
| 60 | - ); |
|
| 61 | - } |
|
| 49 | + /** |
|
| 50 | + * creates and returns an instance of the ICommentsManager |
|
| 51 | + * |
|
| 52 | + * @return ICommentsManager |
|
| 53 | + * @since 9.0.0 |
|
| 54 | + */ |
|
| 55 | + public function getManager() { |
|
| 56 | + return new Manager( |
|
| 57 | + $this->serverContainer->getDatabaseConnection(), |
|
| 58 | + $this->serverContainer->getLogger(), |
|
| 59 | + $this->serverContainer->getConfig() |
|
| 60 | + ); |
|
| 61 | + } |
|
| 62 | 62 | } |