Fix cue resource definitions
This commit is contained in:
@@ -315,7 +315,7 @@ func (s Store) Query{{ .expIdentPlural }}(
|
||||
{{ end }}
|
||||
set = make([]*{{ .goType }}, 0, DefaultSliceCapacity)
|
||||
res *{{ .goType }}
|
||||
aux {{ .auxIdent }}
|
||||
aux *{{ .auxIdent }}
|
||||
rows *sql.Rows
|
||||
count uint
|
||||
expr, tExpr []goqu.Expression
|
||||
@@ -376,9 +376,6 @@ func (s Store) Query{{ .expIdentPlural }}(
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if err = rows.Err(); err != nil {
|
||||
err = fmt.Errorf("could not query {{ .expIdent }}: %w", err)
|
||||
return
|
||||
@@ -398,6 +395,7 @@ func (s Store) Query{{ .expIdentPlural }}(
|
||||
return
|
||||
}
|
||||
|
||||
aux = new({{ .auxIdent }})
|
||||
if err = aux.scan(rows); err != nil {
|
||||
err = fmt.Errorf("could not scan rows for {{ .expIdent }}: %w", err)
|
||||
return
|
||||
|
||||
@@ -62,7 +62,7 @@ import (
|
||||
}]
|
||||
|
||||
// All known RBAC operations for this resource
|
||||
rbac: #rbacResource & {
|
||||
rbac?: #rbacResource & {
|
||||
resourceExpIdent: expIdent
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
]
|
||||
|
||||
resources: [
|
||||
for res in cmp.resources {
|
||||
for res in cmp.resources if res.rbac != _|_ {
|
||||
rbacRefFunc: "\(cmp.expIdent)\(res.expIdent)RbacReferences"
|
||||
references: [
|
||||
for p in res.parents {p},
|
||||
@@ -42,7 +42,7 @@ import (
|
||||
]
|
||||
|
||||
resources: [
|
||||
for cmp in app.corteza.components for res in cmp.resources {
|
||||
for cmp in app.corteza.components for res in cmp.resources if res.rbac != _|_ {
|
||||
importAlias: "\(cmp.ident)Types"
|
||||
expIdent: res.expIdent
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
// All possible RBAC operations on component and resources
|
||||
// flattened
|
||||
operations: [
|
||||
for res in cmp.resources for op in res.rbac.operations {
|
||||
for res in cmp.resources if res.rbac != _|_ for op in res.rbac.operations {
|
||||
"op": op.handle
|
||||
const: "types.\(res.expIdent)ResourceType"
|
||||
resFunc: "types.\(res.expIdent)RbacResource"
|
||||
@@ -42,7 +42,7 @@ import (
|
||||
|
||||
// Operation/resource validators, grouped by resource
|
||||
validation: [
|
||||
for res in cmp.resources {
|
||||
for res in cmp.resources if res.rbac != _|_ {
|
||||
label: res.ident
|
||||
const: "types.\(res.expIdent)ResourceType"
|
||||
funcName: "rbac\(res.expIdent)ResourceValidator"
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
cmpIdent: cmp.ident
|
||||
// Operation/resource validators, grouped by resource
|
||||
types: [
|
||||
for res in cmp.resources {
|
||||
for res in cmp.resources if res.rbac != _|_ {
|
||||
const: "\(res.expIdent)ResourceType"
|
||||
type: res.fqrn
|
||||
resFunc: "\(res.expIdent)RbacResource"
|
||||
|
||||
Reference in New Issue
Block a user