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
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:
110
server/system/envoy/store_decode.go
Normal file
110
server/system/envoy/store_decode.go
Normal file
@@ -0,0 +1,110 @@
|
||||
package envoy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/cortezaproject/corteza/server/pkg/dal"
|
||||
"github.com/cortezaproject/corteza/server/pkg/envoyx"
|
||||
"github.com/cortezaproject/corteza/server/store"
|
||||
"github.com/cortezaproject/corteza/server/system/types"
|
||||
)
|
||||
|
||||
func (d StoreDecoder) extendDecoder(ctx context.Context, s store.Storer, dl dal.FullService, _ envoyx.DecodeParams, rt string, nodes map[string]*envoyx.Node, f envoyx.ResourceFilter) (out envoyx.NodeSet, err error) {
|
||||
switch rt {
|
||||
case types.SettingValueResourceType:
|
||||
return d.decodeSettingValue(ctx, s, dl, types.SettingsFilter{})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (d StoreDecoder) decodeSettingValue(ctx context.Context, s store.Storer, dl dal.FullService, f types.SettingsFilter) (out envoyx.NodeSet, err error) {
|
||||
// @todo this might need to be improved.
|
||||
// Currently, no resource is vast enough to pose a problem.
|
||||
rr, _, err := store.SearchSettingValues(ctx, s, f)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, r := range rr {
|
||||
var n *envoyx.Node
|
||||
n, err = SettingValueToEnvoyNode(r)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
out = append(out, n)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func SettingValueToEnvoyNode(r *types.SettingValue) (node *envoyx.Node, err error) {
|
||||
// SettingValues don't have references so it can be omitted
|
||||
|
||||
node = &envoyx.Node{
|
||||
Resource: r,
|
||||
ResourceType: types.SettingValueResourceType,
|
||||
Identifiers: envoyx.MakeIdentifiers(
|
||||
r.Name,
|
||||
),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (d StoreDecoder) extendedApigwRouteDecoder(ctx context.Context, s store.Storer, dl dal.FullService, f types.ApigwRouteFilter, base envoyx.NodeSet) (out envoyx.NodeSet, err error) {
|
||||
for _, b := range base {
|
||||
route := b.Resource.(*types.ApigwRoute)
|
||||
|
||||
filters, err := d.decodeApigwFilter(ctx, s, dl, types.ApigwFilterFilter{
|
||||
RouteID: route.ID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out = append(out, filters...)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func decodeAuthClientRefs(c *types.AuthClient) (refs map[string]envoyx.Ref) {
|
||||
refs = make(map[string]envoyx.Ref, 4)
|
||||
|
||||
if c.Security.ImpersonateUser > 0 {
|
||||
refs["Security.ImpersonateUser"] = envoyx.Ref{
|
||||
ResourceType: types.UserResourceType,
|
||||
Identifiers: envoyx.MakeIdentifiers(c.Security.ImpersonateUser),
|
||||
}
|
||||
}
|
||||
|
||||
roleSliceToRefs(refs, "Security.PermittedRoles", c.Security.PermittedRoles)
|
||||
roleSliceToRefs(refs, "Security.ProhibitedRoles", c.Security.ProhibitedRoles)
|
||||
roleSliceToRefs(refs, "Security.ForcedRoles", c.Security.ForcedRoles)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func decodeDalConnectionRefs(c *types.DalConnection) (refs map[string]envoyx.Ref) {
|
||||
if c.Config.Privacy.SensitivityLevelID == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
refs = map[string]envoyx.Ref{
|
||||
"Config.Privacy.SensitivityLevelID": {
|
||||
ResourceType: types.DalSensitivityLevelResourceType,
|
||||
Identifiers: envoyx.MakeIdentifiers(c.Config.Privacy.SensitivityLevelID),
|
||||
},
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func roleSliceToRefs(refs map[string]envoyx.Ref, k string, rr []string) {
|
||||
for i, r := range rr {
|
||||
refs[fmt.Sprintf("%s.%d.RoleID", k, i)] = envoyx.Ref{
|
||||
ResourceType: types.RoleResourceType,
|
||||
Identifiers: envoyx.MakeIdentifiers(r),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user