Completed
Push — master ( efa2cd...12490b )
by Julius
23:42 queued 16s
created
apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,17 +27,17 @@
 block discarded – undo
27 27
 
28 28
 class SearchTermFilter implements XmlDeserializable {
29 29
 
30
-	/**
31
-	 * @param Reader $reader
32
-	 * @throws BadRequest
33
-	 * @return string
34
-	 */
35
-	public static function xmlDeserialize(Reader $reader) {
36
-		$value = $reader->parseInnerTree();
37
-		if (!is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
39
-		}
30
+    /**
31
+     * @param Reader $reader
32
+     * @throws BadRequest
33
+     * @return string
34
+     */
35
+    public static function xmlDeserialize(Reader $reader) {
36
+        $value = $reader->parseInnerTree();
37
+        if (!is_string($value)) {
38
+            throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
39
+        }
40 40
 
41
-		return $value;
42
-	}
41
+        return $value;
42
+    }
43 43
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	public static function xmlDeserialize(Reader $reader) {
36 36
 		$value = $reader->parseInnerTree();
37 37
 		if (!is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
38
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}search-term has illegal value');
39 39
 		}
40 40
 
41 41
 		return $value;
Please login to merge, or discard this patch.
apps/dav/lib/SystemTag/SystemTagsByIdCollection.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 			$tag = $this->tagManager->getTagsByIds([$name]);
105 105
 			$tag = current($tag);
106 106
 			if (!$this->tagManager->canUserSeeTag($tag, $this->userSession->getUser())) {
107
-				throw new NotFound('Tag with id ' . $name . ' not found');
107
+				throw new NotFound('Tag with id '.$name.' not found');
108 108
 			}
109 109
 			return $this->makeNode($tag);
110 110
 		} catch (\InvalidArgumentException $e) {
111 111
 			throw new BadRequest('Invalid tag id', 0, $e);
112 112
 		} catch (TagNotFoundException $e) {
113
-			throw new NotFound('Tag with id ' . $name . ' not found', 0, $e);
113
+			throw new NotFound('Tag with id '.$name.' not found', 0, $e);
114 114
 		}
115 115
 	}
116 116
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		}
122 122
 
123 123
 		$tags = $this->tagManager->getAllTags($visibilityFilter);
