forked from juspay/hyperswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_role.rs
112 lines (99 loc) · 2.37 KB
/
user_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
use common_enums::PermissionGroup;
use common_utils::pii;
pub mod role;
#[derive(Debug, serde::Serialize)]
pub enum Permission {
PaymentRead,
PaymentWrite,
RefundRead,
RefundWrite,
ApiKeyRead,
ApiKeyWrite,
MerchantAccountRead,
MerchantAccountWrite,
MerchantConnectorAccountRead,
MerchantConnectorAccountWrite,
RoutingRead,
RoutingWrite,
DisputeRead,
DisputeWrite,
MandateRead,
MandateWrite,
CustomerRead,
CustomerWrite,
Analytics,
ThreeDsDecisionManagerWrite,
ThreeDsDecisionManagerRead,
SurchargeDecisionManagerWrite,
SurchargeDecisionManagerRead,
UsersRead,
UsersWrite,
MerchantAccountCreate,
WebhookEventRead,
PayoutWrite,
PayoutRead,
}
#[derive(Debug, serde::Serialize)]
pub enum PermissionModule {
Payments,
Refunds,
MerchantAccount,
Connectors,
Routing,
Analytics,
Mandates,
Customer,
Disputes,
ThreeDsDecisionManager,
SurchargeDecisionManager,
AccountCreate,
Payouts,
}
#[derive(Debug, serde::Serialize)]
pub struct AuthorizationInfoResponse(pub Vec<AuthorizationInfo>);
#[derive(Debug, serde::Serialize)]
#[serde(untagged)]
pub enum AuthorizationInfo {
Module(ModuleInfo),
Group(GroupInfo),
}
#[derive(Debug, serde::Serialize)]
pub struct ModuleInfo {
pub module: PermissionModule,
pub description: &'static str,
pub permissions: Vec<PermissionInfo>,
}
#[derive(Debug, serde::Serialize)]
pub struct GroupInfo {
pub group: PermissionGroup,
pub description: &'static str,
pub permissions: Vec<PermissionInfo>,
}
#[derive(Debug, serde::Serialize)]
pub struct PermissionInfo {
pub enum_name: Permission,
pub description: &'static str,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct UpdateUserRoleRequest {
pub email: pii::Email,
pub role_id: String,
}
#[derive(Debug, serde::Serialize)]
pub enum UserStatus {
Active,
InvitationSent,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct AcceptInvitationRequest {
pub merchant_ids: Vec<String>,
pub need_dashboard_entry_response: Option<bool>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct DeleteUserRoleRequest {
pub email: pii::Email,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct TransferOrgOwnershipRequest {
pub email: pii::Email,
}