MCPcopy Index your code
hub / github.com/coder/coder / regoValue

Method regoValue

coderd/rbac/astvalue.go:191–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189}
190
191func (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
219func (perm Permission) regoValue() ast.Value {
220 return ast.NewObject(

Callers

nothing calls this directly

Calls 1

regoValueMethod · 0.65

Tested by

no test coverage detected