124
-		return array_map(function ($tag) {
124
+		return array_map(function($tag) {
125 125
 			return $this->makeNode($tag);
126 126
 		}, $tags);
127 127
 	}
Please login to merge, or discard this patch.
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -20,150 +20,150 @@
 block discarded – undo
20 20
 
21 21
 class SystemTagsByIdCollection implements ICollection {
22 22
 
23
-	/**
24
-	 * SystemTagsByIdCollection constructor.
25
-	 *
26
-	 * @param ISystemTagManager $tagManager
27
-	 * @param IUserSession $userSession
28
-	 * @param IGroupManager $groupManager
29
-	 */
30
-	public function __construct(
31
-		private ISystemTagManager $tagManager,
32
-		private IUserSession $userSession,
33
-		private IGroupManager $groupManager,
34
-		protected ISystemTagObjectMapper $tagMapper,
35
-	) {
36
-	}
37
-
38
-	/**
39
-	 * Returns whether the currently logged in user is an administrator
40
-	 *
41
-	 * @return bool true if the user is an admin
42
-	 */
43
-	private function isAdmin() {
44
-		$user = $this->userSession->getUser();
45
-		if ($user !== null) {
46
-			return $this->groupManager->isAdmin($user->getUID());
47
-		}
48
-		return false;
49
-	}
50
-
51
-	/**
52
-	 * @param string $name
53
-	 * @param resource|string $data Initial payload
54
-	 *
55
-	 * @throws Forbidden
56
-	 *
57
-	 * @return never
58
-	 */
59
-	public function createFile($name, $data = null) {
60
-		throw new Forbidden('Cannot create tags by id');
61
-	}
62
-
63
-	/**
64
-	 * @param string $name
65
-	 *
66
-	 * @return never
67
-	 */
68
-	public function createDirectory($name) {
69
-		throw new Forbidden('Permission denied to create collections');
70
-	}
71
-
72
-	/**
73
-	 * @param string $name
74
-	 *
75
-	 * @return SystemTagNode
76
-	 */
77
-	public function getChild($name) {
78
-		try {
79
-			$tag = $this->tagManager->getTagsByIds([$name]);
80
-			$tag = current($tag);
81
-			if (!$this->tagManager->canUserSeeTag($tag, $this->userSession->getUser())) {
82
-				throw new NotFound('Tag with id ' . $name . ' not found');
83
-			}
84
-			return $this->makeNode($tag);
85
-		} catch (\InvalidArgumentException $e) {
86
-			throw new BadRequest('Invalid tag id', 0, $e);
87
-		} catch (TagNotFoundException $e) {
88
-			throw new NotFound('Tag with id ' . $name . ' not found', 0, $e);
89
-		}
90
-	}
91
-
92
-	/**
93
-	 * @return SystemTagNode[]
94
-	 *
95
-	 * @psalm-return array<SystemTagNode>
96
-	 */
97
-	public function getChildren() {
98
-		$visibilityFilter = true;
99
-		if ($this->isAdmin()) {
100
-			$visibilityFilter = null;
101
-		}
102
-
103
-		$tags = $this->tagManager->getAllTags($visibilityFilter);
104
-		return array_map(function ($tag) {
105
-			return $this->makeNode($tag);
106
-		}, $tags);
107
-	}
108
-
109
-	/**
110
-	 * @param string $name
111
-	 */
112
-	public function childExists($name) {
113
-		try {
114
-			$tag = $this->tagManager->getTagsByIds([$name]);
115
-			$tag = current($tag);
116
-			if (!$this->tagManager->canUserSeeTag($tag, $this->userSession->getUser())) {
117
-				return false;
118
-			}
119
-			return true;
120
-		} catch (\InvalidArgumentException $e) {
121
-			throw new BadRequest('Invalid tag id', 0, $e);
122
-		} catch (TagNotFoundException $e) {
123
-			return false;
124
-		}
125
-	}
126
-
127
-	/**
128
-	 * @return never
129
-	 */
130
-	public function delete() {
131
-		throw new Forbidden('Permission denied to delete this collection');
132
-	}
133
-
134
-	/**
135
-	 * @return string
136
-	 *
137
-	 * @psalm-return 'systemtags'
138
-	 */
139
-	public function getName() {
140
-		return 'systemtags';
141
-	}
142
-
143
-	/**
144
-	 * @return never
145
-	 */
146
-	public function setName($name) {
147
-		throw new Forbidden('Permission denied to rename this collection');
148
-	}
149
-
150
-	/**
151
-	 * Returns the last modification time, as a unix timestamp
152
-	 *
153
-	 * @return null
154
-	 */
155
-	public function getLastModified() {
156
-		return null;
157
-	}
158
-
159
-	/**
160
-	 * Create a sabre node for the given system tag
161
-	 *
162
-	 * @param ISystemTag $tag
163
-	 *
164
-	 * @return SystemTagNode
165
-	 */
166
-	private function makeNode(ISystemTag $tag) {
167
-		return new SystemTagNode($tag, $this->userSession->getUser(), $this->isAdmin(), $this->tagManager, $this->tagMapper);
168
-	}
23
+    /**
24
+     * SystemTagsByIdCollection constructor.
25
+     *
26
+     * @param ISystemTagManager $tagManager
27
+     * @param IUserSession $userSession
28
+     * @param IGroupManager $groupManager
29
+     */
30
+    public function __construct(
31
+        private ISystemTagManager $tagManager,
32
+        private IUserSession $userSession,
33
+        private IGroupManager $groupManager,
34
+        protected ISystemTagObjectMapper $tagMapper,
35
+    ) {
36
+    }
37
+
38
+    /**
39
+     * Returns whether the currently logged in user is an administrator
40
+     *
41
+     * @return bool true if the user is an admin
42
+     */
43
+    private function isAdmin() {
44
+        $user = $this->userSession->getUser();
45
+        if ($user !== null) {
46
+            return $this->groupManager->isAdmin($user->getUID());
47
+        }
48
+        return false;
49
+    }
50
+
51
+    /**
52
+     * @param string $name
53
+     * @param resource|string $data Initial payload
54
+     *
55
+     * @throws Forbidden
56
+     *
57
+     * @return never
58
+     */
59
+    public function createFile($name, $data = null) {
60
+        throw new Forbidden('Cannot create tags by id');
61
+    }
62
+
63
+    /**
64
+     * @param string $name
65
+     *
66
+     * @return never
67
+     */
68
+    public function createDirectory($name) {
69
+        throw new Forbidden('Permission denied to create collections');
70
+    }
71
+
72
+    /**
73
+     * @param string $name
74
+     *
75
+     * @return SystemTagNode
76
+     */
77
+    public function getChild($name) {
78
+        try {
79
+            $tag = $this->tagManager->getTagsByIds([$name]);
80
+            $tag = current($tag);
81
+            if (!$this->tagManager->canUserSeeTag($tag, $this->userSession->getUser())) {
82
+                throw new NotFound('Tag with id ' . $name . ' not found');
83
+            }
84
+            return $this->makeNode($tag);
85
+        } catch (\InvalidArgumentException $e) {
86
+            throw new BadRequest('Invalid tag id', 0, $e);
87
+        } catch (TagNotFoundException $e) {
88
+            throw new NotFound('Tag with id ' . $name . ' not found', 0, $e);
89
+        }
90
+    }
91
+
92
+    /**
93
+     * @return SystemTagNode[]
94
+     *
95
+     * @psalm-return array<SystemTagNode>
96
+     */
97
+    public function getChildren() {
98
+        $visibilityFilter = true;
99
+        if ($this->isAdmin()) {
100
+            $visibilityFilter = null;
101
+        }
102
+
103
+        $tags = $this->tagManager->getAllTags($visibilityFilter);
104
+        return array_map(function ($tag) {
105
+            return $this->makeNode($tag);
106
+        }, $tags);
107
+    }
108
+
109
+    /**
110
+     * @param string $name
111
+     */
112
+    public function childExists($name) {
113
+        try {
114
+            $tag = $this->tagManager->getTagsByIds([$name]);
115
+            $tag = current($tag);
116
+            if (!$this->tagManager->canUserSeeTag($tag, $this->userSession->getUser())) {
117
+                return false;
118
+            }
119
+            return true;
120
+        } catch (\InvalidArgumentException $e) {
121
+            throw new BadRequest('Invalid tag id', 0, $e);
122
+        } catch (TagNotFoundException $e) {
123
+            return false;
124
+        }
125
+    }
126
+
127
+    /**
128
+     * @return never
129
+     */
130
+    public function delete() {
131
+        throw new Forbidden('Permission denied to delete this collection');
132
+    }
133
+
134
+    /**
135
+     * @return string
136
+     *
137
+     * @psalm-return 'systemtags'
138
+     */
139
+    public function getName() {
140
+        return 'systemtags';
141
+    }
142
+
143
+    /**
144
+     * @return never
145
+     */
146
+    public function setName($name) {
147
+        throw new Forbidden('Permission denied to rename this collection');
148
+    }
149
+
150
+    /**
151
+     * Returns the last modification time, as a unix timestamp
152
+     *
153
+     * @return null
154
+     */
155
+    public function getLastModified() {
156
+        return null;
157
+    }
158
+
159
+    /**
160
+     * Create a sabre node for the given system tag
161
+     *
162
+     * @param ISystemTag $tag
163
+     *
164
+     * @return SystemTagNode
165
+     */
166
+    private function makeNode(ISystemTag $tag) {
167
+        return new SystemTagNode($tag, $this->userSession->getUser(), $this->isAdmin(), $this->tagManager, $this->tagMapper);
168
+    }
169 169
 }
Please login to merge, or discard this patch.
apps/dav/lib/Upload/UploadFolder.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	public function createDirectory($name) {
42
-		throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
42
+		throw new Forbidden('Permission denied to create file (filename '.$name.')');
43 43
 	}
44 44
 
45 45
 	public function getChild($name) {
Please login to merge, or discard this patch.
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -17,94 +17,94 @@
 block discarded – undo
17 17
 use Sabre\DAV\ICollection;
18 18
 
19 19
 class UploadFolder implements ICollection {
20
-	public function __construct(
21
-		private Directory $node,
22
-		private CleanupService $cleanupService,
23
-		private IStorage $storage,
24
-	) {
25
-	}
26
-
27
-	public function createFile($name, $data = null) {
28
-		// TODO: verify name - should be a simple number
29
-		try {
30
-			$this->node->createFile($name, $data);
31
-		} catch (\Exception $e) {
32
-			if ($this->node->childExists($name)) {
33
-				$child = $this->node->getChild($name);
34
-				$child->delete();
35
-			}
36
-			throw $e;
37
-		}
38
-	}
39
-
40
-	public function createDirectory($name) {
41
-		throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
42
-	}
43
-
44
-	public function getChild($name) {
45
-		if ($name === '.file') {
46
-			return new FutureFile($this->node, '.file');
47
-		}
48
-		return new UploadFile($this->node->getChild($name));
49
-	}
50
-
51
-	public function getChildren() {
52
-		$tmpChildren = $this->node->getChildren();
53
-
54
-		$children = [];
55
-		$children[] = new FutureFile($this->node, '.file');
56
-
57
-		foreach ($tmpChildren as $child) {
58
-			$children[] = new UploadFile($child);
59
-		}
60
-
61
-		if ($this->storage->instanceOfStorage(ObjectStoreStorage::class)) {
62
-			/** @var ObjectStoreStorage $storage */
63
-			$objectStore = $this->storage->getObjectStore();
64
-			if ($objectStore instanceof IObjectStoreMultiPartUpload) {
65
-				$cache = Server::get(ICacheFactory::class)->createDistributed(ChunkingV2Plugin::CACHE_KEY);
66
-				$uploadSession = $cache->get($this->getName());
67
-				if ($uploadSession) {
68
-					$uploadId = $uploadSession[ChunkingV2Plugin::UPLOAD_ID];
69
-					$id = $uploadSession[ChunkingV2Plugin::UPLOAD_TARGET_ID];
70
-					$parts = $objectStore->getMultipartUploads($this->storage->getURN($id), $uploadId);
71
-					foreach ($parts as $part) {
72
-						$children[] = new PartFile($this->node, $part);
73
-					}
74
-				}
75
-			}
76
-		}
77
-
78
-		return $children;
79
-	}
80
-
81
-	public function childExists($name) {
82
-		if ($name === '.file') {
83
-			return true;
84
-		}
85
-		return $this->node->childExists($name);
86
-	}
87
-
88
-	public function delete() {
89
-		$this->node->delete();
90
-
91
-		// Background cleanup job is not needed anymore
92
-		$this->cleanupService->removeJob($this->getName());
93
-	}
94
-
95
-	public function getName() {
96
-		return $this->node->getName();
97
-	}
98
-
99
-	public function setName($name) {
100
-		throw new Forbidden('Permission denied to rename this folder');
101
-	}
102
-
103
-	public function getLastModified() {
104
-		return $this->node->getLastModified();
105
-	}
106
-
107
-	public function getStorage() {
108
-		return $this->storage;
109
-	}
20
+    public function __construct(
21
+        private Directory $node,
22
+        private CleanupService $cleanupService,
23
+        private IStorage $storage,
24
+    ) {
25
+    }
26
+
27
+    public function createFile($name, $data = null) {
28
+        // TODO: verify name - should be a simple number
29
+        try {
30
+            $this->node->createFile($name, $data);
31
+        } catch (\Exception $e) {
32
+            if ($this->node->childExists($name)) {
33
+                $child = $this->node->getChild($name);
34
+                $child->delete();
35
+            }
36
+            throw $e;
37
+        }
38
+    }
39
+
40
+    public function createDirectory($name) {
41
+        throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
42
+    }
43
+
44
+    public function getChild($name) {
45
+        if ($name === '.file') {
46
+            return new FutureFile($this->node, '.file');
47
+        }
48
+        return new UploadFile($this->node->getChild($name));
49
+    }
50
+
51
+    public function getChildren() {
52
+        $tmpChildren = $this->node->getChildren();
53
+
54
+        $children = [];
55
+        $children[] = new FutureFile($this->node, '.file');
56
+
57
+        foreach ($tmpChildren as $child) {
58
+            $children[] = new UploadFile($child);
59
+        }
60
+
61
+        if ($this->storage->instanceOfStorage(ObjectStoreStorage::class)) {
62
+            /** @var ObjectStoreStorage $storage */
63
+            $objectStore = $this->storage->getObjectStore();
64
+            if ($objectStore instanceof IObjectStoreMultiPartUpload) {
65
+                $cache = Server::get(ICacheFactory::class)->createDistributed(ChunkingV2Plugin::CACHE_KEY);
66
+                $uploadSession = $cache->get($this->getName());
67
+                if ($uploadSession) {
68
+                    $uploadId = $uploadSession[ChunkingV2Plugin::UPLOAD_ID];
69
+                    $id = $uploadSession[ChunkingV2Plugin::UPLOAD_TARGET_ID];
70
+                    $parts = $objectStore->getMultipartUploads($this->storage->getURN($id), $uploadId);
71
+                    foreach ($parts as $part) {
72
+                        $children[] = new PartFile($this->node, $part);
73
+                    }
74
+                }
75
+            }
76
+        }
77
+
78
+        return $children;
79
+    }
80
+
81
+    public function childExists($name) {
82
+        if ($name === '.file') {
83
+            return true;
84
+        }
85
+        return $this->node->childExists($name);
86
+    }
87
+
88
+    public function delete() {
89
+        $this->node->delete();
90
+
91
+        // Background cleanup job is not needed anymore
92
+        $this->cleanupService->removeJob($this->getName());
93
+    }
94
+
95
+    public function getName() {
96
+        return $this->node->getName();
97
+    }
98
+
99
+    public function setName($name) {
100
+        throw new Forbidden('Permission denied to rename this folder');
101
+    }
102
+
103
+    public function getLastModified() {
104
+        return $this->node->getLastModified();
105
+    }
106
+
107
+    public function getStorage() {
108
+        return $this->storage;
109
+    }
110 110
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/Swift.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
51 51
 			])
52 52
 			->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)
