Skip to content
Clone
d5939db
71 lines 1.8 KB Rust
use uuid::Uuid;
use crate::error::SpaceResult;
use crate::features::SpaceService;
use super::types::{CreateRoleCmd, RolePage, RoleView, UpdateRoleCmd};
use super::usecase;
impl SpaceService {
pub async fn create_role(
&self,
caller: Uuid,
space_id: Uuid,
cmd: CreateRoleCmd,
) -> SpaceResult<RoleView> {
usecase::create_role(self, caller, space_id, cmd).await
}
pub async fn get_role(
&self,
caller: Option<Uuid>,
space_id: Uuid,
role_id: Uuid,
) -> SpaceResult<RoleView> {
usecase::get_role(self, caller, space_id, role_id).await
}
pub async fn update_role(
&self,
caller: Uuid,
space_id: Uuid,
role_id: Uuid,
cmd: UpdateRoleCmd,
) -> SpaceResult<RoleView> {
usecase::update_role(self, caller, space_id, role_id, cmd).await
}
pub async fn delete_role(&self, caller: Uuid, space_id: Uuid, role_id: Uuid) -> SpaceResult<()> {
usecase::delete_role(self, caller, space_id, role_id).await
}
pub async fn list_roles(
&self,
caller: Uuid,
space_id: Uuid,
limit: u64,
offset: u64,
) -> SpaceResult<RolePage> {
usecase::list_roles(self, caller, space_id, limit, offset).await
}
pub async fn assign_role(
&self,
caller: Uuid,
space_id: Uuid,
user_id: Uuid,
role_id: Uuid,
) -> SpaceResult<()> {
usecase::assign_role(self, caller, space_id, user_id, role_id).await
}
pub async fn unassign_role(
&self,
caller: Uuid,
space_id: Uuid,
user_id: Uuid,
role_id: Uuid,
) -> SpaceResult<()> {
usecase::unassign_role(self, caller, space_id, user_id, role_id).await
}
}