瀏覽代碼

create or update be user in the resetPerms method

Olivier Massot 4 年之前
父節點
當前提交
91f05891a1

文件差異過大導致無法顯示
+ 21 - 25
ot_admin/Classes/Controller/SiteController.php


+ 29 - 1
ot_admin/Classes/Http/ApiController.php

@@ -254,7 +254,7 @@ class ApiController implements LoggerAwareInterface
     }
 
     /**
-     * -- Target of the route 'site_set_domain' --
+     * -- Target of the route 'site_setdomain' --
      * >> Requires a query param named 'organization-id' (int)
      *
      * Set a new domain for the organization website
@@ -287,6 +287,34 @@ class ApiController implements LoggerAwareInterface
         );
     }
 
+
+    /**
+     * -- Target of the route 'site_resetperms' --
+     * >> Requires a query param named 'organization-id' (int)
+     *
+     * Reset the permissions of the website be users (admin, editors...)
+     *
+     * @param ServerRequest $request
+     * @return JsonResponse
+     * @throws \Exception
+     */
+    public function resetBeUserPermsAction(ServerRequest $request) {
+        $this->assertIpAllowed();
+
+        $organizationId = $this->getOrganizationId($request);
+
+        $controller = GeneralUtility::makeInstance(ObjectManager::class)->get(SiteController::class);
+        $rootUid = $controller->resetBeUserPermsAction($organizationId);
+
+        return new JsonResponse(
+            [
+                'organization_id' => $organizationId,
+                'msg' => "The website with root uid " . $rootUid . " had its be users permissions reset",
+                'root_uid' => $rootUid
+            ]
+        );
+    }
+
     /**
      * -- Target of the route 'site_status' --
      * >> Requires a query param named 'organization-id' (int)

+ 5 - 0
ot_admin/Configuration/Backend/Routes.php

@@ -37,6 +37,11 @@ return [
         'target' => ApiController::class . '::setSiteDomainAction',
         'access' => 'public'
     ],
+    'site_resetperms' => [
+        'path' => '/otadmin/site/reset-perms',
+        'target' => ApiController::class . '::resetBeUserPermsAction',
+        'access' => 'public'
+    ],
     'site_status' => [
         'path' => '/otadmin/site/status',
         'target' => ApiController::class . '::getSiteStatusAction',

部分文件因文件數量過多而無法顯示