mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 08:35:18 +00:00
Can update the name of the group
This commit is contained in:
@ -114,6 +114,28 @@ class GroupsController {
|
||||
return self::GroupSettingsToAPI($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set (update) the settings of a group
|
||||
*
|
||||
* @url POST /groups/set_settings
|
||||
*/
|
||||
public function setSettings(){
|
||||
|
||||
//Get the ID of the group (with admin access)
|
||||
$groupID = $this->getPostGroupIDWithAdmin("id");
|
||||
|
||||
//Create and fill a GroupSettings object with new values
|
||||
$settings = new GroupSettings();
|
||||
$settings->set_id($groupID);
|
||||
$settings->set_name(postString("name", 3));
|
||||
|
||||
//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!");
|
||||
|
||||
return array("success" => "Group settings have been successfully updated!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and return a group ID specified in the POST request
|
||||
* in which the current user has admin rigths
|
||||
|
Reference in New Issue
Block a user