Loading appinfo/routes.php +2 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ return ['routes' => [ ['name' => 'user#set_account_data', 'url' => '/api/set_account_data', 'verb' => 'POST'], ['name' => 'user#user_exists', 'url' => '/api/user_exists', 'verb' => 'POST'], ['name' => 'user#set_mail_quota_usage', 'url' => '/api/set_mail_quota_usage', 'verb' => 'POST'], ['name' => 'shop_account#set_shop_email_post_delete', 'url' => '/shop/set_shop_email_post_delete', 'verb' => 'POST' ], ['name' => 'shop_account#set_shop_delete_preference', 'url' => '/shop/set_shop_delete_preference', 'verb' => 'POST' ], [ 'name' => 'user#preflighted_cors', 'url' => '/api/{path}', 'verb' => 'OPTIONS', 'requirements' => array('path' => '.+') Loading lib/Controller/ShopAccountController.php 0 → 100644 +51 −0 Original line number Diff line number Diff line <?php declare(strict_types=1); use OCA\EcloudAccounts\Service\ShopAccountService; use OCP\IUserSession; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; class ShopAccountController extends Controller { private $shopAccountService; private $userSession; public function __construct($appName, IRequest $request, IUserSession $userSession, ShopAccountService $shopAccountService) { parent::__construct($appName, $request); $this->shopAccountService = $shopAccountService; $this->userSession = $userSession; } /** * @NoAdminRequired */ public function setShopEmailPostDelete(string $shopEmailPostDelete) { $user = $this->userSession->getUser(); $userId = $user->getUID(); $email = $user->getEMailAddress(); if($shopEmailPostDelete === $email) { $response = new DataResponse(); $response->setStatus(400); return $response; } $this->shopAccountService->setShopEmailPostDelete($userId, $shopEmailPostDelete); } /** * @NoAdminRequired */ public function setShopDeletePreference(bool $deleteShopAccount) { $user = $this->userSession->getUser(); $userId = $user->getUID(); $this->shopAccountService->setShopDeletePreference($userId, $deleteShopAccount); } } No newline at end of file lib/Controller/UserController.php +0 −8 Original line number Diff line number Diff line Loading @@ -34,14 +34,6 @@ class UserController extends ApiController $this->config = $config; } /** * @NoAdminRequired */ public function setShopDeleteInfo(bool $deleteShopAccount, string $shopEmailPostDelete) { } /** * @CORS * @PublicPage Loading Loading
appinfo/routes.php +2 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ return ['routes' => [ ['name' => 'user#set_account_data', 'url' => '/api/set_account_data', 'verb' => 'POST'], ['name' => 'user#user_exists', 'url' => '/api/user_exists', 'verb' => 'POST'], ['name' => 'user#set_mail_quota_usage', 'url' => '/api/set_mail_quota_usage', 'verb' => 'POST'], ['name' => 'shop_account#set_shop_email_post_delete', 'url' => '/shop/set_shop_email_post_delete', 'verb' => 'POST' ], ['name' => 'shop_account#set_shop_delete_preference', 'url' => '/shop/set_shop_delete_preference', 'verb' => 'POST' ], [ 'name' => 'user#preflighted_cors', 'url' => '/api/{path}', 'verb' => 'OPTIONS', 'requirements' => array('path' => '.+') Loading
lib/Controller/ShopAccountController.php 0 → 100644 +51 −0 Original line number Diff line number Diff line <?php declare(strict_types=1); use OCA\EcloudAccounts\Service\ShopAccountService; use OCP\IUserSession; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; class ShopAccountController extends Controller { private $shopAccountService; private $userSession; public function __construct($appName, IRequest $request, IUserSession $userSession, ShopAccountService $shopAccountService) { parent::__construct($appName, $request); $this->shopAccountService = $shopAccountService; $this->userSession = $userSession; } /** * @NoAdminRequired */ public function setShopEmailPostDelete(string $shopEmailPostDelete) { $user = $this->userSession->getUser(); $userId = $user->getUID(); $email = $user->getEMailAddress(); if($shopEmailPostDelete === $email) { $response = new DataResponse(); $response->setStatus(400); return $response; } $this->shopAccountService->setShopEmailPostDelete($userId, $shopEmailPostDelete); } /** * @NoAdminRequired */ public function setShopDeletePreference(bool $deleteShopAccount) { $user = $this->userSession->getUser(); $userId = $user->getUID(); $this->shopAccountService->setShopDeletePreference($userId, $deleteShopAccount); } } No newline at end of file
lib/Controller/UserController.php +0 −8 Original line number Diff line number Diff line Loading @@ -34,14 +34,6 @@ class UserController extends ApiController $this->config = $config; } /** * @NoAdminRequired */ public function setShopDeleteInfo(bool $deleteShopAccount, string $shopEmailPostDelete) { } /** * @CORS * @PublicPage Loading