瀏覽代碼

finalise the be_users creation/update with new perms implementation

Olivier Massot 4 年之前
父節點
當前提交
5170b9e4ea

+ 9 - 2
ot_admin/Classes/Command/ResetBeUserPermsCommand.php

@@ -45,6 +45,12 @@ class ResetBeUserPermsCommand extends Command
                 null,
                 InputOption::VALUE_NONE,
                 "Reset all of the websites be_users permissions."
+            )
+            ->addOption(
+                "create",
+                'c',
+                InputOption::VALUE_NONE,
+                "Create the be_user and/or be_group when they are missing"
             );
     }
 
@@ -59,6 +65,7 @@ class ResetBeUserPermsCommand extends Command
     {
         $org_id = $input->getArgument('organization-id');
         $all = $input->getOption('all');
+        $create = $input->getOption('create');
 
         if ($all && $org_id) {
             throw new \InvalidArgumentException("You can not pass both an organization id and the --all option");
@@ -72,10 +79,10 @@ class ResetBeUserPermsCommand extends Command
         $siteController = GeneralUtility::makeInstance(ObjectManager::class)->get(SiteController::class);
 
         if ($all) {
-            $siteController->resetAllBeUserPermsAction();
+            $siteController->resetAllBeUserPermsAction($create);
             $io->success(sprintf("Be users permissions were reset for every website"));
         } else {
-            $rootUid = $siteController->resetBeUserPermsAction($org_id);
+            $rootUid = $siteController->resetBeUserPermsAction($org_id, $create);
             $io->success(sprintf("The website with root uid " . $rootUid . " had its be users permissions reset"));
         }
     }

File diff suppressed because it is too large
+ 80 - 22
ot_admin/Classes/Controller/SiteController.php


+ 15 - 0
ot_admin/Classes/Exception/NoSuchRecordException.php

@@ -0,0 +1,15 @@
+<?php
+
+
+namespace Opentalent\OtAdmin\Exception;
+
+
+use Exception;
+
+/**
+ * Class NoSuchRecord
+ * Raise this exception when a non-existing record is fetched
+ *
+ * @package Opentalent\OtCore\Exception
+ */
+class NoSuchRecordException extends Exception {}

Some files were not shown because too many files changed in this diff