Return registration levels on the API

This commit is contained in:
Pierre HUBERT 2018-07-05 07:53:31 +02:00
parent e35323915f
commit f726b4cc2b
2 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,15 @@
class GroupsController { class GroupsController {
/**
* API groups registration levels
*/
const GROUPS_REGISTRATION_LEVELS = array(
GroupInfo::OPEN_REGISTRATION => "open",
GroupInfo::MODERATED_REGISTRATION => "moderated",
GroupInfo::CLOSED_REGISTRATION => "closed"
);
/** /**
* API groups membership levels * API groups membership levels
*/ */
@ -224,6 +233,7 @@ class GroupsController {
$data["number_members"] = $info->get_number_members(); $data["number_members"] = $info->get_number_members();
$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()];
return $data; return $data;
} }

View File

@ -365,6 +365,7 @@ class GroupsComponent {
$info->set_number_members($this->countMembers($info->get_id())); $info->set_number_members($this->countMembers($info->get_id()));
$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"]);
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"]);