mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2025-06-11 19:03:21 +02:00
Start with API implementation
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
use std::sync::Arc;
|
||||
use crate::db::{RawDB, DB, AllocAdapter, Environment, Result};
|
||||
use crate::db::{DatabaseFlags, LMDBorrow, RoTransaction, WriteFlags, };
|
||||
use super::User;
|
||||
|
||||
use rkyv::{Archive, Serialize, Deserialize, Archived};
|
||||
use rkyv::{Deserialize, Archived};
|
||||
|
||||
type Adapter = AllocAdapter<User>;
|
||||
#[derive(Clone, Debug)]
|
||||
@ -11,13 +12,6 @@ pub struct UserDB {
|
||||
db: DB<Adapter>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Archive, Serialize, Deserialize, serde::Serialize, serde::Deserialize)]
|
||||
pub struct User {
|
||||
id: u128,
|
||||
username: String,
|
||||
roles: Vec<String>,
|
||||
}
|
||||
|
||||
impl UserDB {
|
||||
pub unsafe fn new(env: Arc<Environment>, db: RawDB) -> Self {
|
||||
let db = DB::new_unchecked(db);
|
||||
|
@ -1,2 +1,43 @@
|
||||
use rkyv::{Archive, Serialize, Deserialize};
|
||||
|
||||
pub mod db;
|
||||
use capnp::capability::Promise;
|
||||
use capnp::Error;
|
||||
|
||||
use api::user::{
|
||||
info,
|
||||
manage,
|
||||
admin,
|
||||
};
|
||||
|
||||
mod db;
|
||||
pub use db::UserDB;
|
||||
|
||||
#[derive(Debug, Clone, Archive, Serialize, Deserialize, serde::Serialize, serde::Deserialize)]
|
||||
pub struct User {
|
||||
id: u128,
|
||||
username: String,
|
||||
roles: Vec<String>,
|
||||
}
|
||||
|
||||
impl User {
|
||||
|
||||
}
|
||||
|
||||
impl info::Server for User {
|
||||
fn list_roles(
|
||||
&mut self,
|
||||
params: info::ListRolesParams,
|
||||
mut results: info::ListRolesResults
|
||||
) -> Promise<(), Error>
|
||||
{
|
||||
Promise::ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl manage::Server for User {
|
||||
|
||||
}
|
||||
|
||||
impl admin::Server for User {
|
||||
|
||||
}
|
Reference in New Issue
Block a user