1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Can get admin roles through API

This commit is contained in:
2021-05-14 18:38:46 +02:00
parent 73837553c7
commit 4365caf602
8 changed files with 173 additions and 112 deletions

View File

@ -12,6 +12,7 @@ pub struct AdminInfoAPI {
name: String,
email: String,
time_create: u64,
roles: Vec<&'static str>,
}
impl AdminInfoAPI {
@ -21,6 +22,7 @@ impl AdminInfoAPI {
name: a.name.clone(),
email: a.email.clone(),
time_create: a.time_create,
roles: a.roles.iter().map(|r| r.to_id()).collect(),
}
}
}

View File

@ -0,0 +1,24 @@
//! # Administrator role details api
//!
//! @author Pierre Hubert
use serde::Serialize;
use crate::constants::admin::AdminRoleMetadata;
#[derive(Serialize)]
pub struct AdminRoleDetailsAPI {
id: &'static str,
name: &'static str,
description: &'static str,
}
impl AdminRoleDetailsAPI {
pub fn new(r: &AdminRoleMetadata) -> Self {
Self {
id: r.id,
name: r.name,
description: r.description,
}
}
}

View File

@ -7,4 +7,5 @@ pub mod admin_auth_success;
pub mod admin_id_api;
pub mod admin_info_api;
pub mod admin_keys_api;
pub mod admin_res_create_reset_token;
pub mod admin_res_create_reset_token;
pub mod admin_role_api;