mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Get level access to posts
This commit is contained in:
		@@ -9,6 +9,16 @@
 | 
			
		||||
 | 
			
		||||
class postsController {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Access levels for the POST for the api
 | 
			
		||||
	 */
 | 
			
		||||
	const ACCESS_LEVEL_API = array(
 | 
			
		||||
		Posts::NO_ACCESS => "no-access",
 | 
			
		||||
		Posts::BASIC_ACCESS => "basic",
 | 
			
		||||
		Posts::INTERMEDIATE_ACCESS => "intermediate",
 | 
			
		||||
		Posts::FULL_ACCESS => "full"
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get user posts
 | 
			
		||||
	 * 
 | 
			
		||||
@@ -39,6 +49,9 @@ class postsController {
 | 
			
		||||
			//Get access level to the post
 | 
			
		||||
			$access_level = CS::get()->components->posts->access_level_with_infos($infos, userID);
 | 
			
		||||
 | 
			
		||||
			//Save level access in the response
 | 
			
		||||
			$posts[$num]["user_access"] = $this::ACCESS_LEVEL_API[$access_level];
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return $posts;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user