1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-26 07:19:22 +00:00

Update the get_members route

This commit is contained in:
Pierre HUBERT 2021-03-17 18:26:10 +01:00
parent 3dea624e4a
commit 32ae6fbb32

View File

@ -155,7 +155,14 @@ pub fn delete_logo(r: &mut HttpRequestHandler) -> RequestResult {
/// Get the list of members of a group /// Get the list of members of a group
pub fn get_members(r: &mut HttpRequestHandler) -> RequestResult { pub fn get_members(r: &mut HttpRequestHandler) -> RequestResult {
let group_id = r.post_group_id_with_access("id", GroupAccessLevel::MODERATOR_ACCESS)?; let group_id = r.post_group_id("id")?;
let group_access_level = groups_helper::get_access_level(&group_id, r.user_id_opt())?;
let group = groups_helper::get_info(&group_id)?;
if group_access_level < GroupAccessLevel::VIEW_ACCESS
|| (!group.is_members_list_public && group_access_level < GroupAccessLevel::MODERATOR_ACCESS) {
r.forbidden("You can not access the list of members of this group!".to_string())?;
}
let members = groups_helper::get_list_members(&group_id)?; let members = groups_helper::get_list_members(&group_id)?;