53
-			->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) {
53
+			->setLegacyAuthMechanismCallback(function(array $params) use ($openstackAuth, $rackspaceAuth) {
54 54
 				if (isset($params['options']['key']) && $params['options']['key']) {
55 55
 					return $rackspaceAuth;
56 56
 				}
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,29 +33,29 @@
 block discarded – undo
33 33
 use OCP\IL10N;
34 34
 
35 35
 class Swift extends Backend {
36
-	use LegacyDependencyCheckPolyfill;
36
+    use LegacyDependencyCheckPolyfill;
37 37
 
38
-	public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) {
39
-		$this
40
-			->setIdentifier('swift')
41
-			->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat
42
-			->setStorageClass('\OCA\Files_External\Lib\Storage\Swift')
43
-			->setText($l->t('OpenStack Object Storage'))
44
-			->addParameters([
45
-				(new DefinitionParameter('service_name', $l->t('Service name')))
46
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
47
-				new DefinitionParameter('region', $l->t('Region')),
48
-				new DefinitionParameter('bucket', $l->t('Bucket')),
49
-				(new DefinitionParameter('timeout', $l->t('Request timeout (seconds)')))
50
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
51
-			])
52
-			->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)
53
-			->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) {
54
-				if (isset($params['options']['key']) && $params['options']['key']) {
55
-					return $rackspaceAuth;
56
-				}
57
-				return $openstackAuth;
58
-			})
59
-		;
60
-	}
38
+    public function __construct(IL10N $l, OpenStackV2 $openstackAuth, Rackspace $rackspaceAuth) {
39
+        $this
40
+            ->setIdentifier('swift')
41
+            ->addIdentifierAlias('\OC\Files\Storage\Swift') // legacy compat
42
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\Swift')
43
+            ->setText($l->t('OpenStack Object Storage'))
44
+            ->addParameters([
45
+                (new DefinitionParameter('service_name', $l->t('Service name')))
46
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
47
+                new DefinitionParameter('region', $l->t('Region')),
48
+                new DefinitionParameter('bucket', $l->t('Bucket')),
49
+                (new DefinitionParameter('timeout', $l->t('Request timeout (seconds)')))
50
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
51
+            ])
52
+            ->addAuthScheme(AuthMechanism::SCHEME_OPENSTACK)
53
+            ->setLegacyAuthMechanismCallback(function (array $params) use ($openstackAuth, $rackspaceAuth) {
54
+                if (isset($params['options']['key']) && $params['options']['key']) {
55
+                    return $rackspaceAuth;
56
+                }
57
+                return $openstackAuth;
58
+            })
59
+        ;
60
+    }
61 61
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/VisibilityTrait.php 1 patch
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -36,101 +36,101 @@
 block discarded – undo
