HasPolicy determines whether a model has the specified policy rule.
(sec string, ptype string, rule []string)
| 170 | |
| 171 | // HasPolicy determines whether a model has the specified policy rule. |
| 172 | func (model Model) HasPolicy(sec string, ptype string, rule []string) (bool, error) { |
| 173 | _, err := model.GetAssertion(sec, ptype) |
| 174 | if err != nil { |
| 175 | return false, err |
| 176 | } |
| 177 | _, ok := model[sec][ptype].PolicyMap[strings.Join(rule, DefaultSep)] |
| 178 | return ok, nil |
| 179 | } |
| 180 | |
| 181 | // HasPolicies determines whether a model has any of the specified policies. If one is found we return true. |
| 182 | func (model Model) HasPolicies(sec string, ptype string, rules [][]string) (bool, error) { |
no test coverage detected