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
This commit is contained in:
Marien Fressinaud
2015-07-21 15:31:23 +02:00
parent fa76e863c5
commit ac8bd3d251
4 changed files with 50 additions and 0 deletions

View File

@@ -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);
}
}