diff --git a/front/authldap.form.php b/front/authldap.form.php index df968919911..7e6414bca88 100644 --- a/front/authldap.form.php +++ b/front/authldap.form.php @@ -45,17 +45,9 @@ } //LDAP Server add/update/delete if (isset($_POST["update"])) { - if (array_key_exists('rootdn_passwd', $_POST)) { - // Password must not be altered, it will be encrypted and never displayed, so sanitize is not necessary. - $_POST['rootdn_passwd'] = $_POST['rootdn_passwd']; - } $config_ldap->update($_POST); Html::back(); } else if (isset($_POST["add"])) { - if (array_key_exists('rootdn_passwd', $_POST)) { - // Password must not be altered, it will be encrypt and never displayed, so sanitize is not necessary. - $_POST['rootdn_passwd'] = $_POST['rootdn_passwd']; - } //If no name has been given to this configuration, then go back to the page without adding if ($_POST["name"] != "") { if ($newID = $config_ldap->add($_POST)) { diff --git a/front/cartridgeitem.form.php b/front/cartridgeitem.form.php deleted file mode 100644 index 3875b569c0e..00000000000 --- a/front/cartridgeitem.form.php +++ /dev/null @@ -1,123 +0,0 @@ -. - * - * --------------------------------------------------------------------- - */ - -use Glpi\Event; - -Session::checkRightsOr(Cartridge::$rightname, [READ, READ_ASSIGNED]); - -if (!isset($_GET["id"])) { - $_GET["id"] = ""; -} - -$cartype = new CartridgeItem(); - -if (isset($_POST["add"])) { - $cartype->check(-1, CREATE, $_POST); - - if ($newID = $cartype->add($_POST)) { - Event::log( - $newID, - "cartridgeitems", - 4, - "inventory", - sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]) - ); - if ($_SESSION['glpibackcreated']) { - Html::redirect($cartype->getLinkURL()); - } - } - Html::back(); -} else if (isset($_POST["delete"])) { - $cartype->check($_POST["id"], DELETE); - - if ($cartype->delete($_POST)) { - Event::log( - $_POST["id"], - "cartridgeitems", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s deletes an item'), $_SESSION["glpiname"]) - ); - } - $cartype->redirectToList(); -} else if (isset($_POST["restore"])) { - $cartype->check($_POST["id"], DELETE); - - if ($cartype->restore($_POST)) { - Event::log( - $_POST["id"], - "cartridgeitems", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s restores an item'), $_SESSION["glpiname"]) - ); - } - $cartype->redirectToList(); -} else if (isset($_POST["purge"])) { - $cartype->check($_POST["id"], PURGE); - - if ($cartype->delete($_POST, 1)) { - Event::log( - $_POST["id"], - "cartridgeitems", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s purges an item'), $_SESSION["glpiname"]) - ); - } - $cartype->redirectToList(); -} else if (isset($_POST["update"])) { - $cartype->check($_POST["id"], UPDATE); - - if ($cartype->update($_POST)) { - Event::log( - $_POST["id"], - "cartridgeitems", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s updates an item'), $_SESSION["glpiname"]) - ); - } - Html::back(); -} else { - $menus = ["assets", "cartridgeitem"]; - CartridgeItem::displayFullPageForItem($_GET["id"], $menus, [ - 'formoptions' => "data-track-changes=true" - ]); -} diff --git a/front/certificate.form.php b/front/certificate.form.php deleted file mode 100644 index 051922264e8..00000000000 --- a/front/certificate.form.php +++ /dev/null @@ -1,127 +0,0 @@ -. - * - * --------------------------------------------------------------------- - */ - -use Glpi\Event; - -Session::checkRight("certificate", READ); - -if (empty($_GET["id"])) { - $_GET["id"] = ""; -} -if (!isset($_GET["withtemplate"])) { - $_GET["withtemplate"] = ""; -} - -$certificate = new Certificate(); - -if (isset($_POST["add"])) { - $certificate->check(-1, CREATE, $_POST); - - if ($newID = $certificate->add($_POST)) { - Event::log( - $newID, - "certificates", - 4, - "inventory", - sprintf( - __('%1$s adds the item %2$s'), - $_SESSION["glpiname"], - $_POST["name"] - ) - ); - if ($_SESSION['glpibackcreated']) { - Html::redirect($certificate->getLinkURL()); - } - } - Html::back(); -} else if (isset($_POST["delete"])) { - $certificate->check($_POST["id"], DELETE); - $certificate->delete($_POST); - - Event::log( - $_POST["id"], - "certificates", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s deletes an item'), $_SESSION["glpiname"]) - ); - $certificate->redirectToList(); -} else if (isset($_POST["restore"])) { - $certificate->check($_POST["id"], DELETE); - - $certificate->restore($_POST); - Event::log( - $_POST["id"], - "certificates", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s restores an item'), $_SESSION["glpiname"]) - ); - $certificate->redirectToList(); -} else if (isset($_POST["purge"])) { - $certificate->check($_POST["id"], PURGE); - - $certificate->delete($_POST, 1); - Event::log( - $_POST["id"], - "certificates", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s purges an item'), $_SESSION["glpiname"]) - ); - $certificate->redirectToList(); -} else if (isset($_POST["update"])) { - $certificate->check($_POST["id"], UPDATE); - - $certificate->update($_POST); - Event::log( - $_POST["id"], - "certificates", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s updates an item'), $_SESSION["glpiname"]) - ); - Html::back(); -} else { - $menus = ['management', 'certificate']; - Certificate::displayFullPageForItem($_GET["id"], $menus, [ - 'withtemplate' => $_GET["withtemplate"], - 'formoptions' => "data-track-changes=true" - ]); -} diff --git a/front/lockedfield.form.php b/front/lockedfield.form.php deleted file mode 100644 index 19dc6d65ed2..00000000000 --- a/front/lockedfield.form.php +++ /dev/null @@ -1,95 +0,0 @@ -. - * - * --------------------------------------------------------------------- - */ - -use Glpi\Event; - -Session::checkRight("locked_field", CREATE); - -if (!isset($_GET["id"])) { - $_GET["id"] = ""; -} - -$lockedfield = new Lockedfield(); - -//Add a new locked field -if (isset($_POST["add"])) { - $lockedfield->check(-1, UPDATE, $_POST); - if ($newID = $lockedfield->add($_POST)) { - Event::log( - $newID, - "lockedfield", - 4, - "inventory", - sprintf(__('%1$s adds global lock on %2$s'), $_SESSION["glpiname"], $_POST["item"]) - ); - - if ($_SESSION['glpibackcreated']) { - Html::redirect($lockedfield->getLinkURL()); - } - } - Html::back(); -} else if (isset($_POST["purge"])) { - $lockedfield->check($_POST['id'], UPDATE); - if ($lockedfield->delete($_POST, 1)) { - Event::log( - $_POST["id"], - "lockedfield", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s purges an item'), $_SESSION["glpiname"]) - ); - } - $lockedfield->redirectToList(); - - //update a locked field -} else if (isset($_POST["update"])) { - $lockedfield->check($_POST['id'], UPDATE); - $lockedfield->update($_POST); - Event::log( - $_POST["id"], - "lockedfield", - 4, - "inventory", - //TRANS: %s is the user login - sprintf(__('%s updates an item'), $_SESSION["glpiname"]) - ); - Html::back(); -} else {//print locked field information - $menus = ["admin", "glpi\inventory\inventory", "Lockedfield"]; - $lockedfield->displayFullPageForItem($_GET['id'], $menus, [ - 'formoptions' => "data-track-changes=true" - ]); -} diff --git a/src/CartridgeItem.php b/src/CartridgeItem.php index 4c32972b703..f2dab8d8764 100644 --- a/src/CartridgeItem.php +++ b/src/CartridgeItem.php @@ -64,6 +64,16 @@ public static function getTypeName($nb = 0) return _n('Cartridge model', 'Cartridge models', $nb); } + public static function getLogDefaultServiceName(): string + { + return 'inventory'; + } + + public static function getSectorizedDetails(): array + { + return ['assets', self::class]; + } + public static function getMenuName() { return Cartridge::getTypeName(Session::getPluralNumber()); diff --git a/src/Certificate.php b/src/Certificate.php index 04923ed3fc3..0df349dd823 100644 --- a/src/Certificate.php +++ b/src/Certificate.php @@ -69,6 +69,11 @@ public static function getTypeName($nb = 0) return _n('Certificate', 'Certificates', $nb); } + public static function getLogDefaultServiceName(): string + { + return 'inventory'; + } + public static function getSectorizedDetails(): array { return ['management', self::class]; diff --git a/src/Glpi/Controller/GenericFormController.php b/src/Glpi/Controller/GenericFormController.php index 2ee919d33c2..cd129768206 100644 --- a/src/Glpi/Controller/GenericFormController.php +++ b/src/Glpi/Controller/GenericFormController.php @@ -69,7 +69,7 @@ public function __invoke(Request $request): Response throw new AccessDeniedHttpException(); } - $form_action = $this->getFormAction($request, $class); + $form_action = $this->getFormAction($request); if (!$form_action) { throw new BadRequestHttpException(); @@ -167,10 +167,7 @@ private function handleFormAction(Request $request, string $form_action, string }; } - /** - * @param class-string $class - */ - private function getFormAction(Request $request, string $class): ?string + private function getFormAction(Request $request): ?string { if ($request->getMethod() === 'POST') { foreach (self::SUPPORTED_ACTIONS as $action) { diff --git a/src/Lockedfield.php b/src/Lockedfield.php index 94fc0ed31f5..4e648354f39 100644 --- a/src/Lockedfield.php +++ b/src/Lockedfield.php @@ -60,6 +60,11 @@ public static function getSectorizedDetails(): array return ['admin', Inventory::class, self::class]; } + public static function getLogDefaultServiceName(): string + { + return 'inventory'; + } + public static function canView(): bool { return self::canUpdate();