Skip to main content

reifydb_core/interface/catalog/
identity.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4use reifydb_type::value::identity::IdentityId;
5use serde::{Deserialize, Serialize};
6
7pub type RoleId = u64;
8
9#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10pub struct Identity {
11	pub id: IdentityId,
12	pub name: String,
13	pub enabled: bool,
14}
15
16impl Identity {
17	pub fn name(&self) -> &str {
18		&self.name
19	}
20}
21
22#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
23pub struct Role {
24	pub id: RoleId,
25	pub name: String,
26}
27
28impl Role {
29	pub fn name(&self) -> &str {
30		&self.name
31	}
32}
33
34#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub struct GrantedRole {
36	pub identity: IdentityId,
37	pub role_id: RoleId,
38}