mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Can get the list of keys of an admin
This commit is contained in:
@ -8,6 +8,7 @@ use crate::api_data::admin::admin_auth_options::AdminAuthOptions;
|
||||
use crate::api_data::admin::admin_auth_success::AdminAuthSuccess;
|
||||
use crate::api_data::admin::admin_id_api::AdminIDAPI;
|
||||
use crate::api_data::admin::admin_info_api::AdminInfoAPI;
|
||||
use crate::api_data::admin::admin_keys_api::AdminKeyAPI;
|
||||
use crate::data::admin::{AdminKey, NewAdminGeneralSettings};
|
||||
use crate::data::base_request_handler::BaseRequestHandler;
|
||||
use crate::data::error::Res;
|
||||
@ -82,19 +83,27 @@ pub fn get_admin_info(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
false => admin_account_helper::find_admin_by_id(r.admin_id()?)?,
|
||||
true => {
|
||||
let admin_id = r.post_admin_id("id")?;
|
||||
|
||||
if admin_id == r.admin_id()? {
|
||||
admin_account_helper::find_admin_by_id(admin_id)?
|
||||
} else {
|
||||
// TODO
|
||||
unimplemented!();
|
||||
}
|
||||
admin_account_helper::find_admin_by_id(admin_id)?
|
||||
}
|
||||
};
|
||||
|
||||
r.set_response(AdminInfoAPI::new(&admin))
|
||||
}
|
||||
|
||||
/// Get an admin keys
|
||||
pub fn get_keys_list(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let admin_id = r.post_admin_id("id")?;
|
||||
|
||||
if admin_id != r.admin_id()? {
|
||||
// TODO : implement
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
let keys = admin_account_key_helper::get_admin_keys(admin_id)?;
|
||||
|
||||
r.set_response(keys.iter().map(AdminKeyAPI::new).collect::<Vec<AdminKeyAPI>>())
|
||||
}
|
||||
|
||||
/// Update general settings
|
||||
pub fn update_general_settings(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let admin_id = r.post_admin_id("id")?;
|
||||
|
Reference in New Issue
Block a user