()
| 103 | } |
| 104 | |
| 105 | func (z Object) regoValue() ast.Value { |
| 106 | userACL := ast.NewObject() |
| 107 | for k, v := range z.ACLUserList { |
| 108 | userACL.Insert(ast.StringTerm(k), ast.NewTerm(regoSliceString(v...))) |
| 109 | } |
| 110 | grpACL := ast.NewObject() |
| 111 | for k, v := range z.ACLGroupList { |
| 112 | grpACL.Insert(ast.StringTerm(k), ast.NewTerm(regoSliceString(v...))) |
| 113 | } |
| 114 | return ast.NewObject( |
| 115 | [2]*ast.Term{ |
| 116 | ast.StringTerm("id"), |
| 117 | ast.StringTerm(z.ID), |
| 118 | }, |
| 119 | [2]*ast.Term{ |
| 120 | ast.StringTerm("owner"), |
| 121 | ast.StringTerm(z.Owner), |
| 122 | }, |
| 123 | [2]*ast.Term{ |
| 124 | ast.StringTerm("org_owner"), |
| 125 | ast.StringTerm(z.OrgID), |
| 126 | }, |
| 127 | [2]*ast.Term{ |
| 128 | ast.StringTerm("any_org"), |
| 129 | ast.BooleanTerm(z.AnyOrgOwner), |
| 130 | }, |
| 131 | [2]*ast.Term{ |
| 132 | ast.StringTerm("type"), |
| 133 | ast.StringTerm(z.Type), |
| 134 | }, |
| 135 | [2]*ast.Term{ |
| 136 | ast.StringTerm("acl_user_list"), |
| 137 | ast.NewTerm(userACL), |
| 138 | }, |
| 139 | [2]*ast.Term{ |
| 140 | ast.StringTerm("acl_group_list"), |
| 141 | ast.NewTerm(grpACL), |
| 142 | }, |
| 143 | ) |
| 144 | } |
| 145 | |
| 146 | // withCachedRegoValue returns a copy of the role with the cachedRegoValue. |
| 147 | // It does not mutate the underlying role. |
nothing calls this directly
no test coverage detected