diff --git a/.idea/dictionaries/pierre.xml b/.idea/dictionaries/pierre.xml
index 47f01cb..d682a7c 100644
--- a/.idea/dictionaries/pierre.xml
+++ b/.idea/dictionaries/pierre.xml
@@ -2,6 +2,7 @@
comunic
+ forez
\ No newline at end of file
diff --git a/config.yaml b/config.yaml
index ca12730..843679a 100644
--- a/config.yaml
+++ b/config.yaml
@@ -63,3 +63,11 @@ rtc-relay:
max-users-per-calls: 10
allow-video: true
max-users-per-video-calls: 6
+
+# List of #Forez groups
+#
+# This option allows to enable some extra features for these groups
+#
+# In most cases you should not have to specify this information
+forez_groups:
+ - 32
\ No newline at end of file
diff --git a/src/controllers/forez_controller.rs b/src/controllers/forez_controller.rs
new file mode 100644
index 0000000..3eb5e8b
--- /dev/null
+++ b/src/controllers/forez_controller.rs
@@ -0,0 +1,24 @@
+//! # Forez controller
+//!
+//! This controller contains the logic specific to the integration of the #Forez application into
+//! Comunic.
+//!
+//! @author Pierre Hubert
+
+use crate::data::http_request_handler::HttpRequestHandler;
+use crate::routes::RequestResult;
+use crate::data::config::conf;
+use crate::data::base_request_handler::BaseRequestHandler;
+use crate::api_data::group_api::GroupApi;
+use crate::helpers::groups_helper;
+
+/// Get the list of declared Forez groups in the application
+pub fn get_list_groups(r: &mut HttpRequestHandler) -> RequestResult {
+ let mut list = vec![];
+
+ for group in &conf().forez_groups {
+ list.push(GroupApi::new(&groups_helper::get_info(group)?, r.user_id_opt())?);
+ }
+
+ r.set_response(list)
+}
\ No newline at end of file
diff --git a/src/controllers/mod.rs b/src/controllers/mod.rs
index 1cdf875..4d4192f 100644
--- a/src/controllers/mod.rs
+++ b/src/controllers/mod.rs
@@ -17,4 +17,5 @@ pub mod virtual_directory_controller;
pub mod web_app_controller;
pub mod calls_controller;
pub mod user_ws_actions;
-pub mod push_notifications_controller;
\ No newline at end of file
+pub mod push_notifications_controller;
+pub mod forez_controller;
\ No newline at end of file
diff --git a/src/data/config.rs b/src/data/config.rs
index 7044b2f..bb1d272 100644
--- a/src/data/config.rs
+++ b/src/data/config.rs
@@ -2,6 +2,8 @@ use std::error::Error;
use yaml_rust::{Yaml, YamlLoader};
+use crate::data::group_id::GroupID;
+
/// Server configuration
///
/// @author Pierre Hubert
@@ -47,6 +49,7 @@ pub struct Config {
pub independent_push_service: Option,
pub database: DatabaseConfig,
pub rtc_relay: Option,
+ pub forez_groups: Vec,
}
/// Globally available configuration
@@ -143,6 +146,13 @@ impl Config {
database: database_conf,
rtc_relay: rtc_config,
+
+ forez_groups: parsed["forez_groups"]
+ .as_vec()
+ .unwrap_or(&vec![])
+ .iter()
+ .map(|f| GroupID::new(f.as_i64().unwrap() as u64))
+ .collect(),
};
// Save new configuration in memory
diff --git a/src/routes.rs b/src/routes.rs
index 1e992ab..fbffd81 100644
--- a/src/routes.rs
+++ b/src/routes.rs
@@ -1,6 +1,6 @@
use std::error::Error;
-use crate::controllers::{account_controller, comments_controller, conversations_controller, friends_controller, groups_controller, likes_controller, notifications_controller, posts_controller, push_notifications_controller, search_controller, server_controller, settings_controller, surveys_controller, user_controller, user_ws_controller, virtual_directory_controller, web_app_controller};
+use crate::controllers::{account_controller, comments_controller, conversations_controller, forez_controller, friends_controller, groups_controller, likes_controller, notifications_controller, posts_controller, push_notifications_controller, search_controller, server_controller, settings_controller, surveys_controller, user_controller, user_ws_controller, virtual_directory_controller, web_app_controller};
use crate::data::http_request_handler::HttpRequestHandler;
use crate::routes::Method::{GET, POST};
@@ -297,5 +297,8 @@ pub fn get_routes() -> Vec {
// Web application controller
Route::post("/webApp/getMemberships", Box::new(web_app_controller::get_memberships)),
+
+ // Forez controller
+ Route::post("/forez/get_groups", Box::new(forez_controller::get_list_groups)),
]
}
\ No newline at end of file