| "veyron.io/veyron/veyron2/security" |
| // Includes returns true iff the ACL grants access to a principal |
| // that presents blessings. |
| func (acl ACL) Includes(blessings ...string) bool { |
| blessings = pruneBlacklisted(acl.NotIn, blessings) |
| for _, pattern := range acl.In { |
| if pattern.MatchedBy(blessings...) { |
| // WriteTo writes the JSON-encoded representation of a TaggedACLMap to w. |
| func (m TaggedACLMap) WriteTo(w io.Writer) error { |
| return json.NewEncoder(w).Encode(m) |
| // ReadTaggedACLMap reads the JSON-encoded representation of a TaggedACLMap from r. |
| func ReadTaggedACLMap(r io.Reader) (m TaggedACLMap, err error) { |
| err = json.NewDecoder(r).Decode(&m) |
| func pruneBlacklisted(blacklist, blessings []string) []string { |
| for _, b := range blessings { |
| if !security.BlessingPattern(b).MatchedBy(blacklist...) { |
| filtered = append(filtered, b) |