Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/groupfolders.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Fotia <fotia.baptiste@hotmail.com>2022-09-05 18:33:00 +0300
committerBaptiste Fotia <fotia.baptiste@hotmail.com>2022-09-19 17:18:23 +0300
commitfe551ef9c9ed12d2b80d8d011d9592122245a080 (patch)
tree28b7cb3c470b1fac1f075291cddb0040beda516d /lib/Service/DelegationService.php
parentf318f2a98970c85d6c90a82a3e9773e334296e64 (diff)
feat(PHP): Allow users API/REST only to use functions from FolderController.php
The DelegatedAdminsMiddleware.php middleware allows users who only have access to the groupfolders API/REST to use the functions of FolderController.php without event using the Delegation Admin from settings. It's a bit like a 'function overloading' : https://www.wikiwand.com/en/Function_overloading Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
Diffstat (limited to 'lib/Service/DelegationService.php')
-rw-r--r--lib/Service/DelegationService.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Service/DelegationService.php b/lib/Service/DelegationService.php
index dbaa1c9e..0377e6e0 100644
--- a/lib/Service/DelegationService.php
+++ b/lib/Service/DelegationService.php
@@ -45,15 +45,19 @@ class DelegationService {
}
/**
+ * @return bool true is admin of nextcloud otherwise false.
+ */
+ public function isAdminNextcloud() {
+ 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() {
- if ($this->groupManager->isAdmin($this->userSession->getUser()->getUID())) {
- return true;
- }
$allowedGroups = json_decode($this->config->getAppValue('groupfolders', 'delegated-admins', '[]'));
$userGroups = $this->groupManager->getUserGroups($this->userSession->getUser());
foreach ($userGroups as $userGroup) {