Skip to content

Commit

Permalink
refactor(authz): Make connector list accessible by operation groups (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisIsMani authored Dec 16, 2024
1 parent 71574a8 commit 6081283
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion crates/router/src/routes/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,10 @@ pub async fn connector_retrieve(
&auth::AdminApiAuthWithMerchantIdFromHeader,
&auth::JWTAuthMerchantFromRoute {
merchant_id,
required_permission: Permission::ProfileConnectorRead,
// This should ideally be ProfileConnectorRead, but since this API responds with
// sensitive data, keeping this as ProfileConnectorWrite
// TODO: Convert this to ProfileConnectorRead once data is masked.
required_permission: Permission::ProfileConnectorWrite,
},
req.headers(),
),
Expand Down
8 changes: 6 additions & 2 deletions crates/router/src/services/authorization/permission_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ impl PermissionGroupExt for PermissionGroup {

fn accessible_groups(&self) -> Vec<Self> {
match self {
Self::OperationsView => vec![Self::OperationsView],
Self::OperationsManage => vec![Self::OperationsView, Self::OperationsManage],
Self::OperationsView => vec![Self::OperationsView, Self::ConnectorsView],
Self::OperationsManage => vec![
Self::OperationsView,
Self::OperationsManage,
Self::ConnectorsView,
],

Self::ConnectorsView => vec![Self::ConnectorsView],
Self::ConnectorsManage => vec![Self::ConnectorsView, Self::ConnectorsManage],
Expand Down

0 comments on commit 6081283

Please sign in to comment.