feagi_api/security/authz/
permissions.rs1use crate::security::AuthContext;
5
6#[derive(Debug, Clone)]
8#[allow(dead_code)]
9pub enum Permission {
10 NeuronRead,
12 NeuronCreate,
13 NeuronDelete,
14
15 CorticalAreaRead,
17 CorticalAreaCreate,
18 CorticalAreaUpdate,
19 CorticalAreaDelete,
20
21 BrainRegionRead,
23 BrainRegionCreate,
24 BrainRegionUpdate,
25 BrainRegionDelete,
26
27 GenomeLoad,
29 GenomeSave,
30 GenomeValidate,
31
32 AnalyticsRead,
34
35 SystemAdmin,
37 SystemRead,
38}
39
40pub struct Authorizer;
42
43impl Authorizer {
44 pub fn authorize(_ctx: &AuthContext, _perm: Permission) -> Result<(), AuthzError> {
46 Ok(()) }
48}
49
50#[derive(Debug, Clone)]
52pub struct AuthzError {
53 pub message: String,
54}
55
56impl AuthzError {
57 pub fn new(message: impl Into<String>) -> Self {
58 Self {
59 message: message.into(),
60 }
61 }
62}
63
64impl std::fmt::Display for AuthzError {
65 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66 write!(f, "{}", self.message)
67 }
68}
69
70impl std::error::Error for AuthzError {}