|
| 1 | +mdl 1; |
| 2 | +-- ============================================================================ |
| 3 | +-- ako/mxcli#1449 (upstream mendixlabs/mxcli#1551) — `drop entity` left the |
| 4 | +-- association's member entry in the access rule of the entity at the OTHER end. |
| 5 | +-- |
| 6 | +-- Dropping an entity removes every association with it at either end, in other |
| 7 | +-- modules too, but reconciled no access rule. `drop association` did reconcile |
| 8 | +-- — only the declaring module, though, so a cross-module OWNER Both |
| 9 | +-- association left its TO entity's entry behind as well. And the reconcile |
| 10 | +-- itself kept any reference to another module's association on faith, so even |
| 11 | +-- `update security` printed "All entity access rules are up to date" over it. |
| 12 | +-- |
| 13 | +-- mxcli exec this-file -p app.mpr ; mx check app.mpr |
| 14 | +-- before: [CE1613] "The selected association 'Access1449Crm.Lead_Order' |
| 15 | +-- no longer exists." at Access rule of entity 'Access1449Shop.Order' |
| 16 | +-- (with the drops run as their own script, one CE1613 per drop) |
| 17 | +-- after: 0 errors; `describe entity Access1449Shop.Order` still grants |
| 18 | +-- read *, write * and names none of the three associations |
| 19 | +-- |
| 20 | +-- Access rules are only checked with security on. |
| 21 | +-- ============================================================================ |
| 22 | + |
| 23 | +alter app security ( SecurityLevel: prototype ); |
| 24 | + |
| 25 | +create module Access1449Shop; |
| 26 | +create module role Access1449Shop.User; |
| 27 | +create module Access1449Crm; |
| 28 | +create module role Access1449Crm.User; |
| 29 | + |
| 30 | +@position(100, 100) |
| 31 | +create persistent entity Access1449Shop.Customer ( Name: string(200) ); |
| 32 | +@position(400, 100) |
| 33 | +create persistent entity Access1449Shop.Order ( Number: string(20) ); |
| 34 | +@position(100, 100) |
| 35 | +create persistent entity Access1449Crm.Contact ( Name: string(200) ); |
| 36 | +@position(400, 100) |
| 37 | +create persistent entity Access1449Crm.Lead ( Name: string(200) ); |
| 38 | + |
| 39 | +-- Same module: the entry is on Order, FROM end. |
| 40 | +create association Access1449Shop.Order_Customer |
| 41 | + from Access1449Shop.Order to Access1449Shop.Customer; |
| 42 | +-- Cross-module: the entry is on Order, in a module that is not the one of the |
| 43 | +-- entity dropped below. |
| 44 | +create association Access1449Shop.Order_Contact |
| 45 | + from Access1449Shop.Order to Access1449Crm.Contact; |
| 46 | +-- Cross-module, OWNER Both: a member of the TO end too, so Order carries an |
| 47 | +-- entry for an association its own module does not declare. |
| 48 | +create association Access1449Crm.Lead_Order |
| 49 | + from Access1449Crm.Lead to Access1449Shop.Order |
| 50 | + owner both; |
| 51 | + |
| 52 | +grant create, delete, read *, write * on entity Access1449Shop.Customer to Access1449Shop.User; |
| 53 | +grant create, delete, read *, write * on entity Access1449Shop.Order to Access1449Shop.User; |
| 54 | +grant create, delete, read *, write * on entity Access1449Crm.Contact to Access1449Crm.User; |
| 55 | +grant create, delete, read *, write * on entity Access1449Crm.Lead to Access1449Crm.User; |
| 56 | + |
| 57 | +-- Each drop removes one association that Access1449Shop.Order's rule names. |
| 58 | +drop entity Access1449Shop.Customer; |
| 59 | +drop entity Access1449Crm.Contact; |
| 60 | +drop entity Access1449Crm.Lead; |
| 61 | + |
| 62 | +describe entity Access1449Shop.Order; |
0 commit comments