Merge pull request #1640 from micro/auth/public-rule
Auth: setup a public rule
This commit is contained in:
commit
5efb386224
@ -203,7 +203,13 @@ var ruleJoinKey = ":"
|
|||||||
// accessForRule returns a rule status, indicating if a rule permits access to a
|
// accessForRule returns a rule status, indicating if a rule permits access to a
|
||||||
// resource for a given account
|
// resource for a given account
|
||||||
func accessForRule(rule *pb.Rule, acc *auth.Account, res *auth.Resource) pb.Access {
|
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
|
return rule.Access
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user