Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logger for AuditLoggerInfo when none is provided. #109

Merged
merged 3 commits into from
Feb 16, 2018
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
8 changes: 4 additions & 4 deletions audit_logger_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ func (a *AuditLoggerInfo) LogRejectedAccessRequest(r *Request, p Policies, d Pol
if len(d) > 1 {
allowed := joinPoliciesNames(d[0 : len(d)-1])
denied := d[len(d)-1].GetID()
a.Logger.Printf("policies %s allow access, but policy %s forcefully denied it", allowed, denied)
a.logger().Printf("policies %s allow access, but policy %s forcefully denied it", allowed, denied)
} else if len(d) == 1 {
denied := d[len(d)-1].GetID()
a.Logger.Printf("policy %s forcefully denied the access", denied)
a.logger().Printf("policy %s forcefully denied the access", denied)
} else {
a.Logger.Printf("no policy allowed access")
a.logger().Printf("no policy allowed access")
}
}

func (a *AuditLoggerInfo) LogGrantedAccessRequest(r *Request, p Policies, d Policies) {
a.Logger.Printf("policies %s allow access", joinPoliciesNames(d))
a.logger().Printf("policies %s allow access", joinPoliciesNames(d))
}

func joinPoliciesNames(policies Policies) string {
Expand Down