mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Created getinfosMultiple users method
This commit is contained in:
		@@ -86,6 +86,35 @@ class userController
 | 
			
		||||
		return array($userInfos);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get multiple users informations
 | 
			
		||||
	 *
 | 
			
		||||
	 * @url POST /user/getInfosMultiple
 | 
			
		||||
	 * @return array The result
 | 
			
		||||
	 */
 | 
			
		||||
	public function getMultipleUserInfos() : array{
 | 
			
		||||
		user_login_required();
 | 
			
		||||
 | 
			
		||||
		//Determine userID
 | 
			
		||||
		if(!isset($_POST['usersID']))
 | 
			
		||||
			Rest_fatal_error(400, "Please specify user ID !");
 | 
			
		||||
		
 | 
			
		||||
		$usersID = array();
 | 
			
		||||
		foreach(json_decode($_POST['usersID']) as $userID){
 | 
			
		||||
			$usersID[] = $userID*1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Try to get user infos
 | 
			
		||||
		$userInfos = CS::get()->user->getUserInfos($userID);
 | 
			
		||||
		
 | 
			
		||||
		//Check if response is empty
 | 
			
		||||
		if(count($userInfos) == 0)
 | 
			
		||||
			throw new RestException(401, "Couldn't get user data (maybe user doesn't exists) !");
 | 
			
		||||
		
 | 
			
		||||
		//Return result
 | 
			
		||||
		return array($userInfos);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get current user infos using tokens
 | 
			
		||||
	 *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user