2017-01-10 19:22:36 +01:00
|
|
|
<?php
|
|
|
|
|
2017-04-18 02:09:16 +02:00
|
|
|
/**
|
2017-05-12 06:58:40 +02:00
|
|
|
* @api {post} /system/disable-registration Disable registration
|
2019-03-06 16:47:24 +01:00
|
|
|
* @apiVersion 4.4.0
|
2017-04-18 02:09:16 +02:00
|
|
|
*
|
|
|
|
* @apiName Disable registration
|
|
|
|
*
|
2017-05-12 06:58:40 +02:00
|
|
|
* @apiGroup System
|
2017-04-18 02:09:16 +02:00
|
|
|
*
|
2017-05-12 06:58:40 +02:00
|
|
|
* @apiDescription This path disables the registration.
|
2017-04-18 02:09:16 +02:00
|
|
|
*
|
2017-05-12 06:58:40 +02:00
|
|
|
* @apiPermission staff3
|
2017-04-18 02:09:16 +02:00
|
|
|
*
|
2017-04-21 08:09:24 +02:00
|
|
|
* @apiParam {String} password The password of the current staff.
|
2017-04-18 02:09:16 +02:00
|
|
|
*
|
2017-04-21 08:09:24 +02:00
|
|
|
* @apiUse NO_PERMISSION
|
|
|
|
* @apiUse INVALID_PASSWORD
|
2017-04-18 02:09:16 +02:00
|
|
|
*
|
2017-04-21 08:09:24 +02:00
|
|
|
* @apiSuccess {Object} data Empty object
|
2017-04-18 02:09:16 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-01-10 19:22:36 +01:00
|
|
|
class DisableRegistrationController extends Controller {
|
|
|
|
const PATH = '/disable-registration';
|
2017-02-08 19:09:15 +01:00
|
|
|
const METHOD = 'POST';
|
2017-01-10 19:22:36 +01:00
|
|
|
|
|
|
|
public function validations() {
|
|
|
|
return [
|
|
|
|
'permission' => 'staff_3',
|
|
|
|
'requestData' => []
|
|
|
|
];
|
|
|
|
}
|
2017-01-11 07:50:47 +01:00
|
|
|
|
2017-01-10 19:22:36 +01:00
|
|
|
public function handler() {
|
|
|
|
$password = Controller::request('password');
|
|
|
|
|
|
|
|
if(!Hashing::verifyPassword($password, Controller::getLoggedUser()->password)) {
|
2018-11-20 23:41:00 +01:00
|
|
|
throw new RequestException(ERRORS::INVALID_PASSWORD);
|
2017-01-10 19:22:36 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$registrationRow = Setting::getSetting('registration');
|
|
|
|
|
|
|
|
$registrationRow->value = false;
|
|
|
|
$registrationRow->store();
|
|
|
|
|
|
|
|
Response::respondSuccess();
|
|
|
|
}
|
|
|
|
}
|