Completed
Pull Request — master (#151)
by Sander
02:31
created
controller/credentialcontroller.php 1 patch
Braces   +9 added lines, -12 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			} else {
151 151
 				return new DataResponse(['msg' => 'Not authorized'], Http::STATUS_UNAUTHORIZED);
152 152
 			}
153
-			if($this->config->getAppValue('passman', 'user_sharing_enabled', 1) === 0 || $this->config->getAppValue('passman', 'user_sharing_enabled', 1) === '0'){
153
+			if($this->config->getAppValue('passman', 'user_sharing_enabled', 1) === 0 || $this->config->getAppValue('passman', 'user_sharing_enabled', 1) === '0') {
154 154
 				return new DataResponse(['msg' => 'Not authorized'], Http::STATUS_UNAUTHORIZED);
155 155
 			}
156 156
 		}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 			foreach ($acl_list as $sharingACL) {
214 214
 				$target_user = $sharingACL->getUserId();
215
-				if($target_user === $this->userId){
215
+				if($target_user === $this->userId) {
216 216
 					continue;
217 217
 				}
218 218
 				$this->activityService->add(
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 					$link, $storedCredential->getUserId(), Activity::TYPE_ITEM_ACTION);
228 228
 			}
229 229
 		}
230
-		if($set_share_key === true){
230
+		if($set_share_key === true) {
231 231
 			$storedCredential->setSharedKey($shared_key);
232 232
 			$credential['shared_key'] = $shared_key;
233 233
 		}
234
-		if($unshare_action === true){
234
+		if($unshare_action === true) {
235 235
 			$storedCredential->setSharedKey('');
236 236
 			$credential['shared_key'] = '';
237 237
 		}
@@ -269,21 +269,18 @@  discard block
 block discarded – undo
269 269
 	public function getRevision($credential_guid) {
270 270
 	    try {
271 271
             $credential = $this->credentialService->getCredentialByGUID($credential_guid);
272
-        }
273
-        catch (DoesNotExistException $ex){
272
+        } catch (DoesNotExistException $ex){
274 273
             return new NotFoundJSONResponse();
275 274
         }
276 275
 
277 276
         // If the request was made by the owner of the credential
278 277
         if ($this->userId === $credential->getUserId()) {
279 278
             $result = $this->credentialRevisionService->getRevisions($credential->getId(), $this->userId);
280
-        }
281
-        else {
279
+        } else {
282 280
             $acl = $this->sharingService->getACL($this->userId, $credential_guid);
283
-            if ($acl->hasPermission(SharingACL::HISTORY)){
281
+            if ($acl->hasPermission(SharingACL::HISTORY)) {
284 282
                 $result = $this->credentialRevisionService->getRevisions($credential->getId());
285
-            }
286
-            else {
283
+            } else {
287 284
                 return new NotFoundJSONResponse();
288 285
             }
289 286
         }
@@ -304,7 +301,7 @@  discard block
 block discarded – undo
304 301
 	 * @NoAdminRequired
305 302
 	 * @NoCSRFRequired
306 303
 	 */
307
-	public function updateRevision($credential_guid, $revision_id, $credential_data){
304
+	public function updateRevision($credential_guid, $revision_id, $credential_data) {
308 305
 		$revision = null;
309 306
 		try {
310 307
 			$this->credentialService->getCredentialByGUID($credential_guid, $this->userId);
Please login to merge, or discard this patch.
controller/sharecontroller.php 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 		$this->config = $config;
77 77
 	}
78 78
 
79
-	private function isSharingEnabled(){
80
-		if($this->config->getAppValue('passman', 'link_sharing_enabled', 1) === 0 || $this->config->getAppValue('passman', 'link_sharing_enabled', 1) === '0'){
79
+	private function isSharingEnabled() {
80
+		if($this->config->getAppValue('passman', 'link_sharing_enabled', 1) === 0 || $this->config->getAppValue('passman', 'link_sharing_enabled', 1) === '0') {
81 81
 			return new JSONResponse(array());
82 82
 		}
83 83
 	}
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	}
243 243
 
244 244
 
245
-	public function unshareCredentialFromUser($item_guid, $user_id){
245
+	public function unshareCredentialFromUser($item_guid, $user_id) {
246 246
 		$acl = null;
247 247
 		$sr = null;
248 248
 		try {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 		}
258 258
 
259
-		if($sr){
259
+		if($sr) {
260 260
 			$this->shareService->cleanItemRequestsForUser($sr);
261 261
 			$manager = \OC::$server->getNotificationManager();
262 262
 			$notification = $manager->createNotification();
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 				->setUser($user_id);
266 266
 			$manager->markProcessed($notification);
267 267
 		}
268
-		if($acl){
268
+		if($acl) {
269 269
 			$this->shareService->deleteShareACL($acl);
270 270
 		}
271 271
 		return new JSONResponse(array('result' => true));
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	 * @return JSONResponse
486 486
 	 * @return NotFoundResponse
487 487
 	 */
488
-	public function getFile($item_guid, $file_guid){
488
+	public function getFile($item_guid, $file_guid) {
489 489
 		try {
490 490
 			$credential = $this->credentialService->getCredentialByGUID($item_guid);
491 491
 		} catch (DoesNotExistException $e){
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 		}
494 494
 		$userId = ($this->userId) ? $this->userId->getUID() : null;
495 495
 		$acl = $this->shareService->getACL($userId, $credential->getGuid());
496
-		if (!$acl->hasPermission(SharingACL::FILES)){
496
+		if (!$acl->hasPermission(SharingACL::FILES)) {
497 497
 			return new NotFoundJSONResponse();
498 498
 		} else {
499 499
 			return $this->fileService->getFileByGuid($file_guid);
Please login to merge, or discard this patch.