hank_types/hank.access_check.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
// @generated
// This file is @generated by prost-build.
/// The operation for the access check, i.e. AND/OR
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AccessCheckOperator {
And = 0,
Or = 1,
}
impl AccessCheckOperator {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
AccessCheckOperator::And => "AND",
AccessCheckOperator::Or => "OR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"AND" => Some(Self::And),
"OR" => Some(Self::Or),
_ => None,
}
}
}
/// An individual access check
///
/// Individual access checks test a user for specific access, or can be a
/// nested chain.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccessCheck {
#[prost(oneof="access_check::Kind", tags="1, 2, 3")]
#[serde(flatten)]
pub kind: ::core::option::Option<access_check::Kind>,
}
/// Nested message and enum types in `AccessCheck`.
pub mod access_check {
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
/// A nested AccessCheckChain
///
/// Access check chains can be nested to allow representations of more
/// compelx logic.
#[prost(message, tag="1")]
Chain(super::AccessCheckChain),
/// A user access check
///
/// Checks if the user requesting access matches this user.
///
/// Can be a user id or a user name.
#[prost(string, tag="2")]
User(::prost::alloc::string::String),
/// A role access check
///
/// Checks if the user requesting access has this role.
///
/// Can be a role id or a role name.
#[prost(string, tag="3")]
Role(::prost::alloc::string::String),
}
}
/// A chain of acess checks
///
/// Access Checks are used to determine if a user has access to a piece of
/// functionality. A chain of checks and nested chains can be used to represent
/// access logic.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccessCheckChain {
/// The operator to use for this chain, i.e. AND/OR
///
/// All access checks in this chain will be combined using this operator.
#[prost(enumeration="AccessCheckOperator", tag="1")]
pub operator: i32,
/// A list of access checks to execute in this chain
#[prost(message, repeated, tag="2")]
pub checks: ::prost::alloc::vec::Vec<AccessCheck>,
}
// @@protoc_insertion_point(module)