-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathbuiltin_role.rs
54 lines (41 loc) · 1.08 KB
/
builtin_role.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
use serde::Deserialize;
use serde::Serialize;
use strum::AsRefStr;
use strum::EnumString;
use utoipa::ToSchema;
use crate::roles::BuiltinRoleSet;
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, EnumString, AsRefStr, ToSchema,
)]
pub enum BuiltinRole {
/// A user with this role short-circuits all role and permission checks
///
/// Alternatively, especially for development, the `EDITOAST_DISABLE_AUTHORIZATION` environment variable can be set
/// when no user identity header is present. (This is the case when editoast is queried directly and
/// not through the gateway.)
Superuser,
OpsWrite,
OpsRead,
InfraRead,
InfraWrite,
RollingStockCollectionRead,
RollingStockCollectionWrite,
WorkScheduleWrite,
WorkScheduleRead,
MapRead,
Stdcm,
StdcmAdmin,
TimetableRead,
TimetableWrite,
DocumentRead,
DocumentWrite,
SubjectRead,
SubjectWrite,
RoleRead,
RoleWrite,
}
impl BuiltinRoleSet for BuiltinRole {
fn superuser() -> Self {
Self::Superuser
}
}