Skip to content

Commit

Permalink
[ADD] opa feature
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaquet-w6d committed Dec 7, 2023
1 parent 59a5895 commit 144e602
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ tonic-build = "0.10.*"
mime = "0.3.17"
mockito = "1.0.0"
uuid = { version = "1.3.1", features = ["v4"] }

[features]
default = []
opa = []
1 change: 1 addition & 0 deletions src/controller/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub async fn update_controller(
let mut object_identity: Option<Arc<Identity>> = None;
let uri = "api/iam/".to_owned() + endpoint;
for data in payload.iter() {
#[cfg(feature = "opa")]
if !validate_roles(&config, &identity, &data.ressource_id, request_id, &uri).await? {
Err(anyhow!("Invalid role!"))?;
}
Expand Down

0 comments on commit 144e602

Please sign in to comment.