Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ type Policy struct {
Version string
Statements []Statement `json:"Statement"`
actionStatementIndex map[Action][]int
hasDeny bool
}

// HasDenyStatement returns if the policy has a deny statement.
func (iamp *Policy) HasDenyStatement() bool {
return iamp.hasDeny
}

// MatchResource matches resource with match resource patterns
Expand Down Expand Up @@ -494,6 +500,7 @@ func (iamp *Policy) updateActionIndex() {
for i := range iamp.Statements {
stmt := &iamp.Statements[i]
if stmt.Effect == Deny {
iamp.hasDeny = true
continue
}
for action := range stmt.Actions {
Expand Down
Loading