use mogh_resolver::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::entities::{
ResourceTarget,
permission::{Permission, PermissionLevelAndSpecifics, UserTarget},
};
use super::KomodoReadRequest;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/ListPermissions",
description = "List permissions for the calling user.",
request_body(content = ListPermissions),
responses(
(status = 200, description = "The list of permissions", body = ListPermissionsResponse),
),
)]
pub fn list_permissions() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(ListPermissionsResponse)]
#[error(mogh_error::Error)]
pub struct ListPermissions {}
#[typeshare]
pub type ListPermissionsResponse = Vec<Permission>;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/GetPermission",
description = "Gets the calling user's permission level on a specific resource.",
request_body(content = GetPermission),
responses(
(status = 200, description = "The permission level", body = GetPermissionResponse),
),
)]
pub fn get_permission() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(GetPermissionResponse)]
#[error(mogh_error::Error)]
pub struct GetPermission {
pub target: ResourceTarget,
}
#[typeshare]
pub type GetPermissionResponse = PermissionLevelAndSpecifics;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/ListUserTargetPermissions",
description = "List permissions for a specific user.",
request_body(content = ListUserTargetPermissions),
responses(
(status = 200, description = "The list of permissions", body = ListUserTargetPermissionsResponse),
),
)]
pub fn list_user_target_permissions() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(ListUserTargetPermissionsResponse)]
#[error(mogh_error::Error)]
pub struct ListUserTargetPermissions {
pub user_target: UserTarget,
}
#[typeshare]
pub type ListUserTargetPermissionsResponse = Vec<Permission>;