mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 21:39:21 +00:00
Implement missing features
This commit is contained in:
parent
e0b953ba01
commit
250de62953
@ -15,6 +15,7 @@ use crate::data::http_request_handler::HttpRequestHandler;
|
|||||||
use crate::helpers::{admin_access_token_helper, admin_account_helper, admin_account_key_helper};
|
use crate::helpers::{admin_access_token_helper, admin_account_helper, admin_account_key_helper};
|
||||||
use crate::routes::RequestResult;
|
use crate::routes::RequestResult;
|
||||||
use crate::utils::date_utils::time;
|
use crate::utils::date_utils::time;
|
||||||
|
use crate::constants::admin::AdminRole;
|
||||||
|
|
||||||
/// Create a new administrator account
|
/// Create a new administrator account
|
||||||
pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
|
pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
|
||||||
@ -96,8 +97,7 @@ pub fn update_general_settings(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
let new_email = r.post_email("email")?;
|
let new_email = r.post_email("email")?;
|
||||||
|
|
||||||
if admin_id != r.admin_id()? {
|
if admin_id != r.admin_id()? {
|
||||||
// TODO
|
r.check_admin_has_role(AdminRole::MANAGE_ADMINS)?;
|
||||||
unimplemented!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
admin_account_helper::set_general_settings(NewAdminGeneralSettings {
|
admin_account_helper::set_general_settings(NewAdminGeneralSettings {
|
||||||
@ -114,8 +114,7 @@ pub fn generate_reset_token(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
let admin_id = r.post_admin_id("id")?;
|
let admin_id = r.post_admin_id("id")?;
|
||||||
|
|
||||||
if admin_id != r.admin_id()? {
|
if admin_id != r.admin_id()? {
|
||||||
// TODO
|
r.check_admin_has_role(AdminRole::MANAGE_ADMINS)?;
|
||||||
unimplemented!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let token = admin_account_helper::create_new_reset_token(admin_id)?;
|
let token = admin_account_helper::create_new_reset_token(admin_id)?;
|
||||||
|
@ -12,6 +12,7 @@ use crate::data::webauthn_config::get_wan;
|
|||||||
use crate::helpers::{admin_access_token_helper, admin_account_helper, admin_account_key_helper, admin_key_authentication_challenges_helper, admin_key_registration_challenges_helper};
|
use crate::helpers::{admin_access_token_helper, admin_account_helper, admin_account_key_helper, admin_key_authentication_challenges_helper, admin_key_registration_challenges_helper};
|
||||||
use crate::routes::RequestResult;
|
use crate::routes::RequestResult;
|
||||||
use crate::api_data::admin::admin_keys_api::AdminKeyAPI;
|
use crate::api_data::admin::admin_keys_api::AdminKeyAPI;
|
||||||
|
use crate::constants::admin::AdminRole;
|
||||||
|
|
||||||
impl HttpRequestHandler {
|
impl HttpRequestHandler {
|
||||||
pub fn post_admin_auth_key(&mut self, name_mail: &str, name_key_id: &str) -> Res<AdminKey> {
|
pub fn post_admin_auth_key(&mut self, name_mail: &str, name_key_id: &str) -> Res<AdminKey> {
|
||||||
@ -37,8 +38,7 @@ pub fn get_keys_list(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
let admin_id = r.post_admin_id("id")?;
|
let admin_id = r.post_admin_id("id")?;
|
||||||
|
|
||||||
if admin_id != r.admin_id()? {
|
if admin_id != r.admin_id()? {
|
||||||
// TODO : implement
|
r.check_admin_has_role(AdminRole::MANAGE_ADMINS)?;
|
||||||
unimplemented!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let keys = admin_account_key_helper::get_admin_keys(admin_id)?;
|
let keys = admin_account_key_helper::get_admin_keys(admin_id)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user