Skip to content

Commit

Permalink
added no policies message
Browse files Browse the repository at this point in the history
  • Loading branch information
cio-haneul committed Jul 11, 2024
1 parent e7e95e4 commit 2943c8f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ async fn main() -> Result<(), SdkError<ListPoliciesError>> {
// println!("{:?}", attached_policy_pairs.clone().len());

let policies_iter = decoded_policy_pairs.iter();
let mut matching_policy = vec![];

for (attached_policy, policy_json) in policies_iter {
let statements = policy_json
Expand All @@ -292,6 +293,7 @@ async fn main() -> Result<(), SdkError<ListPoliciesError>> {
}

if !allowed_statements.is_empty() {
matching_policy.push(attached_policy);
println!("[*] This policy : {}", attached_policy.bright_green().bold());
for statement in allowed_statements {
match to_string_pretty(statement) {
Expand All @@ -300,6 +302,12 @@ async fn main() -> Result<(), SdkError<ListPoliciesError>> {
}
}
}

}

if matching_policy.is_empty() {
let message: &str = "[*] No policies allowed this action";
println!("{}", message.bright_red().bold());
}

Ok(())
Expand Down

0 comments on commit 2943c8f

Please sign in to comment.