Can update registration level

This commit is contained in:
Pierre HUBERT 2018-07-05 08:07:17 +02:00
parent f726b4cc2b
commit a1d078a461
2 changed files with 10 additions and 0 deletions

View File

@ -155,6 +155,13 @@ class GroupsController {
Rest_fatal_error(400, "Unrecognized group visibility level!");
$settings->set_visibility($levels[$visiblity]);
//Get group registration level
$registration_level = postString("registration_level", 3);
$levels = array_flip(self::GROUPS_REGISTRATION_LEVELS);
if(!isset($levels[$registration_level]))
Reset_fatal_error(400, "Unrecognized group registration level!");
$settings->set_registration_level($levels[$registration_level]);
//Try to save the new settings of the group
if(!components()->groups->set_settings($settings))
Rest_fatal_error(500, "An error occured while trying to update group settings!");

View File

@ -430,6 +430,9 @@ class GroupsComponent {
if($settings->has_visibility())
$data["visibility"] = $settings->get_visibility();
if($settings->has_registration_level())
$data["registration_level"] = $settings->get_registration_level();
return $data;
}