From eeb52f669c82b04813aef46c59381e8b66e7f56e Mon Sep 17 00:00:00 2001 From: Pierre Date: Tue, 9 Jan 2018 06:49:13 +0100 Subject: [PATCH] Get level access to posts --- RestControllers/postsController.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/RestControllers/postsController.php b/RestControllers/postsController.php index c71e339..1f3f7ec 100644 --- a/RestControllers/postsController.php +++ b/RestControllers/postsController.php @@ -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;