Code Duplication    Length = 7-9 lines in 5 locations

apps/dav/lib/SystemTag/SystemTagsByIdCollection.php 1 location

@@ 75-81 (lines=7) @@
72
	 *
73
	 * @return bool true if the user is an admin
74
	 */
75
	private function isAdmin() {
76
		$user = $this->userSession->getUser();
77
		if ($user !== null) {
78
			return $this->groupManager->isAdmin($user->getUID());
79
		}
80
		return false;
81
	}
82
83
	/**
84
	 * @param string $name

lib/private/NavigationManager.php 1 location

@@ 180-186 (lines=7) @@
177
		}
178
	}
179
180
	private function isAdmin() {
181
		$user = $this->userSession->getUser();
182
		if ($user !== null) {
183
			return $this->groupManager->isAdmin($user->getUID());
184
		}
185
		return false;
186
	}
187
188
}
189

apps/dav/lib/Connector/Sabre/FilesReportPlugin.php 1 location

@@ 391-397 (lines=7) @@
388
	/**
389
	 * Returns whether the currently logged in user is an administrator
390
	 */
391
	private function isAdmin() {
392
		$user = $this->userSession->getUser();
393
		if ($user !== null) {
394
			return $this->groupManager->isAdmin($user->getUID());
395
		}
396
		return false;
397
	}
398
}
399

settings/Controller/UsersController.php 1 location

@@ 935-943 (lines=9) @@
932
		);
933
	}
934
935
	private function isAdmin() {
936
		// Check if current user (active and not in incognito mode)
937
		// is an admin
938
		$activeUser = $this->userSession->getUser();
939
		if($activeUser !== null) {
940
			return $this->groupManager->isAdmin($activeUser->getUID());
941
		}
942
		return false;
943
	}
944
}
945

settings/Controller/GroupsController.php 1 location

@@ 162-169 (lines=8) @@
159
	 *
160
	 * @return bool
161
	 */
162
	private function isAdmin() {
163
		// Get current user (active and not in incognito mode)
164
		$user = $this->userSession->getUser();
165
		if(!is_null($user)) {
166
			return $this->groupManager->isAdmin($user->getUID());
167
		}
168
		return false;
169
	}
170
}
171