From debbdbc7ca3d2269b19607f36c11f9ce16178455 Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 4 Jan 2018 17:42:40 +0100 Subject: [PATCH] Enabled likes on posts --- RestControllers/likesController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/RestControllers/likesController.php b/RestControllers/likesController.php index 80ef304..7c9f501 100644 --- a/RestControllers/likesController.php +++ b/RestControllers/likesController.php @@ -42,11 +42,25 @@ class likesController { Rest_fatal_error(401, "You can not access this user information !"); break; + + + //In case of post + case "post": + + //Extract informations + $id = getPostPostID("id"); + $componentType = Likes::LIKE_POST; + + //Check user can see the post + if(CS::get()->components->posts->access_level($id, userID) === Posts::NO_ACCESS) + Rest_fatal_error(401, "You are not allowed to access this post informations !"); + + break; //Default case : error default: - Rest_fatal_error(404, "Didn't find specified component type !"); + Rest_fatal_error(404, "Specifed component type currently not supported !"); } //Update like status