Completed
Pull Request — master (#9581)
by Robin
19:09
created
apps/dav/lib/Connector/Sabre/DavAclPlugin.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -40,59 +40,59 @@
 block discarded – undo
40 40
  * @package OCA\DAV\Connector\Sabre
41 41
  */
42 42
 class DavAclPlugin extends \Sabre\DAVACL\Plugin {
43
-	public function __construct() {
44
-		$this->hideNodesFromListings = true;
45
-		$this->allowUnauthenticatedAccess = false;
46
-	}
43
+    public function __construct() {
44
+        $this->hideNodesFromListings = true;
45
+        $this->allowUnauthenticatedAccess = false;
46
+    }
47 47
 
48
-	function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
49
-		$access = parent::checkPrivileges($uri, $privileges, $recursion, false);
50
-		if($access === false && $throwExceptions) {
51
-			/** @var INode $node */
52
-			$node = $this->server->tree->getNodeForPath($uri);
48
+    function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
49
+        $access = parent::checkPrivileges($uri, $privileges, $recursion, false);
50
+        if($access === false && $throwExceptions) {
51
+            /** @var INode $node */
52
+            $node = $this->server->tree->getNodeForPath($uri);
53 53
 
54
-			switch(get_class($node)) {
55
-				case AddressBook::class:
56
-					$type = 'Addressbook';
57
-					break;
58
-				default:
59
-					$type = 'Node';
60
-					break;
61
-			}
62
-			throw new NotFound(
63
-				sprintf(
64
-					"%s with name '%s' could not be found",
65
-					$type,
66
-					$node->getName()
67
-				)
68
-			);
69
-		}
54
+            switch(get_class($node)) {
55
+                case AddressBook::class:
56
+                    $type = 'Addressbook';
57
+                    break;
58
+                default:
59
+                    $type = 'Node';
60
+                    break;
61
+            }
62
+            throw new NotFound(
63
+                sprintf(
64
+                    "%s with name '%s' could not be found",
65
+                    $type,
66
+                    $node->getName()
67
+                )
68
+            );
69
+        }
70 70
 
71
-		return $access;
72
-	}
71
+        return $access;
72
+    }
73 73
 
74
-	public function propFind(PropFind $propFind, INode $node) {
75
-		// If the node is neither readable nor writable then fail unless its of
76
-		// the standard user-principal
77
-		if(!($node instanceof User)) {
78
-			$path = $propFind->getPath();
79
-			$readPermissions = $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false);
80
-			$writePermissions = $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, false);
81
-			if ($readPermissions === false && $writePermissions === false) {
82
-				$this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, true);
83
-				$this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, true);
84
-			}
85
-		}
74
+    public function propFind(PropFind $propFind, INode $node) {
75
+        // If the node is neither readable nor writable then fail unless its of
76
+        // the standard user-principal
77
+        if(!($node instanceof User)) {
78
+            $path = $propFind->getPath();
79
+            $readPermissions = $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false);
80
+            $writePermissions = $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, false);
81
+            if ($readPermissions === false && $writePermissions === false) {
82
+                $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, true);
83
+                $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, true);
84
+            }
85
+        }
86 86
 
87
-		return parent::propFind($propFind, $node);
88
-	}
87
+        return parent::propFind($propFind, $node);
88
+    }
89 89
 
90
-	function beforeMethod(RequestInterface $request, ResponseInterface $response) {
91
-		$path = $request->getPath();
90
+    function beforeMethod(RequestInterface $request, ResponseInterface $response) {
91
+        $path = $request->getPath();
92 92
 
93
-		// prevent the plugin from causing an unneeded overhead for file requests
94
-		if (strpos($path, 'files/') !== 0) {
95
-			parent::beforeMethod($request, $response);
96
-		}
97
-	}
93
+        // prevent the plugin from causing an unneeded overhead for file requests
94
+        if (strpos($path, 'files/') !== 0) {
95
+            parent::beforeMethod($request, $response);
96
+        }
97
+    }
98 98
 }
Please login to merge, or discard this patch.