snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s

This commit is contained in:
upstream-mirror
2026-09-18 01:22:23 +05:00
commit 7e385fc126
8391 changed files with 1766236 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
package codegen
import (
"github.com/cortezaproject/corteza/server/codegen/schema"
"github.com/cortezaproject/corteza/server/app"
)
[...schema.#codegen] &
[
for cmp in app.corteza.components {
template: "gocode/rbac/$component_access_control.go.tpl"
output: "\(cmp.ident)/service/access_control.gen.go"
payload: {
package: "service"
imports: [
"\"github.com/cortezaproject/corteza/server/\(cmp.ident)/types\"",
]
// All known RBAC resources
resources: [
for res in cmp.resources if res.rbac != _|_ {
resFunc: "types.\(res.expIdent)RbacResource"
references: [ for p in res.parents {p}, {param: "id", refField: "ID"}]
},
{
resFunc: "types.ComponentRbacResource"
component: true
},
]
// All possible RBAC operations on component and resources
// flattened
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"
goType: "types.\(res.expIdent)"
description: op.description
checkFuncName: op.checkFuncName
references: [ for p in res.parents {p}, {param: "id", refField: "ID"}]
},
for op in cmp.rbac.operations {
"op": op.handle
const: "types.ComponentResourceType"
resFunc: "types.ComponentRbacResource"
goType: "types.Component"
description: op.description
checkFuncName: op.checkFuncName
component: true
},
]
// Operation/resource validators, grouped by resource
loaders: [
for res in cmp.resources if res.rbac != _|_ {
const: "types.\(res.expIdent)ResourceType"
resFunc: "types.\(res.expIdent)RbacResource"
funcName: "load\(res.expIdent)"
refIndex: [ { 0 }, for i, p in res.parents {i + 1} ]
},
]
// Operation/resource validators, grouped by resource
validation: [
for res in cmp.resources if res.rbac != _|_ {
label: res.ident
const: "types.\(res.expIdent)ResourceType"
funcName: "rbac\(res.expIdent)ResourceValidator"
references: [ for p in res.parents {p.refField}, "ID"]
operations: [ for op in res.rbac.operations {op.handle}]
},
{
label: "\(cmp.ident) component"
const: "types.ComponentResourceType"
funcName: "rbacComponentResourceValidator"
operations: [ for op in cmp.rbac.operations {op.handle}]
},
]
}
},
]