Skip to content

Commit 849fb4e

Browse files
akoclaude
andcommitted
test: rename Owner attribute in security XPath roundtrip test
After the #552 fix wired ValidateEntity into execCreateEntity, TestRoundtripSecurity_EntityAccessWithXPath started failing with MDL020: Owner conflicts with the auto-managed system attribute on persistent entities. The test's intent is XPath-grant roundtrip, not the attribute name — rename to OwnerName and update the XPath accordingly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 73c7dde commit 849fb4e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

mdl/executor/roundtrip_security_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,17 @@ func TestRoundtripSecurity_EntityAccessWithXPath(t *testing.T) {
161161
entityName := securityTestModule + ".SecTestXPath"
162162
env.registerCleanup("entity", entityName)
163163

164-
// Create entity
164+
// Create entity. OwnerName (not Owner) — Owner is reserved on persistent
165+
// entities (CE7247 / MDL020): it is auto-managed by Mendix via AutoOwner.
165166
createMDL := `create persistent entity ` + entityName + ` (
166-
Owner: String(100)
167+
OwnerName: String(100)
167168
);`
168169
if err := env.executeMDL(createMDL); err != nil {
169170
t.Fatalf("Failed to create entity: %v", err)
170171
}
171172

172-
// Grant with XPath constraint
173-
grantMDL := `grant ` + securityTestModule + `.SecTestViewer on ` + entityName + ` (read *) where '[%CurrentUser%] = Owner';`
173+
// Grant with XPath constraint referencing the entity attribute.
174+
grantMDL := `grant ` + securityTestModule + `.SecTestViewer on ` + entityName + ` (read *) where '[%CurrentUser%] = OwnerName';`
174175
if err := env.executeMDL(grantMDL); err != nil {
175176
t.Fatalf("Failed to grant entity access with XPath: %v", err)
176177
}
@@ -184,7 +185,7 @@ func TestRoundtripSecurity_EntityAccessWithXPath(t *testing.T) {
184185
if !strings.Contains(output, "where") {
185186
t.Errorf("Expected where clause in grant statement.\nActual:\n%s", output)
186187
}
187-
if !strings.Contains(output, "[%CurrentUser%] = Owner") {
188+
if !strings.Contains(output, "[%CurrentUser%] = OwnerName") {
188189
t.Errorf("Expected XPath constraint in output.\nActual:\n%s", output)
189190
}
190191

0 commit comments

Comments
 (0)