mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-12-25 13:08:58 +00:00
Can get information about multiple groups.
This commit is contained in:
parent
e1c8399a74
commit
ffcef67b70
@ -99,6 +99,39 @@ class GroupsController {
|
||||
return self::GroupInfoToAPI($group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about multiple groups
|
||||
*
|
||||
* @url POST /groups/get_multiple_info
|
||||
*/
|
||||
public function getMultipleInfo(){
|
||||
|
||||
//Get the IDs of requested groups
|
||||
$IDs = numbers_list_to_array(postString("list", 1));
|
||||
|
||||
//Process the list of groups
|
||||
foreach($IDs as $groupID){
|
||||
|
||||
//Check if the group exists or not
|
||||
if(!components()->groups->exists($groupID))
|
||||
Rest_fatal_error(404, "Group ".$groupID." not found!");
|
||||
|
||||
//Check the user is allowed to access this group information
|
||||
if(components()->groups->getAccessLevel($groupID, userID) < GroupInfo::LIMITED_ACCESS)
|
||||
Rest_fatal_error(404, "Group ".$groupID." not found!");
|
||||
|
||||
//Get the group information
|
||||
$group = components()->groups->get_info($groupID);
|
||||
|
||||
if(!$group->isValid())
|
||||
Rest_fatal_error(500, "Could not get a group information!");
|
||||
|
||||
$IDs[$groupID] = self::GroupInfoToAPI($group);
|
||||
}
|
||||
|
||||
return $IDs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get advanced information about a group
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user