mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-27 15:59:29 +00:00
Returns posts creation level with group info.
This commit is contained in:
parent
39645de9ff
commit
18c5f2e64c
@ -37,6 +37,14 @@ class GroupsController {
|
|||||||
GroupInfo::SECRET_GROUP => "secrete"
|
GroupInfo::SECRET_GROUP => "secrete"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API posts creation levels
|
||||||
|
*/
|
||||||
|
const GROUPS_POSTS_LEVELS = array(
|
||||||
|
GroupInfo::POSTS_LEVEL_MODERATORS => "moderators",
|
||||||
|
GroupInfo::POSTS_LEVEL_ALL_MEMBERS => "members"
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a group
|
* Create a group
|
||||||
*
|
*
|
||||||
@ -616,6 +624,7 @@ class GroupsController {
|
|||||||
$data["membership"] = self::GROUPS_MEMBERSHIP_LEVELS[$info->get_membership_level()];
|
$data["membership"] = self::GROUPS_MEMBERSHIP_LEVELS[$info->get_membership_level()];
|
||||||
$data["visibility"] = self::GROUPS_VISIBILITY_LEVELS[$info->get_visibility()];
|
$data["visibility"] = self::GROUPS_VISIBILITY_LEVELS[$info->get_visibility()];
|
||||||
$data["registration_level"] = self::GROUPS_REGISTRATION_LEVELS[$info->get_registration_level()];
|
$data["registration_level"] = self::GROUPS_REGISTRATION_LEVELS[$info->get_registration_level()];
|
||||||
|
$data["posts_level"] = self::GROUPS_POSTS_LEVELS[$info->get_posts_level()];
|
||||||
$data["virtual_directory"] = $info->get_virtual_directory();
|
$data["virtual_directory"] = $info->get_virtual_directory();
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -591,6 +591,7 @@ class GroupsComponent {
|
|||||||
$info->set_membership_level($this->getMembershipLevel(userID, $info->get_id()));
|
$info->set_membership_level($this->getMembershipLevel(userID, $info->get_id()));
|
||||||
$info->set_visibility($data["visibility"]);
|
$info->set_visibility($data["visibility"]);
|
||||||
$info->set_registration_level($data["registration_level"]);
|
$info->set_registration_level($data["registration_level"]);
|
||||||
|
$info->set_posts_level($data["posts_level"]);
|
||||||
|
|
||||||
if($data["path_logo"] != null && $data["path_logo"] != "" && $data["path_logo"] != "null")
|
if($data["path_logo"] != null && $data["path_logo"] != "" && $data["path_logo"] != "null")
|
||||||
$info->set_logo($data["path_logo"]);
|
$info->set_logo($data["path_logo"]);
|
||||||
|
@ -28,6 +28,10 @@ class GroupInfo extends BaseUniqueObject {
|
|||||||
const MODERATOR_ACCESS = 4; //Can create posts, even if posts creation is restricted
|
const MODERATOR_ACCESS = 4; //Can create posts, even if posts creation is restricted
|
||||||
const ADMIN_ACCESS = 5; //Can do everything
|
const ADMIN_ACCESS = 5; //Can do everything
|
||||||
|
|
||||||
|
//Post levels
|
||||||
|
const POSTS_LEVEL_MODERATORS = 0; //Only the moderators and the administrator can create posts
|
||||||
|
const POSTS_LEVEL_ALL_MEMBERS = 1; //All the members of the group can create posts
|
||||||
|
|
||||||
//Private fields
|
//Private fields
|
||||||
private $name;
|
private $name;
|
||||||
private $number_members = -1;
|
private $number_members = -1;
|
||||||
@ -35,6 +39,7 @@ class GroupInfo extends BaseUniqueObject {
|
|||||||
private $membership_level = -1;
|
private $membership_level = -1;
|
||||||
private $visiblity = -1;
|
private $visiblity = -1;
|
||||||
private $registration_level = -1;
|
private $registration_level = -1;
|
||||||
|
private $posts_level = -1;
|
||||||
private $virtual_directory;
|
private $virtual_directory;
|
||||||
|
|
||||||
//Get and set the name of group
|
//Get and set the name of group
|
||||||
@ -130,6 +135,19 @@ class GroupInfo extends BaseUniqueObject {
|
|||||||
return $this->registration_level;
|
return $this->registration_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get and set posts level
|
||||||
|
public function set_posts_level(int $posts_level){
|
||||||
|
$this->posts_level = $posts_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function has_posts_level() : bool {
|
||||||
|
return $this->posts_level > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_posts_level() : int {
|
||||||
|
return $this->posts_level;
|
||||||
|
}
|
||||||
|
|
||||||
//Get and set virtual directory
|
//Get and set virtual directory
|
||||||
public function set_virtual_directory(string $virtual_directory){
|
public function set_virtual_directory(string $virtual_directory){
|
||||||
$this->virtual_directory = $virtual_directory == "" ? null : $virtual_directory;
|
$this->virtual_directory = $virtual_directory == "" ? null : $virtual_directory;
|
||||||
|
Loading…
Reference in New Issue
Block a user