Skip to content

Commit

Permalink
feat(authz): Create a permission generator (#6394)
Browse files Browse the repository at this point in the history
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
ThisIsMani and hyperswitch-bot[bot] authored Oct 24, 2024
1 parent ca325e9 commit 4a0afb8
Show file tree
Hide file tree
Showing 32 changed files with 646 additions and 623 deletions.
16 changes: 1 addition & 15 deletions crates/api_models/src/user_role.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
use common_enums::PermissionGroup;
use common_enums::{ParentGroup, PermissionGroup};
use common_utils::pii;
use masking::Secret;

pub mod role;

#[derive(Clone, Debug, serde::Serialize, PartialEq, Eq, Hash)]
pub enum ParentGroup {
Operations,
Connectors,
Workflows,
Analytics,
Users,
#[serde(rename = "MerchantAccess")]
Merchant,
#[serde(rename = "OrganizationAccess")]
Organization,
Recon,
}

#[derive(Debug, serde::Serialize)]
pub struct AuthorizationInfoResponse(pub Vec<AuthorizationInfo>);

Expand Down
41 changes: 41 additions & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2890,6 +2890,47 @@ pub enum PermissionGroup {
ReconOps,
}

#[derive(Clone, Debug, serde::Serialize, PartialEq, Eq, Hash, strum::EnumIter)]
pub enum ParentGroup {
Operations,
Connectors,
Workflows,
Analytics,
Users,
#[serde(rename = "MerchantAccess")]
Merchant,
#[serde(rename = "OrganizationAccess")]
Organization,
Recon,
}

#[derive(Clone, Copy, Eq, PartialEq, Hash)]
pub enum Resource {
Payment,
Refund,
ApiKey,
Account,
Connector,
Routing,
Dispute,
Mandate,
Customer,
Analytics,
ThreeDsDecisionManager,
SurchargeDecisionManager,
User,
WebhookEvent,
Payout,
Report,
Recon,
}

#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
pub enum PermissionScope {
Read,
Write,
}

/// Name of banks supported by Hyperswitch
#[derive(
Clone,
Expand Down
Loading

0 comments on commit 4a0afb8

Please sign in to comment.