mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-07-15 19:58:05 +00:00
Collect new group settings
This commit is contained in:
@ -8,11 +8,12 @@ use crate::api_data::advanced_group_api::AdvancedGroupApi;
|
||||
use crate::api_data::group_api::GroupApi;
|
||||
use crate::api_data::res_create_group::GroupCreationResult;
|
||||
use crate::controllers::routes::RequestResult;
|
||||
use crate::data::group::GroupAccessLevel;
|
||||
use crate::data::group::{Group, GroupAccessLevel, GroupPostsCreationLevel, GroupRegistrationLevel, GroupVisibilityLevel};
|
||||
use crate::data::group_id::GroupID;
|
||||
use crate::data::http_request_handler::HttpRequestHandler;
|
||||
use crate::data::new_group::NewGroup;
|
||||
use crate::helpers::groups_helper;
|
||||
use crate::helpers::virtual_directory_helper::VirtualDirType;
|
||||
|
||||
/// Create a new group
|
||||
pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
@ -86,5 +87,22 @@ pub fn get_settings(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
|
||||
/// Set new settings to the group
|
||||
pub fn set_settings(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
r.success("implement me")
|
||||
let group_id = r.post_group_id_with_access("id", GroupAccessLevel::ADMIN_ACCESS)?;
|
||||
|
||||
let new_settings = Group {
|
||||
id: group_id.clone(),
|
||||
name: r.post_string_without_html("name", 3, true)?,
|
||||
visibility: GroupVisibilityLevel::from_api(&r.post_string("visibility")?),
|
||||
registration_level: GroupRegistrationLevel::from_api(&r.post_string("registration_level")?),
|
||||
posts_creation_level: GroupPostsCreationLevel::from_api(&r.post_string("posts_level")?),
|
||||
logo: None,
|
||||
virtual_directory: r.post_checked_virtual_directory_opt("virtual_directory", group_id.id(), VirtualDirType::GROUP)?,
|
||||
time_create: 0,
|
||||
description: r.post_string_without_html_opt("description", 0)?,
|
||||
url: r.post_url_opt("url", false)?,
|
||||
};
|
||||
|
||||
println!("New settings: {:#?}", new_settings);
|
||||
|
||||
r.success("complete implementation")
|
||||
}
|
Reference in New Issue
Block a user