mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-26 15:29:21 +00:00
Can check the availability of a virtual directory
This commit is contained in:
parent
3f3388cb9a
commit
3a09223164
@ -12,7 +12,7 @@ use crate::data::group::{Group, GroupAccessLevel, GroupPostsCreationLevel, Group
|
||||
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::{groups_helper, virtual_directory_helper};
|
||||
use crate::helpers::virtual_directory_helper::VirtualDirType;
|
||||
|
||||
/// Create a new group
|
||||
@ -105,4 +105,16 @@ pub fn set_settings(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
groups_helper::set_settings(&new_settings)?;
|
||||
|
||||
r.success("Group settings have been successfully updated!")
|
||||
}
|
||||
|
||||
/// Check out whether a virtual directory is available for a group or not
|
||||
pub fn check_virtual_dir(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let group_id = r.post_group_id_with_access("groupID", GroupAccessLevel::ADMIN_ACCESS)?;
|
||||
let dir = r.post_virtual_directory("directory")?;
|
||||
|
||||
if !virtual_directory_helper::check_availability(&dir, group_id.id(), VirtualDirType::GROUP)? {
|
||||
r.forbidden("The requested virtual directory seems not to be available!".to_string())?;
|
||||
}
|
||||
|
||||
r.success("Requested virtual directory seems to be available!")
|
||||
}
|
@ -142,6 +142,8 @@ pub fn get_routes() -> Vec<Route> {
|
||||
|
||||
Route::post("/groups/set_settings", Box::new(groups_controller::set_settings)),
|
||||
|
||||
Route::post("/groups/checkVirtualDirectory", Box::new(groups_controller::check_virtual_dir)),
|
||||
|
||||
|
||||
// Virtual directory controller
|
||||
Route::post("/user/findbyfolder", Box::new(virtual_directory_controller::find_user)),
|
||||
|
Loading…
Reference in New Issue
Block a user