diff options
| author | 2015-07-21 15:31:23 +0200 | |
|---|---|---|
| committer | 2015-07-21 15:31:23 +0200 | |
| commit | ac8bd3d2512dd1bfca43d71ea10202ba9e6a82a6 (patch) | |
| tree | dc1758f0444723e8b1ff8ffa73a5aa481f2ac441 /app/Controllers/userController.php | |
| parent | fa76e863c5622609b944542b0255c30f2f67c97e (diff) | |
Add a max_registrations limit
- Allow user to create accounts (not implemented)
- Admin only can set this limit
See https://github.com/FreshRSS/FreshRSS/issues/679
Diffstat (limited to 'app/Controllers/userController.php')
| -rw-r--r-- | app/Controllers/userController.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index ed01b83c5..1c7745753 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -211,4 +211,28 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); } + + /** + * This action updates the max number of registrations. + * + * Request parameter is: + * - max-registrations (int >= 0) + */ + public function setRegistrationAction() { + if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { + $limits = FreshRSS_Context::$system_conf->limits; + $limits['max_registrations'] = Minz_Request::param('max-registrations', 1); + FreshRSS_Context::$system_conf->limits = $limits; + FreshRSS_Context::$system_conf->save(); + + invalidateHttpCache(); + + Minz_Session::_param('notification', array( + 'type' => 'good', + 'content' => _t('feedback.user.set_registration') + )); + } + + Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); + } } |
