3
0

Add namespaceID to loaded module-field resource for eval permissions

This commit is contained in:
Mumbi Francis
2024-09-09 16:44:03 +03:00
committed by Jože Fortun
parent 0c08742a40
commit 55fadaa535
2 changed files with 6 additions and 3 deletions

View File

@@ -1064,11 +1064,14 @@ func loadModuleField(ctx context.Context, s store.Storer, namespaceID, moduleID,
err = ModuleErrNotFound()
}
if err == nil && (namespaceID != res.NamespaceID || moduleID != res.ModuleID) {
// Make sure chart belongs to the right namespace
if err == nil && (moduleID != res.ModuleID) {
// Make sure module-field belongs to the right module
return nil, ModuleErrNotFound()
}
// add namespace ID on the module-field
res.NamespaceID = namespaceID
return
}

View File

@@ -19,7 +19,7 @@ type (
// Modules - CRM module definitions
ModuleField struct {
ID uint64 `json:"fieldID,string"`
NamespaceID uint64 `json:"namspaceID,string"`
NamespaceID uint64 `json:"namespaceID,string"`
ModuleID uint64 `json:"moduleID,string"`
Place int `json:"-"`