Can get from the API the list of targets where user can create posts

This commit is contained in:
2019-05-19 15:35:43 +02:00
parent f8e6aa2d3c
commit 75940b53f3
3 changed files with 71 additions and 0 deletions

View File

@ -491,6 +491,29 @@ class PostsController {
}
/**
* Get the list of targets (pages) where the current user can create
* posts
*
* @url POST /posts/getAvailableTargets
*/
public function getAvailableTargets() {
user_login_required();
// Get the list of friends of the user where the user
// can create posts
$friends = components()->friends->getListThatAllowPostsFromUser(userID);
// Get the list of groups where the user can create posts
$groups = components()->groups->getListUserWhereCanCreatePosts(userID);
//Return result
return array(
"friends" => $friends,
"groups" => $groups
);
}
/**
* Get the visibility level specified in a POST request
*