36 36
  */
37 37
 trait VisibilityTrait {
38 38
 
39
-	/** @var int visibility */
40
-	protected $visibility = BackendService::VISIBILITY_DEFAULT;
39
+    /** @var int visibility */
40
+    protected $visibility = BackendService::VISIBILITY_DEFAULT;
41 41
 
42
-	/** @var int allowed visibilities */
43
-	protected $allowedVisibility = BackendService::VISIBILITY_DEFAULT;
42
+    /** @var int allowed visibilities */
43
+    protected $allowedVisibility = BackendService::VISIBILITY_DEFAULT;
44 44
 
45
-	/**
46
-	 * @return int
47
-	 */
48
-	public function getVisibility() {
49
-		return $this->visibility;
50
-	}
45
+    /**
46
+     * @return int
47
+     */
48
+    public function getVisibility() {
49
+        return $this->visibility;
50
+    }
51 51
 
52
-	/**
53
-	 * Check if the backend is visible for a user type
54
-	 *
55
-	 * @param int $visibility
56
-	 * @return bool
57
-	 */
58
-	public function isVisibleFor($visibility) {
59
-		if ($this->visibility & $visibility) {
60
-			return true;
61
-		}
62
-		return false;
63
-	}
52
+    /**
53
+     * Check if the backend is visible for a user type
54
+     *
55
+     * @param int $visibility
56
+     * @return bool
57
+     */
58
+    public function isVisibleFor($visibility) {
59
+        if ($this->visibility & $visibility) {
60
+            return true;
61
+        }
62
+        return false;
63
+    }
64 64
 
65
-	/**
66
-	 * @param int $visibility
67
-	 * @return self
68
-	 */
69
-	public function setVisibility($visibility) {
70
-		$this->visibility = $visibility;
71
-		$this->allowedVisibility |= $visibility;
72
-		return $this;
73
-	}
65
+    /**
66
+     * @param int $visibility
67
+     * @return self
68
+     */
69
+    public function setVisibility($visibility) {
70
+        $this->visibility = $visibility;
71
+        $this->allowedVisibility |= $visibility;
72
+        return $this;
73
+    }
74 74
 
75
-	/**
76
-	 * @param int $visibility
77
-	 * @return self
78
-	 */
79
-	public function addVisibility($visibility) {
80
-		return $this->setVisibility($this->visibility | $visibility);
81
-	}
75
+    /**
76
+     * @param int $visibility
77
+     * @return self
78
+     */
79
+    public function addVisibility($visibility) {
80
+        return $this->setVisibility($this->visibility | $visibility);
81
+    }
82 82
 
83
-	/**
84
-	 * @param int $visibility
85
-	 * @return self
86
-	 */
87
-	public function removeVisibility($visibility) {
88
-		return $this->setVisibility($this->visibility & ~$visibility);
89
-	}
83
+    /**
84
+     * @param int $visibility
85
+     * @return self
86
+     */
87
+    public function removeVisibility($visibility) {
88
+        return $this->setVisibility($this->visibility & ~$visibility);
89
+    }
90 90
 
91
-	/**
92
-	 * @return int
93
-	 */
94
-	public function getAllowedVisibility() {
95
-		return $this->allowedVisibility;
96
-	}
91
+    /**
92
+     * @return int
93
+     */
94
+    public function getAllowedVisibility() {
95
+        return $this->allowedVisibility;
96
+    }
97 97
 
98
-	/**
99
-	 * Check if the backend is allowed to be visible for a user type
100
-	 *
101
-	 * @param int $allowedVisibility
102
-	 * @return bool
103
-	 */
104
-	public function isAllowedVisibleFor($allowedVisibility) {
105
-		if ($this->allowedVisibility & $allowedVisibility) {
106
-			return true;
107
-		}
108
-		return false;
109
-	}
98
+    /**
99
+     * Check if the backend is allowed to be visible for a user type
100
+     *
101
+     * @param int $allowedVisibility
102
+     * @return bool
103
+     */
104
+    public function isAllowedVisibleFor($allowedVisibility) {
105
+        if ($this->allowedVisibility & $allowedVisibility) {
106
+            return true;
107
+        }
108
+        return false;
109
+    }
110 110
 
111
-	/**
112
-	 * @param int $allowedVisibility
113
-	 * @return self
114
-	 */
115
-	public function setAllowedVisibility($allowedVisibility) {
116
-		$this->allowedVisibility = $allowedVisibility;
117
-		$this->visibility &= $allowedVisibility;
118
-		return $this;
119
-	}
111
+    /**
112
+     * @param int $allowedVisibility
113
+     * @return self
114
+     */
115
+    public function setAllowedVisibility($allowedVisibility) {
116
+        $this->allowedVisibility = $allowedVisibility;
117
+        $this->visibility &= $allowedVisibility;
118
+        return $this;
119
+    }
120 120
 
121
-	/**
122
-	 * @param int $allowedVisibility
123
-	 * @return self
124
-	 */
125
-	public function addAllowedVisibility($allowedVisibility) {
126
-		return $this->setAllowedVisibility($this->allowedVisibility | $allowedVisibility);
127
-	}
121
+    /**
122
+     * @param int $allowedVisibility
123
+     * @return self
124
+     */
125
+    public function addAllowedVisibility($allowedVisibility) {
126
+        return $this->setAllowedVisibility($this->allowedVisibility | $allowedVisibility);
127
+    }
128 128
 
129
-	/**
130
-	 * @param int $allowedVisibility
131
-	 * @return self
132
-	 */
133
-	public function removeAllowedVisibility($allowedVisibility) {
134
-		return $this->setAllowedVisibility($this->allowedVisibility & ~$allowedVisibility);
135
-	}
129
+    /**
130
+     * @param int $allowedVisibility
131
+     * @return self
132
+     */
133
+    public function removeAllowedVisibility($allowedVisibility) {
134
+        return $this->setAllowedVisibility($this->allowedVisibility & ~$allowedVisibility);
135
+    }
136 136
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/Builtin.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
  * Builtin authentication mechanism, for legacy backends
29 29
  */
30 30
 class Builtin extends AuthMechanism {
31
-	public function __construct(IL10N $l) {
32
-		$this
33
-			->setIdentifier('builtin::builtin')
34
-			->setScheme(self::SCHEME_BUILTIN)
35
-			->setText($l->t('Builtin'))
36
-		;
37
-	}
31
+    public function __construct(IL10N $l) {
32
+        $this
33
+            ->setIdentifier('builtin::builtin')
34
+            ->setScheme(self::SCHEME_BUILTIN)
35
+            ->setText($l->t('Builtin'))
36
+        ;
37
+    }
38 38
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Auth/NullMechanism.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
  * Null authentication mechanism
29 29
  */
30 30
 class NullMechanism extends AuthMechanism {
31
-	public function __construct(IL10N $l) {
32
-		$this
33
-			->setIdentifier('null::null')
34
-			->setScheme(self::SCHEME_NULL)
35
-			->setText($l->t('None'))
36
-		;
37
-	}
31
+    public function __construct(IL10N $l) {
32
+        $this
33
+            ->setIdentifier('null::null')
34
+            ->setScheme(self::SCHEME_NULL)
35
+            ->setText($l->t('None'))
36
+        ;
37
+    }
38 38
 }
Please login to merge, or discard this patch.
apps/comments/lib/Notification/Listener.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		$notification
91 91
 			->setApp('comments')
92 92
 			->setObject('comment', $comment->getId())
93
-			->setSubject('mention', [ $comment->getObjectType(), $comment->getObjectId() ])
93
+			->setSubject('mention', [$comment->getObjectType(), $comment->getObjectId()])
94 94
 			->setDateTime($comment->getCreationDateTime());
95 95
 
96 96
 		return $notification;
Please login to merge, or discard this patch.
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -14,71 +14,71 @@
 block discarded – undo
14 14
 use OCP\Notification\INotification;
15 15
 
16 16
 class Listener {
17
-	public function __construct(
18
-		protected IManager $notificationManager,
19
-		protected IUserManager $userManager,
20
-	) {
21
-	}
17
+    public function __construct(
18
+        protected IManager $notificationManager,
19
+        protected IUserManager $userManager,
20
+    ) {
21
+    }
22 22
 
23
-	public function evaluate(CommentsEvent $event): void {
24
-		$comment = $event->getComment();
23
+    public function evaluate(CommentsEvent $event): void {
24
+        $comment = $event->getComment();
25 25
 
26
-		$mentions = $this->extractMentions($comment->getMentions());
27
-		if (empty($mentions)) {
28
-			// no one to notify
29
-			return;
30
-		}
26
+        $mentions = $this->extractMentions($comment->getMentions());
27
+        if (empty($mentions)) {
28
+            // no one to notify
29
+            return;
30
+        }
31 31
 
32
-		$notification = $this->instantiateNotification($comment);
32
+        $notification = $this->instantiateNotification($comment);
33 33
 
34
-		foreach ($mentions as $uid) {
35
-			if (($comment->getActorType() === 'users' && $uid === $comment->getActorId())
36
-				|| !$this->userManager->userExists($uid)
37
-			) {
38
-				// do not notify unknown users or yourself
39
-				continue;
40
-			}
34
+        foreach ($mentions as $uid) {
35
+            if (($comment->getActorType() === 'users' && $uid === $comment->getActorId())
36
+                || !$this->userManager->userExists($uid)
37
+            ) {
38
+                // do not notify unknown users or yourself
39
+                continue;
40
+            }
41 41
 
42
-			$notification->setUser($uid);
43
-			if ($event->getEvent() === CommentsEvent::EVENT_DELETE
44
-				|| $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE) {
45
-				$this->notificationManager->markProcessed($notification);
46
-			} else {
47
-				$this->notificationManager->notify($notification);
48
-			}
49
-		}
50
-	}
42
+            $notification->setUser($uid);
43
+            if ($event->getEvent() === CommentsEvent::EVENT_DELETE
44
+                || $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE) {
45
+                $this->notificationManager->markProcessed($notification);
46
+            } else {
47
+                $this->notificationManager->notify($notification);
48
+            }
49
+        }
50
+    }
51 51
 
52
-	/**
53
-	 * Creates a notification instance and fills it with comment data
54
-	 */
55
-	public function instantiateNotification(IComment $comment): INotification {
56
-		$notification = $this->notificationManager->createNotification();
57
-		$notification
58
-			->setApp('comments')
59
-			->setObject('comment', $comment->getId())
60
-			->setSubject('mention', [ $comment->getObjectType(), $comment->getObjectId() ])
61
-			->setDateTime($comment->getCreationDateTime());
52
+    /**
53
+     * Creates a notification instance and fills it with comment data
54
+     */
55
+    public function instantiateNotification(IComment $comment): INotification {
56
+        $notification = $this->notificationManager->createNotification();
57
+        $notification
58
+            ->setApp('comments')
59
+            ->setObject('comment', $comment->getId())
60
+            ->setSubject('mention', [ $comment->getObjectType(), $comment->getObjectId() ])
61
+            ->setDateTime($comment->getCreationDateTime());
62 62
 
63
-		return $notification;
64
-	}
63
+        return $notification;
64
+    }
65 65
 
66
-	/**
67
-	 * Flattens the mention array returned from comments to a list of user ids.
68
-	 *
69
-	 * @param array $mentions
70
-	 * @return list<string> containing the mentions, e.g. ['alice', 'bob']
71
-	 */
72
-	public function extractMentions(array $mentions): array {
73
-		if (empty($mentions)) {
74
-			return [];
75
-		}
76
-		$uids = [];
77
-		foreach ($mentions as $mention) {
78
-			if ($mention['type'] === 'user') {
79
-				$uids[] = $mention['id'];
80
-			}
81
-		}
82
-		return $uids;
83
-	}
66
+    /**
67
+     * Flattens the mention array returned from comments to a list of user ids.
68
+     *
69
+     * @param array $mentions
70
+     * @return list<string> containing the mentions, e.g. ['alice', 'bob']
71
+     */
72
+    public function extractMentions(array $mentions): array {
73
+        if (empty($mentions)) {
74
+            return [];
75
+        }
76
+        $uids = [];
77
+        foreach ($mentions as $mention) {
78
+            if ($mention['type'] === 'user') {
79
+                $uids[] = $mention['id'];
80
+            }
81
+        }
82
+        return $uids;
83
+    }
84 84
 }
Please login to merge, or discard this patch.
apps/encryption/lib/Crypto/DecryptAll.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
 				if ($useLoginPassword) {
100 100
 					$question = new Question('Please enter the user\'s login password: ');
101 101
 				} elseif ($this->util->isRecoveryEnabledForUser($user) === false) {
102
-					$output->writeln('No recovery key available for user ' . $user);
102
+					$output->writeln('No recovery key available for user '.$user);
103 103
 					return false;
104 104
 				} else {
105 105
 					$user = $recoveryKeyId;
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -19,106 +19,106 @@
 block discarded – undo
19 19
 
20 20
 class DecryptAll {
21 21
 
22
-	/**
23
-	 * @param Util $util
24
-	 * @param KeyManager $keyManager
25
-	 * @param Crypt $crypt
26
-	 * @param Session $session
27
-	 * @param QuestionHelper $questionHelper
28
-	 */
29
-	public function __construct(
30
-		protected Util $util,
31
-		protected KeyManager $keyManager,
32
-		protected Crypt $crypt,
33
-		protected Session $session,
34
-		protected QuestionHelper $questionHelper,
35
-	) {
36
-	}
22
+    /**
23
+     * @param Util $util
24
+     * @param KeyManager $keyManager
25
+     * @param Crypt $crypt
26
+     * @param Session $session
27
+     * @param QuestionHelper $questionHelper
28
+     */
29
+    public function __construct(
30
+        protected Util $util,
31
+        protected KeyManager $keyManager,
32
+        protected Crypt $crypt,
33
+        protected Session $session,
34
+        protected QuestionHelper $questionHelper,
35
+    ) {
36
+    }
37 37
 
38
-	/**
39
-	 * prepare encryption module to decrypt all files
40
-	 *
41
-	 * @param InputInterface $input
42
-	 * @param OutputInterface $output
43
-	 * @param $user
44
-	 * @return bool
45
-	 */
46
-	public function prepare(InputInterface $input, OutputInterface $output, $user) {
47
-		$question = new Question('Please enter the recovery key password: ');
38
+    /**
39
+     * prepare encryption module to decrypt all files
40
+     *
41
+     * @param InputInterface $input
42
+     * @param OutputInterface $output
43
+     * @param $user
44
+     * @return bool
45
+     */
46
+    public function prepare(InputInterface $input, OutputInterface $output, $user) {
47
+        $question = new Question('Please enter the recovery key password: ');
48 48
 
49
-		if ($this->util->isMasterKeyEnabled()) {
50
-			$output->writeln('Use master key to decrypt all files');
51
-			$user = $this->keyManager->getMasterKeyId();
52
-			$password = $this->keyManager->getMasterKeyPassword();
53
-		} else {
54
-			$recoveryKeyId = $this->keyManager->getRecoveryKeyId();
55
-			if (!empty($user)) {
56
-				$output->writeln('You can only decrypt the users files if you know');
57
-				$output->writeln('the users password or if they activated the recovery key.');
58
-				$output->writeln('');
59
-				$questionUseLoginPassword = new ConfirmationQuestion(
60
-					'Do you want to use the users login password to decrypt all files? (y/n) ',
61
-					false
62
-				);
63
-				$useLoginPassword = $this->questionHelper->ask($input, $output, $questionUseLoginPassword);
64
-				if ($useLoginPassword) {
65
-					$question = new Question('Please enter the user\'s login password: ');
66
-				} elseif ($this->util->isRecoveryEnabledForUser($user) === false) {
67
-					$output->writeln('No recovery key available for user ' . $user);
68
-					return false;
69
-				} else {
70
-					$user = $recoveryKeyId;
71
-				}
72
-			} else {
73
-				$output->writeln('You can only decrypt the files of all users if the');
74
-				$output->writeln('recovery key is enabled by the admin and activated by the users.');
75
-				$output->writeln('');
76
-				$user = $recoveryKeyId;
77
-			}
49
+        if ($this->util->isMasterKeyEnabled()) {
50
+            $output->writeln('Use master key to decrypt all files');
51
+            $user = $this->keyManager->getMasterKeyId();
52
+            $password = $this->keyManager->getMasterKeyPassword();
53
+        } else {
54
+            $recoveryKeyId = $this->keyManager->getRecoveryKeyId();
55
+            if (!empty($user)) {
56
+                $output->writeln('You can only decrypt the users files if you know');
57
+                $output->writeln('the users password or if they activated the recovery key.');
58
+                $output->writeln('');
59
+                $questionUseLoginPassword = new ConfirmationQuestion(
60
+                    'Do you want to use the users login password to decrypt all files? (y/n) ',
61
+                    false
62
+                );
63
+                $useLoginPassword = $this->questionHelper->ask($input, $output, $questionUseLoginPassword);
64
+                if ($useLoginPassword) {
65
+                    $question = new Question('Please enter the user\'s login password: ');
66
+                } elseif ($this->util->isRecoveryEnabledForUser($user) === false) {
67
+                    $output->writeln('No recovery key available for user ' . $user);
68
+                    return false;
69
+                } else {
70
+                    $user = $recoveryKeyId;
71
+                }
72
+            } else {
73
+                $output->writeln('You can only decrypt the files of all users if the');
74
+                $output->writeln('recovery key is enabled by the admin and activated by the users.');
75
+                $output->writeln('');
76
+                $user = $recoveryKeyId;
77
+            }
78 78
 
79
-			$question->setHidden(true);
80
-			$question->setHiddenFallback(false);
81
-			$password = $this->questionHelper->ask($input, $output, $question);
82
-		}
79
+            $question->setHidden(true);
80
+            $question->setHiddenFallback(false);
81
+            $password = $this->questionHelper->ask($input, $output, $question);
82
+        }
83 83
 
84
-		$privateKey = $this->getPrivateKey($user, $password);
85
-		if ($privateKey !== false) {
86
-			$this->updateSession($user, $privateKey);
87
-			return true;
88
-		} else {
89
-			$output->writeln('Could not decrypt private key, maybe you entered the wrong password?');
90
-		}
84
+        $privateKey = $this->getPrivateKey($user, $password);
85
+        if ($privateKey !== false) {
86
+            $this->updateSession($user, $privateKey);
87
+            return true;
88
+        } else {
89
+            $output->writeln('Could not decrypt private key, maybe you entered the wrong password?');
90
+        }
91 91
 
92 92
 
93
-		return false;
94
-	}
93
+        return false;
94
+    }
95 95
 
96
-	/**
97
-	 * get the private key which will be used to decrypt all files
98
-	 *
99
-	 * @param string $user
100
-	 * @param string $password
101
-	 * @return bool|string
102
-	 * @throws PrivateKeyMissingException
103
-	 */
104
-	protected function getPrivateKey($user, $password) {
105
-		$recoveryKeyId = $this->keyManager->getRecoveryKeyId();
106
-		$masterKeyId = $this->keyManager->getMasterKeyId();
107
-		if ($user === $recoveryKeyId) {
108
-			$recoveryKey = $this->keyManager->getSystemPrivateKey($recoveryKeyId);
109
-			$privateKey = $this->crypt->decryptPrivateKey($recoveryKey, $password);
110
-		} elseif ($user === $masterKeyId) {
111
-			$masterKey = $this->keyManager->getSystemPrivateKey($masterKeyId);
112
-			$privateKey = $this->crypt->decryptPrivateKey($masterKey, $password, $masterKeyId);
113
-		} else {
114
-			$userKey = $this->keyManager->getPrivateKey($user);
115
-			$privateKey = $this->crypt->decryptPrivateKey($userKey, $password, $user);
116
-		}
96
+    /**
97
+     * get the private key which will be used to decrypt all files
98
+     *
99
+     * @param string $user
100
+     * @param string $password
101
+     * @return bool|string
102
+     * @throws PrivateKeyMissingException
103
+     */
104
+    protected function getPrivateKey($user, $password) {
105
+        $recoveryKeyId = $this->keyManager->getRecoveryKeyId();
106
+        $masterKeyId = $this->keyManager->getMasterKeyId();
107
+        if ($user === $recoveryKeyId) {
108
+            $recoveryKey = $this->keyManager->getSystemPrivateKey($recoveryKeyId);
109
+            $privateKey = $this->crypt->decryptPrivateKey($recoveryKey, $password);
110
+        } elseif ($user === $masterKeyId) {
111
+            $masterKey = $this->keyManager->getSystemPrivateKey($masterKeyId);
112
+            $privateKey = $this->crypt->decryptPrivateKey($masterKey, $password, $masterKeyId);
113
+        } else {
114
+            $userKey = $this->keyManager->getPrivateKey($user);
115
+            $privateKey = $this->crypt->decryptPrivateKey($userKey, $password, $user);
116
+        }
117 117
 
118
-		return $privateKey;
119
-	}
118
+        return $privateKey;
119
+    }
120 120
 
121
-	protected function updateSession($user, $privateKey) {
122
-		$this->session->prepareDecryptAll($user, $privateKey);
123
-	}
121
+    protected function updateSession($user, $privateKey) {
122
+        $this->session->prepareDecryptAll($user, $privateKey);
123
+    }
124 124
 }
Please login to merge, or discard this patch.