Skip to main content

hank_types/
hank.access_check.rs

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