1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 13:29:21 +00:00

Can get a single user membership

This commit is contained in:
Pierre HUBERT 2020-06-29 08:39:21 +02:00
parent 2d796d11bd
commit 7ef9f8dfc1
2 changed files with 12 additions and 0 deletions

View File

@ -311,4 +311,14 @@ pub fn respond_request(r: &mut HttpRequestHandler) -> RequestResult {
// TODO : Create a notification
r.success("The response to the request has been successfully saved!")
}
/// Get information about a single user membership over a group
pub fn get_membership(r: &mut HttpRequestHandler) -> RequestResult {
let group_id = r.post_group_id_with_access("groupID", GroupAccessLevel::MODERATOR_ACCESS)?;
let user_id = r.post_user_id("userID")?;
let membership = groups_helper::get_membership(&group_id, Some(user_id))?;
r.set_response(GroupMemberAPI::new(&membership))
}

View File

@ -164,6 +164,8 @@ pub fn get_routes() -> Vec<Route> {
Route::post("/groups/respond_request", Box::new(groups_controller::respond_request)),
Route::post("/groups/get_membership", Box::new(groups_controller::get_membership)),
// Virtual directory controller
Route::post("/user/findbyfolder", Box::new(virtual_directory_controller::find_user)),