use std::{
collections::{HashMap, HashSet},
sync::Arc,
};
use async_trait::async_trait;
use cosmian_kmip::{kmip_0::kmip_types::State, kmip_2_1::KmipOperation};
use crate::{InterfaceResult, stores::SessionParams};
#[async_trait(?Send)]
pub trait PermissionsStore {
async fn list_user_operations_granted(
&self,
user: &str,
params: Option<Arc<dyn SessionParams>>,
) -> InterfaceResult<HashMap<String, (String, State, HashSet<KmipOperation>)>>;
async fn list_object_operations_granted(
&self,
uid: &str,
params: Option<Arc<dyn SessionParams>>,
) -> InterfaceResult<HashMap<String, HashSet<KmipOperation>>>;
async fn grant_operations(
&self,
uid: &str,
user: &str,
operations: HashSet<KmipOperation>,
params: Option<Arc<dyn SessionParams>>,
) -> InterfaceResult<()>;
async fn remove_operations(
&self,
uid: &str,
user: &str,
operations: HashSet<KmipOperation>,
params: Option<Arc<dyn SessionParams>>,
) -> InterfaceResult<()>;
async fn list_user_operations_on_object(
&self,
uid: &str,
user: &str,
no_inherited_access: bool,
params: Option<Arc<dyn SessionParams>>,
) -> InterfaceResult<HashSet<KmipOperation>>;
}