Fix cue resource definitions
This commit is contained in:
parent
faa1dc57b2
commit
5fe1e63f22
@ -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"
|
||||
|
||||
@ -17,9 +17,9 @@ exposedModule: schema.#Resource & {
|
||||
id: schema.IdField
|
||||
handle: schema.HandleField
|
||||
name: {}
|
||||
node_id: { ident: "nodeID", goType: "uint64" }
|
||||
compose_module_id: { ident: "composeModuleID", goType: "uint64" }
|
||||
compose_namespace_id: { ident: "composeNamespaceID", goType: "uint64" }
|
||||
node_id: { ident: "nodeID", goType: "uint64", storeIdent: "rel_node" }
|
||||
compose_module_id: { ident: "composeModuleID", goType: "uint64", storeIdent: "rel_compose_module" }
|
||||
compose_namespace_id: { ident: "composeNamespaceID", goType: "uint64", storeIdent: "rel_compose_namespace" }
|
||||
fields: { goType: "types.ModuleFieldSet" }
|
||||
|
||||
created_at: schema.SortableTimestampField
|
||||
@ -52,7 +52,7 @@ exposedModule: schema.#Resource & {
|
||||
|
||||
settings: {
|
||||
rdbms: {
|
||||
table: "federation_exposed_module"
|
||||
table: "federation_module_exposed"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,12 +31,6 @@ moduleMapping: schema.#Resource & {
|
||||
byValue: ["compose_module_id", "compose_namespace_id", "federation_module_id"]
|
||||
}
|
||||
|
||||
rbac: {
|
||||
operations: {
|
||||
"manage": description: "Manage exposed module module"
|
||||
}
|
||||
}
|
||||
|
||||
store: {
|
||||
ident: "federationModuleMapping"
|
||||
|
||||
|
||||
@ -16,9 +16,9 @@ sharedModule: schema.#Resource & {
|
||||
struct: {
|
||||
id: schema.IdField
|
||||
handle: schema.HandleField
|
||||
node_id: { ident: "nodeID", goType: "uint64" }
|
||||
node_id: { ident: "nodeID", goType: "uint64", storeIdent: "rel_node" }
|
||||
name: {}
|
||||
external_federation_module_id: { ident: "externalFederationModuleID", goType: "uint64" }
|
||||
external_federation_module_id: { ident: "externalFederationModuleID", goType: "uint64", storeIdent: "xref_module", }
|
||||
fields: { goType: "types.ModuleFieldSet" }
|
||||
|
||||
created_at: schema.SortableTimestampField
|
||||
@ -31,7 +31,7 @@ sharedModule: schema.#Resource & {
|
||||
|
||||
filter: {
|
||||
struct: {
|
||||
node_id: { goType: "uint64", ident: "nodeID", storeIdent: "ref_node" }
|
||||
node_id: { goType: "uint64", ident: "nodeID", storeIdent: "rel_node" }
|
||||
handle: { goType: "string" }
|
||||
name: { goType: "string" }
|
||||
external_federation_module_id: { goType: "uint64", storeIdent: "xref_module", ident: "externalFederationModuleID" }
|
||||
@ -52,7 +52,7 @@ sharedModule: schema.#Resource & {
|
||||
|
||||
settings: {
|
||||
rdbms: {
|
||||
table: "federation_shared_module"
|
||||
table: "federation_module_shared"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,14 +26,6 @@ role_member: schema.#Resource & {
|
||||
byValue: [ "user_id", "role_id"]
|
||||
}
|
||||
|
||||
rbac: {
|
||||
operations: {
|
||||
read: description: "Read role"
|
||||
update: description: "Update role"
|
||||
delete: description: "Delete role"
|
||||
"members.manage": description: "Manage members"
|
||||
}}
|
||||
|
||||
store: {
|
||||
api: {
|
||||
lookups: []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user