mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 08:35:18 +00:00
Can respond to a membership invitation.
This commit is contained in:
@ -119,6 +119,8 @@ class GroupsController {
|
||||
*/
|
||||
public function getSettings(){
|
||||
|
||||
user_login_required();
|
||||
|
||||
//Get the ID of the group (with admin access)
|
||||
$groupID = getPostGroupIdWithAccess("id", GroupInfo::ADMIN_ACCESS);
|
||||
|
||||
@ -140,6 +142,8 @@ class GroupsController {
|
||||
*/
|
||||
public function setSettings(){
|
||||
|
||||
user_login_required();
|
||||
|
||||
//Get the ID of the group (with admin access)
|
||||
$groupID = getPostGroupIdWithAccess("id", GroupInfo::ADMIN_ACCESS);
|
||||
|
||||
@ -176,6 +180,8 @@ class GroupsController {
|
||||
*/
|
||||
public function uploadLogo(){
|
||||
|
||||
user_login_required();
|
||||
|
||||
//Get the ID of the group (with admin access)
|
||||
$groupID = getPostGroupIdWithAccess("id", GroupInfo::ADMIN_ACCESS);
|
||||
|
||||
@ -211,6 +217,8 @@ class GroupsController {
|
||||
*/
|
||||
public function deleteLogo(){
|
||||
|
||||
user_login_required();
|
||||
|
||||
//Get the ID of the group (with admin access)
|
||||
$groupID = getPostGroupIdWithAccess("id", GroupInfo::ADMIN_ACCESS);
|
||||
|
||||
@ -225,6 +233,33 @@ class GroupsController {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond to a membership invitation
|
||||
*
|
||||
* @url POST /groups/respond_invitation
|
||||
*/
|
||||
public function respondInvitation(){
|
||||
|
||||
user_login_required();
|
||||
|
||||
//Get the ID of the group (with basic access)
|
||||
$groupID = getPostGroupIdWithAccess("id", GroupInfo::LIMITED_ACCESS);
|
||||
|
||||
//Get the response to the invitation
|
||||
$accept = postBool("accept");
|
||||
|
||||
//Check if the user received an invitation or not
|
||||
if(!components()->groups->receivedInvitation(userID, $groupID))
|
||||
Rest_fatal_error(404, "Invitation not found!");
|
||||
|
||||
//Try to respond to the invitation
|
||||
if(!components()->groups->respondInvitation(userID, $groupID, $accept))
|
||||
Rest_fatal_error(500, "An error occurred while trying to respond to membership invitation!");
|
||||
|
||||
//Success
|
||||
return array("success" => "The response to the invitation was saved!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a GroupInfo object into an array for the API
|
||||
*
|
||||
|
Reference in New Issue
Block a user