Can change group visibility.

This commit is contained in:
Pierre HUBERT 2018-07-04 16:49:28 +02:00
parent 44181ee5c7
commit e8d8fffbd1
3 changed files with 11 additions and 1 deletions

View File

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

View File

@ -336,6 +336,9 @@ class GroupsComponent {
if($settings->has_logo()) if($settings->has_logo())
$data["path_logo"] = $settings->get_logo(); $data["path_logo"] = $settings->get_logo();
if($settings->has_visibility())
$data["visibility"] = $settings->get_visibility();
return $data; return $data;
} }
} }

View File

@ -20,7 +20,7 @@ class GroupInfo extends BaseUniqueObject {
private $number_members = -1; private $number_members = -1;
private $logo; private $logo;
private $membership_level = -1; private $membership_level = -1;
private $visiblity; private $visiblity = -1;
//Get and set the name of group //Get and set the name of group