HasPolicies determines whether a model has any of the specified policies. If one is found we return true.
(sec string, ptype string, rules [][]string)
| 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) { |
| 183 | for i := 0; i < len(rules); i++ { |
| 184 | ok, err := model.HasPolicy(sec, ptype, rules[i]) |
| 185 | if err != nil { |
| 186 | return false, err |
| 187 | } |
| 188 | if ok { |
| 189 | return true, nil |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | return false, nil |
| 194 | } |
| 195 | |
| 196 | // AddPolicy adds a policy rule to the model. |
| 197 | func (model Model) AddPolicy(sec string, ptype string, rule []string) error { |
no test coverage detected