mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 13:29:21 +00:00
Refactor routing
This commit is contained in:
parent
758774306e
commit
13e73ede8b
383
src/routes.rs
383
src/routes.rs
@ -197,6 +197,73 @@ macro_rules! route {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($r : expr, $req_uri: expr, $call: expr, POST_LOGIN, $uri: expr, $func: expr)=>{
|
||||
if($uri.eq($req_uri))
|
||||
{
|
||||
$r = Some(Route::post($uri));
|
||||
|
||||
if let Some(c) = $call {
|
||||
return ($r, Some($func(c)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($r : expr, $req_uri: expr, $call: expr, LTD_POST_NO_LOGIN, $uri: expr, $func: expr, $policy: expr)=>{
|
||||
if($uri.eq($req_uri))
|
||||
{
|
||||
$r = Some(Route::limited_post_without_login($uri, $policy));
|
||||
|
||||
if let Some(c) = $call {
|
||||
return ($r, Some($func(c)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($r : expr, $req_uri: expr, $call: expr, LTD_POST_LOGIN, $uri: expr, $func: expr, $policy: expr)=>{
|
||||
if($uri.eq($req_uri))
|
||||
{
|
||||
$r = Some(Route::limited_post($uri, $policy));
|
||||
|
||||
if let Some(c) = $call {
|
||||
return ($r, Some($func(c)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($r : expr, $req_uri: expr, $call: expr, LTD_ADMIN_POST_NO_LOGIN, $uri: expr, $func: expr, $policy: expr)=>{
|
||||
if($uri.eq($req_uri))
|
||||
{
|
||||
$r = Some(Route::limited_admin_post_without_login($uri, $policy));
|
||||
|
||||
if let Some(c) = $call {
|
||||
return ($r, Some($func(c)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($r : expr, $req_uri: expr, $call: expr, ADMIN_POST_LOGIN, $uri: expr, $func: expr)=>{
|
||||
if($uri.eq($req_uri))
|
||||
{
|
||||
$r = Some(Route::admin_post($uri));
|
||||
|
||||
if let Some(c) = $call {
|
||||
return ($r, Some($func(c)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($r : expr, $req_uri: expr, $call: expr, ADMIN_POST_LOGIN_RESTR, $uri: expr, $func: expr, $role: expr)=>{
|
||||
if($uri.eq($req_uri))
|
||||
{
|
||||
$r = Some(Route::admin_post_restricted($uri, $role));
|
||||
|
||||
if let Some(c) = $call {
|
||||
return ($r, Some($func(c)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
pub async fn find_route(req_uri: &str, call: Option<&mut HttpRequestHandler>) -> (Option<Route>, Option<RequestResult>) {
|
||||
@ -206,225 +273,215 @@ pub async fn find_route(req_uri: &str, call: Option<&mut HttpRequestHandler>) ->
|
||||
route!(r, req_uri, call, GET_NO_LOGIN, "/", server_controller::main_index);
|
||||
route!(r, req_uri, call, POST_NO_LOGIN, "/server/config", server_controller::get_config);
|
||||
|
||||
(r, None)
|
||||
}
|
||||
|
||||
/*
|
||||
/// Get the list of routes available
|
||||
pub fn get_routes(route: &str) -> Vec<Route> {
|
||||
|
||||
vec![
|
||||
// Server meta routes
|
||||
Route::get_without_login("/", Box::new(server_controller::main_index)),
|
||||
Route::post_without_login("/server/config", Box::new(server_controller::get_config)),
|
||||
|
||||
// Main user WebSocket
|
||||
Route::post("/ws/token", Box::new(user_ws_controller::get_token)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/ws/token", user_ws_controller::get_token);
|
||||
|
||||
// Account controller
|
||||
Route::limited_post_without_login("/account/create", Box::new(account_controller::create), LimitPolicy::SUCCESS(10)),
|
||||
Route::limited_post_without_login("/account/login", Box::new(account_controller::login_user), LimitPolicy::FAILURE(10)),
|
||||
Route::post("/account/logout", Box::new(account_controller::logout_user)),
|
||||
Route::post("/account/disconnect_all_devices", Box::new(account_controller::disconnect_all_devices)),
|
||||
Route::post("/account/id", Box::new(account_controller::user_id)),
|
||||
Route::post("/account/mail", Box::new(account_controller::get_mail)),
|
||||
Route::limited_post_without_login("/account/exists_email", Box::new(account_controller::exists_mail), LimitPolicy::ANY(30)),
|
||||
Route::limited_post_without_login("/account/has_security_questions", Box::new(account_controller::has_security_questions), LimitPolicy::FAILURE(10)),
|
||||
Route::limited_post_without_login("/account/get_security_questions", Box::new(account_controller::get_security_questions), LimitPolicy::FAILURE(10)),
|
||||
Route::limited_post_without_login("/account/check_security_answers", Box::new(account_controller::check_security_answers), LimitPolicy::FAILURE(10)),
|
||||
Route::limited_post_without_login("/account/check_password_reset_token", Box::new(account_controller::check_password_reset_token), LimitPolicy::FAILURE(10)),
|
||||
Route::limited_post_without_login("/account/reset_user_passwd", Box::new(account_controller::reset_user_password), LimitPolicy::FAILURE(10)),
|
||||
Route::limited_post("/account/export_data", Box::new(account_controller::export_data), LimitPolicy::ANY(10)),
|
||||
Route::post("/account/delete", Box::new(account_controller::delete_account)),
|
||||
route!(r, req_uri, call, LTD_POST_NO_LOGIN, "/account/create", account_controller::create, LimitPolicy::SUCCESS(10));
|
||||
route!(r, req_uri, call, LTD_POST_NO_LOGIN, "/account/login", account_controller::login_user, LimitPolicy::FAILURE(10));
|
||||
route!(r, req_uri, call, POST_LOGIN, "/account/logout", account_controller::logout_user);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/account/disconnect_all_devices", account_controller::disconnect_all_devices);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/account/id", account_controller::user_id);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/account/mail", account_controller::get_mail);
|
||||
route!(r, req_uri, call, LTD_POST_NO_LOGIN, "/account/exists_email", account_controller::exists_mail, LimitPolicy::ANY(30));
|
||||
route!(r, req_uri, call, LTD_POST_NO_LOGIN, "/account/has_security_questions", account_controller::has_security_questions, LimitPolicy::FAILURE(10));
|
||||
route!(r, req_uri, call, LTD_POST_NO_LOGIN, "/account/get_security_questions", account_controller::get_security_questions, LimitPolicy::FAILURE(10));
|
||||
route!(r, req_uri, call, LTD_POST_NO_LOGIN, "/account/check_security_answers", account_controller::check_security_answers, LimitPolicy::FAILURE(10));
|
||||
route!(r, req_uri, call, LTD_POST_NO_LOGIN, "/account/check_password_reset_token", account_controller::check_password_reset_token, LimitPolicy::FAILURE(10));
|
||||
route!(r, req_uri, call, LTD_POST_NO_LOGIN, "/account/reset_user_passwd", account_controller::reset_user_password, LimitPolicy::FAILURE(10));
|
||||
route!(r, req_uri, call, LTD_POST_LOGIN, "/account/export_data", account_controller::export_data, LimitPolicy::ANY(10));
|
||||
route!(r, req_uri, call, POST_LOGIN, "/account/delete", account_controller::delete_account);
|
||||
|
||||
// User controller
|
||||
Route::post("/user/getInfo", Box::new(user_controller::get_single)),
|
||||
Route::post("/user/getInfos", Box::new(user_controller::get_single)),
|
||||
Route::post("/user/getInfoMultiple", Box::new(user_controller::get_multiple)),
|
||||
Route::post("/user/getInfosMultiple", Box::new(user_controller::get_multiple)),
|
||||
Route::post("/user/getAdvancedUserInfo", Box::new(user_controller::get_advanced_info)),
|
||||
Route::post("/user/getAdvancedUserInfos", Box::new(user_controller::get_advanced_info)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/user/getInfo", user_controller::get_single);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/user/getInfos", user_controller::get_single);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/user/getInfoMultiple", user_controller::get_multiple);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/user/getInfosMultiple", user_controller::get_multiple);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/user/getAdvancedUserInfo", user_controller::get_advanced_info);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/user/getAdvancedUserInfos", user_controller::get_advanced_info);
|
||||
|
||||
// Settings controller
|
||||
Route::post("/settings/get_general", Box::new(settings_controller::get_general)),
|
||||
Route::post("/settings/set_general", Box::new(settings_controller::set_general)),
|
||||
Route::post("/settings/check_user_directory_availability", Box::new(settings_controller::check_virtual_directory)),
|
||||
Route::post("/settings/get_language", Box::new(settings_controller::get_language)),
|
||||
Route::post("/settings/set_language", Box::new(settings_controller::set_language)),
|
||||
Route::post("/settings/get_security", Box::new(settings_controller::get_security)),
|
||||
Route::post("/settings/set_security", Box::new(settings_controller::set_security)),
|
||||
Route::post("/settings/check_password", Box::new(settings_controller::check_password)),
|
||||
Route::post("/settings/update_password", Box::new(settings_controller::update_password)),
|
||||
Route::post("/settings/get_account_image", Box::new(settings_controller::get_account_image_settings)),
|
||||
Route::post("/settings/upload_account_image", Box::new(settings_controller::upload_account_image)),
|
||||
Route::post("/settings/delete_account_image", Box::new(settings_controller::delete_account_image)),
|
||||
Route::post("/settings/set_account_image_visibility", Box::new(settings_controller::set_account_image_visibility)),
|
||||
Route::post("/settings/upload_custom_emoji", Box::new(settings_controller::upload_custom_emoji)),
|
||||
Route::post("/settings/delete_custom_emoji", Box::new(settings_controller::delete_custom_emoji)),
|
||||
Route::post("/settings/get_data_conservation_policy", Box::new(settings_controller::get_data_conservation_policy)),
|
||||
Route::limited_post("/settings/set_data_conservation_policy", Box::new(settings_controller::set_data_conservation_policy), LimitPolicy::FAILURE(10)),
|
||||
Route::post("/settings/get_notifications", Box::new(settings_controller::get_notifications)),
|
||||
Route::post("/settings/set_notifications", Box::new(settings_controller::set_notifications)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/get_general", settings_controller::get_general);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/set_general", settings_controller::set_general);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/check_user_directory_availability", settings_controller::check_virtual_directory);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/get_language", settings_controller::get_language);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/set_language", settings_controller::set_language);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/get_security", settings_controller::get_security);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/set_security", settings_controller::set_security);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/check_password", settings_controller::check_password);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/update_password", settings_controller::update_password);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/get_account_image", settings_controller::get_account_image_settings);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/upload_account_image", settings_controller::upload_account_image);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/delete_account_image", settings_controller::delete_account_image);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/set_account_image_visibility", settings_controller::set_account_image_visibility);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/upload_custom_emoji", settings_controller::upload_custom_emoji);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/delete_custom_emoji", settings_controller::delete_custom_emoji);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/get_data_conservation_policy", settings_controller::get_data_conservation_policy);
|
||||
route!(r, req_uri, call, LTD_POST_LOGIN, "/settings/set_data_conservation_policy", settings_controller::set_data_conservation_policy, LimitPolicy::FAILURE(10));
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/get_notifications", settings_controller::get_notifications);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/settings/set_notifications", settings_controller::set_notifications);
|
||||
|
||||
|
||||
// Push notifications controller
|
||||
Route::post("/push_notifications/status", Box::new(push_notifications_controller::get_status)),
|
||||
Route::post("/push_notifications/configure", Box::new(push_notifications_controller::configure)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/push_notifications/status", push_notifications_controller::get_status);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/push_notifications/configure", push_notifications_controller::configure);
|
||||
|
||||
// Friends controller
|
||||
Route::post("/friends/getList", Box::new(friends_controller::get_list)),
|
||||
Route::post("/friends/get_single_infos", Box::new(friends_controller::get_single_friendship_info)),
|
||||
Route::post("/friends/get_user_list", Box::new(friends_controller::get_other_user_list)),
|
||||
Route::post("/friends/getStatus", Box::new(friends_controller::get_status)),
|
||||
Route::post("/friends/sendRequest", Box::new(friends_controller::send_request)),
|
||||
Route::post("/friends/removeRequest", Box::new(friends_controller::cancel_request)),
|
||||
Route::post("/friends/respondRequest", Box::new(friends_controller::respond_request)),
|
||||
Route::post("/friends/remove", Box::new(friends_controller::remove_friend)),
|
||||
Route::post("/friends/setFollowing", Box::new(friends_controller::set_following)),
|
||||
Route::post("/friends/set_can_post_texts", Box::new(friends_controller::set_can_post_texts)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/getList", friends_controller::get_list);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/get_single_infos", friends_controller::get_single_friendship_info);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/get_user_list", friends_controller::get_other_user_list);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/getStatus", friends_controller::get_status);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/sendRequest", friends_controller::send_request);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/removeRequest", friends_controller::cancel_request);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/respondRequest", friends_controller::respond_request);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/remove", friends_controller::remove_friend);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/setFollowing", friends_controller::set_following);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/friends/set_can_post_texts", friends_controller::set_can_post_texts);
|
||||
|
||||
|
||||
// Conversations controller
|
||||
Route::post("/conversations/create", Box::new(conversations_controller::create)),
|
||||
Route::post("/conversations/getList", Box::new(conversations_controller::get_list)),
|
||||
Route::post("/conversations/get_single", Box::new(conversations_controller::get_single)),
|
||||
Route::post("/conversations/updateSettings", Box::new(conversations_controller::update_settings)),
|
||||
Route::post("/conversations/change_image", Box::new(conversations_controller::change_image)),
|
||||
Route::post("/conversations/delete_image", Box::new(conversations_controller::delete_image)),
|
||||
Route::post("/conversations/addMember", Box::new(conversations_controller::add_member)),
|
||||
Route::post("/conversations/setAdmin", Box::new(conversations_controller::set_admin)),
|
||||
Route::post("/conversations/removeMember", Box::new(conversations_controller::remove_member)),
|
||||
Route::post("/conversations/getPrivate", Box::new(conversations_controller::find_private)),
|
||||
Route::post("/conversations/refresh_single", Box::new(conversations_controller::refresh_single)),
|
||||
Route::post("/conversations/get_older_messages", Box::new(conversations_controller::get_older_messages)),
|
||||
Route::post("/conversations/sendMessage", Box::new(conversations_controller::send_message)),
|
||||
Route::post("/conversations/get_number_unread", Box::new(conversations_controller::count_unread)),
|
||||
Route::post("/conversations/get_list_unread", Box::new(conversations_controller::list_unread)),
|
||||
Route::post("/conversations/delete", Box::new(conversations_controller::delete_conversation)),
|
||||
Route::post("/conversations/updateMessage", Box::new(conversations_controller::update_message)),
|
||||
Route::post("/conversations/deleteMessage", Box::new(conversations_controller::delete_message)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/create", conversations_controller::create);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/getList", conversations_controller::get_list);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/get_single", conversations_controller::get_single);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/updateSettings", conversations_controller::update_settings);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/change_image", conversations_controller::change_image);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/delete_image", conversations_controller::delete_image);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/addMember", conversations_controller::add_member);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/setAdmin", conversations_controller::set_admin);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/removeMember", conversations_controller::remove_member);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/getPrivate", conversations_controller::find_private);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/refresh_single", conversations_controller::refresh_single);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/get_older_messages", conversations_controller::get_older_messages);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/sendMessage", conversations_controller::send_message);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/get_number_unread", conversations_controller::count_unread);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/get_list_unread", conversations_controller::list_unread);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/delete", conversations_controller::delete_conversation);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/updateMessage", conversations_controller::update_message);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/conversations/deleteMessage", conversations_controller::delete_message);
|
||||
|
||||
|
||||
// Search controller
|
||||
Route::post("/search/user", Box::new(search_controller::search_user)),
|
||||
Route::post("/user/search", Box::new(search_controller::search_user)),
|
||||
Route::post("/search/global", Box::new(search_controller::search_global)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/search/user", search_controller::search_user);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/user/search", search_controller::search_user);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/search/global", search_controller::search_global);
|
||||
|
||||
|
||||
// Groups controller
|
||||
Route::post("/groups/create", Box::new(groups_controller::create)),
|
||||
Route::post("/groups/get_my_list", Box::new(groups_controller::get_list_user)),
|
||||
Route::post("/groups/get_info", Box::new(groups_controller::get_info_single)),
|
||||
Route::post("/groups/get_multiple_info", Box::new(groups_controller::get_info_multiple)),
|
||||
Route::post("/groups/get_advanced_info", Box::new(groups_controller::get_advanced_info)),
|
||||
Route::post("/groups/get_settings", Box::new(groups_controller::get_settings)),
|
||||
Route::post("/groups/set_settings", Box::new(groups_controller::set_settings)),
|
||||
Route::post("/groups/checkVirtualDirectory", Box::new(groups_controller::check_virtual_dir)),
|
||||
Route::post("/groups/upload_logo", Box::new(groups_controller::upload_logo)),
|
||||
Route::post("/groups/delete_logo", Box::new(groups_controller::delete_logo)),
|
||||
Route::post("/groups/create_conversation", Box::new(groups_controller::create_conversation)),
|
||||
Route::post("/groups/set_conversation_visibility", Box::new(groups_controller::set_conversation_visibility)),
|
||||
Route::post("/groups/delete_conversation", Box::new(groups_controller::delete_conversation)),
|
||||
Route::post("/groups/get_members", Box::new(groups_controller::get_members)),
|
||||
Route::post("/groups/invite", Box::new(groups_controller::invite_user)),
|
||||
Route::post("/groups/cancel_invitation", Box::new(groups_controller::cancel_invitation)),
|
||||
Route::post("/groups/respond_invitation", Box::new(groups_controller::respond_invitation)),
|
||||
Route::post("/groups/send_request", Box::new(groups_controller::send_request)),
|
||||
Route::post("/groups/cancel_request", Box::new(groups_controller::cancel_request)),
|
||||
Route::post("/groups/delete_member", Box::new(groups_controller::delete_member)),
|
||||
Route::post("/groups/update_membership_level", Box::new(groups_controller::update_membership)),
|
||||
Route::post("/groups/respond_request", Box::new(groups_controller::respond_request)),
|
||||
Route::post("/groups/get_membership", Box::new(groups_controller::get_membership)),
|
||||
Route::post("/groups/remove_membership", Box::new(groups_controller::remove_membership)),
|
||||
Route::post("/groups/set_following", Box::new(groups_controller::set_following)),
|
||||
Route::limited_post("/groups/delete", Box::new(groups_controller::delete_group), LimitPolicy::FAILURE(10)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/create", groups_controller::create);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/get_my_list", groups_controller::get_list_user);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/get_info", groups_controller::get_info_single);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/get_multiple_info", groups_controller::get_info_multiple);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/get_advanced_info", groups_controller::get_advanced_info);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/get_settings", groups_controller::get_settings);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/set_settings", groups_controller::set_settings);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/checkVirtualDirectory", groups_controller::check_virtual_dir);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/upload_logo", groups_controller::upload_logo);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/delete_logo", groups_controller::delete_logo);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/create_conversation", groups_controller::create_conversation);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/set_conversation_visibility", groups_controller::set_conversation_visibility);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/delete_conversation", groups_controller::delete_conversation);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/get_members", groups_controller::get_members);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/invite", groups_controller::invite_user);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/cancel_invitation", groups_controller::cancel_invitation);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/respond_invitation", groups_controller::respond_invitation);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/send_request", groups_controller::send_request);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/cancel_request", groups_controller::cancel_request);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/delete_member", groups_controller::delete_member);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/update_membership_level", groups_controller::update_membership);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/respond_request", groups_controller::respond_request);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/get_membership", groups_controller::get_membership);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/remove_membership", groups_controller::remove_membership);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/groups/set_following", groups_controller::set_following);
|
||||
route!(r, req_uri, call, LTD_POST_LOGIN, "/groups/delete", groups_controller::delete_group, LimitPolicy::FAILURE(10));
|
||||
|
||||
|
||||
// Posts controller
|
||||
Route::post("/posts/get_user", Box::new(posts_controller::get_list_user)),
|
||||
Route::post("/posts/get_group", Box::new(posts_controller::get_list_group)),
|
||||
Route::post("/posts/get_latest", Box::new(posts_controller::get_latest)),
|
||||
Route::post("/posts/get_single", Box::new(posts_controller::get_single)),
|
||||
Route::post("/posts/create", Box::new(posts_controller::create_post)),
|
||||
Route::post("/posts/set_visibility_level", Box::new(posts_controller::set_visibility_level)),
|
||||
Route::post("/posts/update_content", Box::new(posts_controller::update_content)),
|
||||
Route::post("/posts/delete", Box::new(posts_controller::delete)),
|
||||
Route::post("/posts/getAvailableTargets", Box::new(posts_controller::get_targets)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/get_user", posts_controller::get_list_user);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/get_group", posts_controller::get_list_group);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/get_latest", posts_controller::get_latest);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/get_single", posts_controller::get_single);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/create", posts_controller::create_post);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/set_visibility_level", posts_controller::set_visibility_level);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/update_content", posts_controller::update_content);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/delete", posts_controller::delete);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/posts/getAvailableTargets", posts_controller::get_targets);
|
||||
|
||||
|
||||
// Comments controller
|
||||
Route::post("/comments/create", Box::new(comments_controller::create)),
|
||||
Route::post("/comments/get_single", Box::new(comments_controller::get_single)),
|
||||
Route::post("/comments/edit", Box::new(comments_controller::edit)),
|
||||
Route::post("/comments/delete", Box::new(comments_controller::delete)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/comments/create", comments_controller::create);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/comments/get_single", comments_controller::get_single);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/comments/edit", comments_controller::edit);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/comments/delete", comments_controller::delete);
|
||||
|
||||
|
||||
// Likes controller
|
||||
Route::post("/likes/update", Box::new(likes_controller::update)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/likes/update", likes_controller::update);
|
||||
|
||||
|
||||
// Surveys controller
|
||||
Route::post("/surveys/get_info", Box::new(surveys_controller::get_info_single)),
|
||||
Route::post("/surveys/send_response", Box::new(surveys_controller::send_response)),
|
||||
Route::post("/surveys/cancel_response", Box::new(surveys_controller::cancel_response)),
|
||||
Route::post("/surveys/create_new_choice", Box::new(surveys_controller::create_new_choice)),
|
||||
Route::post("/surveys/block_new_choices_creation", Box::new(surveys_controller::block_new_choices_creation)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/surveys/get_info", surveys_controller::get_info_single);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/surveys/send_response", surveys_controller::send_response);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/surveys/cancel_response", surveys_controller::cancel_response);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/surveys/create_new_choice", surveys_controller::create_new_choice);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/surveys/block_new_choices_creation", surveys_controller::block_new_choices_creation);
|
||||
|
||||
|
||||
// Notifications controller
|
||||
Route::post("/notifications/count_unread", Box::new(notifications_controller::count_unread)),
|
||||
Route::post("/notifications/count_all_news", Box::new(notifications_controller::count_all_news)),
|
||||
Route::post("/notifications/get_list_unread", Box::new(notifications_controller::get_list_unread)),
|
||||
Route::post("/notifications/mark_seen", Box::new(notifications_controller::mark_seen)),
|
||||
Route::post("/notifications/delete_all", Box::new(notifications_controller::delete_all)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/notifications/count_unread", notifications_controller::count_unread);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/notifications/count_all_news", notifications_controller::count_all_news);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/notifications/get_list_unread", notifications_controller::get_list_unread);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/notifications/mark_seen", notifications_controller::mark_seen);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/notifications/delete_all", notifications_controller::delete_all);
|
||||
|
||||
|
||||
// Virtual directory controller
|
||||
Route::post("/user/findbyfolder", Box::new(virtual_directory_controller::find_user)),
|
||||
Route::post("/virtualDirectory/find", Box::new(virtual_directory_controller::find)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/user/findbyfolder", virtual_directory_controller::find_user);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/virtualDirectory/find", virtual_directory_controller::find);
|
||||
|
||||
|
||||
// Web application controller
|
||||
Route::post("/webApp/getMemberships", Box::new(web_app_controller::get_memberships)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/webApp/getMemberships", web_app_controller::get_memberships);
|
||||
|
||||
// Forez controller
|
||||
Route::post("/forez/get_groups", Box::new(forez_controller::get_list_groups)),
|
||||
Route::post("/forez/get_member_info", Box::new(forez_controller::get_member_info)),
|
||||
route!(r, req_uri, call, POST_LOGIN, "/forez/get_groups", forez_controller::get_list_groups);
|
||||
route!(r, req_uri, call, POST_LOGIN, "/forez/get_member_info", forez_controller::get_member_info);
|
||||
|
||||
|
||||
// === ADMIN ROUTES ===
|
||||
|
||||
|
||||
// Admin accounts controller
|
||||
Route::limited_admin_post_without_login("/admin/accounts/auth_options", Box::new(admin_account_controller::get_auth_options), LimitPolicy::FAILURE(5)),
|
||||
Route::limited_admin_post_without_login("/admin/accounts/auth_with_reset_token", Box::new(admin_account_controller::auth_with_reset_token), LimitPolicy::FAILURE(5)),
|
||||
Route::admin_post("/admin/accounts/sign_out", Box::new(admin_account_controller::sign_out)),
|
||||
Route::admin_post_restricted("/admin/accounts/create", Box::new(admin_account_controller::create), AdminRole::MANAGE_ADMINS),
|
||||
Route::admin_post("/admin/accounts/id", Box::new(admin_account_controller::get_admin_id)),
|
||||
Route::admin_post("/admin/accounts/list", Box::new(admin_account_controller::get_list)),
|
||||
Route::admin_post("/admin/accounts/info", Box::new(admin_account_controller::get_admin_info)),
|
||||
Route::admin_post("/admin/accounts/update_general_settings", Box::new(admin_account_controller::update_general_settings)),
|
||||
Route::admin_post("/admin/accounts/generate_reset_token", Box::new(admin_account_controller::generate_reset_token)),
|
||||
route!(r, req_uri, call, LTD_ADMIN_POST_NO_LOGIN, "/admin/accounts/auth_options", admin_account_controller::get_auth_options, LimitPolicy::FAILURE(5));
|
||||
route!(r, req_uri, call, LTD_ADMIN_POST_NO_LOGIN, "/admin/accounts/auth_with_reset_token", admin_account_controller::auth_with_reset_token, LimitPolicy::FAILURE(5));
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/accounts/sign_out", admin_account_controller::sign_out);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN_RESTR, "/admin/accounts/create", admin_account_controller::create, AdminRole::MANAGE_ADMINS);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/accounts/id", admin_account_controller::get_admin_id);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/accounts/list", admin_account_controller::get_list);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/accounts/info", admin_account_controller::get_admin_info);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/accounts/update_general_settings", admin_account_controller::update_general_settings);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/accounts/generate_reset_token", admin_account_controller::generate_reset_token);
|
||||
|
||||
// Admin security keys controller
|
||||
Route::admin_post("/admin/keys/list", Box::new(admin_keys_controller::get_keys_list)),
|
||||
Route::admin_post("/admin/keys/challenge_register_key", Box::new(admin_keys_controller::challenge_register_key)),
|
||||
Route::admin_post("/admin/keys/register_key", Box::new(admin_keys_controller::register_key)),
|
||||
Route::admin_post("/admin/keys/delete_auth_key", Box::new(admin_keys_controller::delete_auth_key)),
|
||||
Route::limited_admin_post_without_login("/admin/keys/challenge_auth_with_key", Box::new(admin_keys_controller::challenge_auth_with_key), LimitPolicy::ANY(10)),
|
||||
Route::limited_admin_post_without_login("/admin/keys/auth_with_key", Box::new(admin_keys_controller::auth_with_key), LimitPolicy::ANY(10)),
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/keys/list", admin_keys_controller::get_keys_list);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/keys/challenge_register_key", admin_keys_controller::challenge_register_key);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/keys/register_key", admin_keys_controller::register_key);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/keys/delete_auth_key", admin_keys_controller::delete_auth_key);
|
||||
route!(r, req_uri, call, LTD_ADMIN_POST_NO_LOGIN, "/admin/keys/challenge_auth_with_key", admin_keys_controller::challenge_auth_with_key, LimitPolicy::ANY(10));
|
||||
route!(r, req_uri, call, LTD_ADMIN_POST_NO_LOGIN, "/admin/keys/auth_with_key", admin_keys_controller::auth_with_key, LimitPolicy::ANY(10));
|
||||
|
||||
// Admin roles controller
|
||||
Route::admin_post("/admin/roles/list", Box::new(admin_roles_controller::get_list)),
|
||||
Route::admin_post_restricted("/admin/roles/toggle", Box::new(admin_roles_controller::toggle), AdminRole::MANAGE_ADMINS),
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/roles/list", admin_roles_controller::get_list);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN_RESTR, "/admin/roles/toggle", admin_roles_controller::toggle, AdminRole::MANAGE_ADMINS);
|
||||
|
||||
// Admin logs controller
|
||||
Route::admin_post("/admin/logs/list", Box::new(admin_logs_controller::get_list)),
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/logs/list", admin_logs_controller::get_list);
|
||||
|
||||
// Admin users management controller
|
||||
Route::admin_post("/admin/users/search", Box::new(admin_users_controller::search)),
|
||||
Route::admin_post("/admin/users/info", Box::new(admin_users_controller::get_single)),
|
||||
Route::admin_post("/admin/users/change_email_address", Box::new(admin_users_controller::change_email_address)),
|
||||
Route::admin_post("/admin/users/create_password_reset_link", Box::new(admin_users_controller::create_password_reset_link)),
|
||||
]
|
||||
}*/
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/users/search", admin_users_controller::search);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/users/info", admin_users_controller::get_single);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/users/change_email_address", admin_users_controller::change_email_address);
|
||||
route!(r, req_uri, call, ADMIN_POST_LOGIN, "/admin/users/create_password_reset_link", admin_users_controller::create_password_reset_link);
|
||||
|
||||
(r, None)
|
||||
}
|
Loading…
Reference in New Issue
Block a user