@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param $value mixed Value of the setting |
| 98 | 98 | */ |
| 99 | 99 | |
| 100 | - public function setUserSetting($key, $value){ |
|
| 100 | + public function setUserSetting($key, $value) { |
|
| 101 | 101 | return $this->config->setUserValue($this->userId, $this->appName, $key, $value); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param $setting |
| 108 | 108 | * @return bool |
| 109 | 109 | */ |
| 110 | - public function isEnabled($setting){ |
|
| 110 | + public function isEnabled($setting) { |
|
| 111 | 111 | $value = intval($this->config->getAppValue('passman', $setting, false)); |
| 112 | 112 | return ($value === 1); |
| 113 | 113 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param $value mixed Value of the setting |
| 98 | 98 | */ |
| 99 | 99 | |
| 100 | - public function setUserSetting($key, $value){ |
|
| 100 | + public function setUserSetting($key, $value) { |
|
| 101 | 101 | return $this->config->setUserValue($this->userId, $this->appName, $key, $value); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param $setting |
| 108 | 108 | * @return bool |
| 109 | 109 | */ |
| 110 | - public function isEnabled($setting){ |
|
| 110 | + public function isEnabled($setting) { |
|
| 111 | 111 | $value = intval($this->config->getAppValue('passman', $setting, false)); |
| 112 | 112 | return ($value === 1); |
| 113 | 113 | } |
@@ -12,23 +12,23 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | private $settings; |
| 14 | 14 | |
| 15 | - public function __construct(SettingsService $config){ |
|
| 15 | + public function __construct(SettingsService $config) { |
|
| 16 | 16 | $this->settings = $config; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | public function beforeController($controller, $methodName) { |
| 21 | - if ($controller instanceof ShareController){ |
|
| 21 | + if ($controller instanceof ShareController) { |
|
| 22 | 22 | $http_response_code = \OCP\AppFramework\Http::STATUS_FORBIDDEN; |
| 23 | 23 | $result = 'FORBIDDEN'; |
| 24 | 24 | |
| 25 | - if(in_array($methodName, array('updateSharedCredentialACL', 'getFile', 'getItemAcl'))){ |
|
| 25 | + if (in_array($methodName, array('updateSharedCredentialACL', 'getFile', 'getItemAcl'))) { |
|
| 26 | 26 | $sharing_enabled = ($this->settings->isEnabled('link_sharing_enabled') || $this->settings->isEnabled('user_sharing_enabled')); |
| 27 | 27 | } else { |
| 28 | 28 | $publicMethods = array('createPublicShare', 'getPublicCredentialData'); |
| 29 | 29 | $setting = (in_array($methodName, $publicMethods)) ? 'link_sharing_enabled' : 'user_sharing_enabled'; |
| 30 | 30 | $sharing_enabled = ($this->settings->isEnabled($setting)); |
| 31 | - if($methodName === 'getVaultItems' || $methodName === 'getPendingRequests'){ |
|
| 31 | + if ($methodName === 'getVaultItems' || $methodName === 'getPendingRequests') { |
|
| 32 | 32 | $http_response_code = Http::STATUS_OK; |
| 33 | 33 | $result = array(); |
| 34 | 34 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $response = new JSONResponse($result); |
| 40 | 40 | http_response_code($http_response_code); |
| 41 | 41 | header('Passman-sharing: disabled'); |
| 42 | - header('Passman-method: ShareController.'. $methodName); |
|
| 42 | + header('Passman-method: ShareController.' . $methodName); |
|
| 43 | 43 | die($response->render()); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -12,23 +12,23 @@ |
||
| 12 | 12 | |
| 13 | 13 | private $settings; |
| 14 | 14 | |
| 15 | - public function __construct(SettingsService $config){ |
|
| 15 | + public function __construct(SettingsService $config) { |
|
| 16 | 16 | $this->settings = $config; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | public function beforeController($controller, $methodName) { |
| 21 | - if ($controller instanceof ShareController){ |
|
| 21 | + if ($controller instanceof ShareController) { |
|
| 22 | 22 | $http_response_code = \OCP\AppFramework\Http::STATUS_FORBIDDEN; |
| 23 | 23 | $result = 'FORBIDDEN'; |
| 24 | 24 | |
| 25 | - if(in_array($methodName, array('updateSharedCredentialACL', 'getFile', 'getItemAcl'))){ |
|
| 25 | + if(in_array($methodName, array('updateSharedCredentialACL', 'getFile', 'getItemAcl'))) { |
|
| 26 | 26 | $sharing_enabled = ($this->settings->isEnabled('link_sharing_enabled') || $this->settings->isEnabled('user_sharing_enabled')); |
| 27 | 27 | } else { |
| 28 | 28 | $publicMethods = array('createPublicShare', 'getPublicCredentialData'); |
| 29 | 29 | $setting = (in_array($methodName, $publicMethods)) ? 'link_sharing_enabled' : 'user_sharing_enabled'; |
| 30 | 30 | $sharing_enabled = ($this->settings->isEnabled($setting)); |
| 31 | - if($methodName === 'getVaultItems' || $methodName === 'getPendingRequests'){ |
|
| 31 | + if($methodName === 'getVaultItems' || $methodName === 'getPendingRequests') { |
|
| 32 | 32 | $http_response_code = Http::STATUS_OK; |
| 33 | 33 | $result = array(); |
| 34 | 34 | } |