diff options
author | Baptiste Fotia <fotia.baptiste@hotmail.com> | 2022-10-03 17:14:39 +0300 |
---|---|---|
committer | Baptiste Fotia <fotia.baptiste@hotmail.com> | 2022-10-03 17:27:50 +0300 |
commit | f3f7de95bdfdb1b746e19b268b7095bcff861e16 (patch) | |
tree | e98df4f241e132c6da992fba08d58595683fd282 /lib/Service/DelegationService.php | |
parent | 409877f0a0380e21dc7ee70c5f3a6cbd9390cad7 (diff) |
chore(cs): Apply cs:fix
Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
Diffstat (limited to 'lib/Service/DelegationService.php')
-rw-r--r-- | lib/Service/DelegationService.php | 118 |
1 files changed, 56 insertions, 62 deletions
diff --git a/lib/Service/DelegationService.php b/lib/Service/DelegationService.php index de163de6..f83a701f 100644 --- a/lib/Service/DelegationService.php +++ b/lib/Service/DelegationService.php @@ -25,71 +25,65 @@ use OCP\IConfig; use OCP\IGroupManager; use OCP\IUserSession; -class DelegationService -{ - private IConfig $config; - private IGroupManager $groupManager; - private IUserSession $userSession; +class DelegationService { + private IConfig $config; + private IGroupManager $groupManager; + private IUserSession $userSession; - public function __construct( - IConfig $config, - IGroupManager $groupManager, - IUserSession $userSession - ) - { - $this->config = $config; - $this->groupManager = $groupManager; - $this->userSession = $userSession; - } + public function __construct( + IConfig $config, + IGroupManager $groupManager, + IUserSession $userSession + ) { + $this->config = $config; + $this->groupManager = $groupManager; + $this->userSession = $userSession; + } - /** - * @return bool true is admin of nextcloud otherwise false. - */ - public function isAdminNextcloud(): bool - { - return $this->groupManager->isAdmin($this->userSession->getUser()->getUID()); - } + /** + * @return bool true is admin of nextcloud otherwise false. + */ + public function isAdminNextcloud(): bool { + return $this->groupManager->isAdmin($this->userSession->getUser()->getUID()); + } - /** - * Return true if user is a member of a group that - * has been granted admin rights on groupfolders - * - * @return bool - */ - public function isAdmin(): bool - { - $allowedGroups = json_decode($this->config->getAppValue('groupfolders', 'delegated-admins', '[]')); - $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); - foreach ($userGroups as $userGroup) { - if (in_array($userGroup->getGID(), $allowedGroups)) { - return true; - } - } - return false; - } + /** + * Return true if user is a member of a group that + * has been granted admin rights on groupfolders + * + * @return bool + */ + public function isAdmin(): bool { + $allowedGroups = json_decode($this->config->getAppValue('groupfolders', 'delegated-admins', '[]')); + $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); + foreach ($userGroups as $userGroup) { + if (in_array($userGroup->getGID(), $allowedGroups)) { + return true; + } + } + return false; + } - /** - * Return true if user is an admin. - * @return bool - */ - public function isSubAdmin(): bool - { - $allowedGroups = json_decode($this->config->getAppValue('groupfolders', 'delegated-sub-admins', '[]')); - $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); - foreach ($userGroups as $userGroup) { - if (in_array($userGroup->getGID(), $allowedGroups)) { - return true; - } - } - return false; - } + /** + * Return true if user is an admin. + * @return bool + */ + public function isSubAdmin(): bool { + $allowedGroups = json_decode($this->config->getAppValue('groupfolders', 'delegated-sub-admins', '[]')); + $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); + foreach ($userGroups as $userGroup) { + if (in_array($userGroup->getGID(), $allowedGroups)) { + return true; + } + } + return false; + } - /** - * Return true if user is admin or subadmin. - * @return bool - */ - public function isAdminOrSubAdmin(): bool - { - return $this->isAdmin() || $this->isSubAdmin(); - } + /** + * Return true if user is admin or subadmin. + * @return bool + */ + public function isAdminOrSubAdmin(): bool { + return $this->isAdmin() || $this->isSubAdmin(); + } } |