Auth: setup a public rule

This commit is contained in:
Ben Toogood 2020-05-15 10:24:30 +01:00
parent f64b1468a5
commit 4d2de923cd

View File

@ -203,7 +203,13 @@ var ruleJoinKey = ":"
// accessForRule returns a rule status, indicating if a rule permits access to a
// resource for a given account
func accessForRule(rule *pb.Rule, acc *auth.Account, res *auth.Resource) pb.Access {
if rule.Role == "*" {
// a blank role permits access to the public
if rule.Role == "" {
return rule.Access
}
// a * role permits access to any user
if rule.Role == "*" && acc != nil {
return rule.Access
}