use mogh_resolver::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::entities::{
NoData, ResourceTarget, ResourceTargetVariant,
permission::{PermissionLevelAndSpecifics, UserTarget},
};
use super::KomodoWriteRequest;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdatePermissionOnTarget",
description = "**Admin only.** Update a user or user group's permission on a resource.",
request_body(content = UpdatePermissionOnTarget),
responses(
(status = 200, description = "No data", body = UpdatePermissionOnTargetResponse),
),
)]
pub fn update_permission_on_target() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(UpdatePermissionOnTargetResponse)]
#[error(mogh_error::Error)]
pub struct UpdatePermissionOnTarget {
pub user_target: UserTarget,
pub resource_target: ResourceTarget,
pub permission: PermissionLevelAndSpecifics,
}
#[typeshare]
pub type UpdatePermissionOnTargetResponse = NoData;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdatePermissionOnResourceType",
description = "**Admin only.** Update a user or user group's base permission level on a resource type.",
request_body(content = UpdatePermissionOnResourceType),
responses(
(status = 200, description = "No data", body = UpdatePermissionOnResourceTypeResponse),
),
)]
pub fn update_permission_on_resource_type() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(UpdatePermissionOnResourceTypeResponse)]
#[error(mogh_error::Error)]
pub struct UpdatePermissionOnResourceType {
pub user_target: UserTarget,
pub resource_type: ResourceTargetVariant,
pub permission: PermissionLevelAndSpecifics,
}
#[typeshare]
pub type UpdatePermissionOnResourceTypeResponse = NoData;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdateUserBasePermissions",
description = "**Admin only.** Update a user's base permissions.",
request_body(content = UpdateUserBasePermissions),
responses(
(status = 200, description = "No data", body = UpdateUserBasePermissionsResponse),
),
)]
pub fn update_user_base_permissions() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(UpdateUserBasePermissionsResponse)]
#[error(mogh_error::Error)]
pub struct UpdateUserBasePermissions {
pub user_id: String,
pub enabled: Option<bool>,
pub create_servers: Option<bool>,
pub create_builds: Option<bool>,
}
#[typeshare]
pub type UpdateUserBasePermissionsResponse = NoData;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/UpdateUserAdmin",
description = "**Super Admin only.** Update whether a user is admin.",
request_body(content = UpdateUserAdmin),
responses(
(status = 200, description = "No data", body = UpdateUserAdminResponse),
),
)]
pub fn update_user_admin() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoWriteRequest)]
#[response(UpdateUserAdminResponse)]
#[error(mogh_error::Error)]
pub struct UpdateUserAdmin {
pub user_id: String,
pub admin: bool,
}
#[typeshare]
pub type UpdateUserAdminResponse = NoData;