| 189 | } |
| 190 | |
| 191 | func (s Scope) regoValue() ast.Value { |
| 192 | r, ok := s.Role.regoValue().(ast.Object) |
| 193 | if !ok { |
| 194 | panic("developer error: role is not an object") |
| 195 | } |
| 196 | |
| 197 | terms := make([]*ast.Term, len(s.AllowIDList)) |
| 198 | for i, v := range s.AllowIDList { |
| 199 | terms[i] = ast.NewTerm(ast.NewObject( |
| 200 | [2]*ast.Term{ |
| 201 | ast.StringTerm("type"), |
| 202 | ast.StringTerm(v.Type), |
| 203 | }, |
| 204 | [2]*ast.Term{ |
| 205 | ast.StringTerm("id"), |
| 206 | ast.StringTerm(v.ID), |
| 207 | }, |
| 208 | ), |
| 209 | ) |
| 210 | } |
| 211 | |
| 212 | r.Insert( |
| 213 | ast.StringTerm("allow_list"), |
| 214 | ast.NewTerm(ast.NewArray(terms...)), |
| 215 | ) |
| 216 | return r |
| 217 | } |
| 218 | |
| 219 | func (perm Permission) regoValue() ast.Value { |
| 220 | return ast.NewObject( |