Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/api-types/src/v3/role_assignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,13 @@ pub struct RoleAssignmentListParameters {
#[serde(default)]
pub include_names: Option<bool>,
}

/// Role assignments - List of roles.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]
#[cfg_attr(feature = "validate", derive(validator::Validate))]
pub struct RoleAssignmentRoleList {
/// Collection of role objects from assignments.
#[cfg_attr(feature = "validate", validate(nested))]
pub roles: Vec<Role>,
}
11 changes: 11 additions & 0 deletions crates/api-types/src/v3/role_assignment_conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ impl TryFrom<api_types::RoleAssignmentListParameters>
}
}

impl TryFrom<provider_types::Assignment> for api_types::Role {
type Error = KeystoneApiError;

fn try_from(value: provider_types::Assignment) -> Result<Self, Self::Error> {
Ok(api_types::Role {
id: value.role_id,
name: value.role_name,
})
}
}

#[cfg(test)]
mod tests {
use crate::v3::role_assignment::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ use crate::keystone::ServiceState;

mod check;
mod grant;
mod list;
mod revoke;

pub(crate) fn openapi_router() -> OpenApiRouter<ServiceState> {
OpenApiRouter::new().routes(routes!(check::check, grant::grant, revoke::revoke))
OpenApiRouter::new().routes(routes!(
check::check,
grant::grant,
revoke::revoke,
list::list
))
}
Loading
Loading