From 7ea5c1abe5cb31e8cbc98577b03e902f9bbb11e8 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Thu, 26 Sep 2024 18:08:30 +0200 Subject: [PATCH] Add rpc endpoint for deletion of user ranks --- .../core/users/ranks/DeleteUserRank.class.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/endpoint/controller/core/users/ranks/DeleteUserRank.class.php diff --git a/wcfsetup/install/files/lib/system/endpoint/controller/core/users/ranks/DeleteUserRank.class.php b/wcfsetup/install/files/lib/system/endpoint/controller/core/users/ranks/DeleteUserRank.class.php new file mode 100644 index 0000000000..fa61fec876 --- /dev/null +++ b/wcfsetup/install/files/lib/system/endpoint/controller/core/users/ranks/DeleteUserRank.class.php @@ -0,0 +1,38 @@ + + * @since 6.1 + */ +#[DeleteRequest('/core/users/ranks/{id:\d+}')] +final class DeleteUserRank implements IController +{ + #[\Override] + public function __invoke(ServerRequestInterface $request, array $variables): ResponseInterface + { + WCF::getSession()->checkPermissions(['admin.user.rank.canManageRank']); + + $rank = Helper::fetchObjectFromRequestParameter($variables['id'], UserRank::class); + + $action = new UserRankAction([$rank], 'delete'); + $action->executeAction(); + + return new JsonResponse([]); + } +} -- 2.20.1