reifydb_core/interface/catalog/
identity.rs1use reifydb_value::value::{Value, identity::IdentityId, value_type::ValueType};
5use serde::{Deserialize, Serialize};
6
7pub type RoleId = u64;
8
9pub type IdentityAttributeId = u64;
10
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12pub struct Identity {
13 pub id: IdentityId,
14 pub name: String,
15 pub enabled: bool,
16}
17
18impl Identity {
19 pub fn name(&self) -> &str {
20 &self.name
21 }
22}
23
24#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
25pub struct Role {
26 pub id: RoleId,
27 pub name: String,
28}
29
30impl Role {
31 pub fn name(&self) -> &str {
32 &self.name
33 }
34}
35
36#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
37pub struct GrantedRole {
38 pub identity: IdentityId,
39 pub role_id: RoleId,
40}
41
42#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
43pub struct IdentityAttribute {
44 pub id: IdentityAttributeId,
45 pub name: String,
46 pub value_type: ValueType,
47}
48
49impl IdentityAttribute {
50 pub fn name(&self) -> &str {
51 &self.name
52 }
53}
54
55#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
56pub struct IdentityAttributeValue {
57 pub identity: IdentityId,
58 pub attribute: IdentityAttributeId,
59 pub value: Value,
60}