Skip to content

ATS-CRM-ENT-015Control record locks and system protection

Markdown

ATS-CRM-ENT-015

Control record locks and system protection

Markdown
  • DocumentProposed

KindAcceptance test setProduct areaCRMModuleEntitiesRevision1

Read atservices-crm a8d1364freact-console baf6dae3

Coverage

  • Rule covered
  • Transition covered
  • Validation gap: FND-CRM-ENT-063
  • Permission covered
  • Edge covered
  • Failure gap: FND-CRM-ENT-063
  • Boundary covered
  • Concurrency gap: FND-CRM-ENT-063
  • Invariant covered
  • Interaction covered

Test Scenarios

16 scenarios proving CAP-CRM-ENT-015; 8 bound to an existing test.

01 Lock and unlock need their own administrator keyspermissionbrowsernegativetest
Proves
BR-CAP-CRM-ENT-015-01
Preconditions
No additional setup is required.
Steps
Read the route declarations; call the routes as a standard user.
Expected
Lock and unlock keys per concept at tier admin; 403.
Data
No additional fixtures.
Bound to
Source
services-crm:modules/entities/tests/unit/api/record-lock-api-mapper.spec.js#publishes all six at tier admin, so administrators hold them and ordinary users do not
02 Version, reason and no-opedgeapinegativetest
Proves
BR-CAP-CRM-ENT-015-02 INV-DOM-CRM-ENT-033-05
Preconditions
Prepare a locked role.
Steps
Unlock at a stale version; with a blank reason; an unknown record; lock with the lock it has.
Expected
409; 400 naming reason; 404; nothing changed or recorded.
Data
No additional fixtures.
Bound to
Source
services-crm:modules/entities/tests/integration/services/persistence/record-locks.integration.spec.js#leaves the role at its version and lock, and records nothing
03 Lock changes are audited and listedruleapitest
Proves
BR-CAP-CRM-ENT-015-03
Preconditions
Prepare a role locked and unlocked.
Steps
Read its lock changes in pages.
Expected
The newest first with every property, then the older one, with the version advanced on each change.
Data
No additional fixtures.
Bound to
Source
services-crm:modules/entities/tests/integration/services/persistence/record-locks.queries.integration.spec.js#answers the newest two changes of the record, every property mapped, and where the page ended
04 Ordinary writes cannot set a lockpermissionapinegativetest
Proves
BR-CAP-CRM-ENT-015-04 INV-DOM-CRM-ENT-033-06
Preconditions
Prepare a contact, an organization and a contact role.
Steps
Create, replace and patch with sys_locked set; a role write with a delete lock and with a full lock.
Expected
403 naming sys_locked; delete lock accepted; full lock rejected.
Data
No additional fixtures.
Bound to
Source
services-crm:modules/entities/tests/e2e/contacts.e2e.spec.js#answers 403 naming sys_locked for a replacement that sets a lock (E-14)
05 Full and delete locks refuse what they nameinvariantbrowsernegativetest
Proves
BR-CAP-CRM-ENT-015-05 INV-DOM-CRM-ENT-033-04
Preconditions
Prepare a contact locked against updates and deletes; one against deletes.
Steps
Replace each; delete each.
Expected
409 for the first replacement and both deletes; the second replacement saved.
Data
No additional fixtures.
Bound to
Source
services-crm:modules/entities/tests/e2e/contacts.e2e.spec.js#answers 409 IllegalOperation, not 403, for a replacement of a contact locked against updates, the lock sent back unchanged
06 Element locks and their releasetransitionapinegativetest
Proves
BR-CAP-CRM-ENT-015-06
Preconditions
Prepare a contact and an organization with locked elements.
Steps
Unlock with no element ids; with one id; with an id the record lacks.
Expected
All released and audited; only that one; rejected releasing nothing.
Data
No additional fixtures.
Bound to
Source
services-crm:modules/entities/tests/integration/services/persistence/record-locks.integration.spec.js#refuses an element id the organization does not have, releasing nothing
07 Clearing an element lock by write needs the unlock keypermissionapinegativetest
Proves
BR-CAP-CRM-ENT-015-07
Preconditions
Prepare a contact with a locked element.
Steps
Replace clearing only that lock without and with the unlock key; patch it to null.
Expected
409 then 200; 200.
Data
No additional fixtures.
Bound to
Source
services-crm:modules/entities/tests/e2e/contacts.e2e.spec.js#answers 409 to a replacement that only clears an element lock without the unlock key, and 200 with it (CRM-ACC-0035)
08 Protected system recordsinvariantapinegativetest
Proves
BR-CAP-CRM-ENT-015-08 INV-DOM-CRM-ENT-033-07
Preconditions
Prepare a protected role.
Steps
Unlock it; change its lock; replace it dropping its lock; rename it; delete it.
Expected
Rejected naming the protection; rejected; rejected; renamed with the lock preserved; rejected.
Data
Use a protected_records row.
Bound to
Source
services-crm:modules/entities/tests/integration/services/persistence/record-locks.integration.spec.js#refuses the unlock, naming the protection
09 Check the lock reason at its exact length boundaryboundaryapinegativeproposed
Proves
BR-CAP-CRM-ENT-015-02
Preconditions
Two unlocked records have current versions and an authorized lock operator.
Steps
Lock one with a 1,000-character reason and the other with 1,001 characters.
Expected
The first lock records its reason; the second is refused without a record or audit change.
Data
Run-owned records and configuration in an isolated workspace.
Source
services-crm:modules/entities/tests/integration/services/persistence/record-locks.integration.spec.js#leaves the role at its version and lock, and records nothing
10 A full lock blocks an ordinary correctioninteractionapiproposed
Proves
BR-CAP-CRM-ENT-004-01 BR-CAP-CRM-ENT-015-05
Preconditions
An editor has read a record and an administrator can change its lock.
Steps
Apply a full lock; attempt the pending ordinary correction; unlock and reread before saving again.
Expected
The locked attempt preserves the record; a newly based correction succeeds after release.
Data
Run-owned records and configuration in an isolated workspace.
Source
services-crm:modules/entities/tests/e2e/contacts.e2e.spec.js#answers 400 naming sys_version to a patch that tests no version; services-crm:modules/entities/tests/e2e/contacts.e2e.spec.js#answers 409 IllegalOperation, not 403, for a replacement of a contact locked against updates, the lock sent back unchanged
11 Unlock the blocking element before deletioninteractionapiproposed
Proves
BR-CAP-CRM-ENT-014-04 BR-CAP-CRM-ENT-015-06
Preconditions
A person has an element carrying a deletion lock and an administrator has delete and unlock authority.
Steps
Try deleting; release the specific element lock at the current version; retry deletion.
Expected
The first attempt retains the person; the audited release allows deletion if no other dependency blocks it.
Data
Run-owned records and configuration in an isolated workspace.
Source
services-crm:modules/entities/tests/integration/services/persistence/contacts.integration.spec.js#refuses the delete as IllegalOperation, naming the element that is locked; services-crm:modules/entities/tests/integration/services/persistence/record-locks.integration.spec.js#refuses an element id the organization does not have, releasing nothing
12 Lock changes appear in audit and aggregate historyinteractionapiproposed
Proves
BR-CAP-CRM-ENT-015-03 BR-CAP-CRM-ENT-016-01
Preconditions
A live person has no lock and both histories are readable.
Steps
Apply a delete lock with a reason and read lock audit and record history.
Expected
Both reads identify the lock change without creating multiple aggregate revisions.
Data
Run-owned records and configuration in an isolated workspace.
Source
services-crm:modules/entities/tests/integration/services/persistence/record-locks.queries.integration.spec.js#answers the newest two changes of the record, every property mapped, and where the page ended; services-crm:modules/entities/tests/integration/services/persistence/contacts.history.integration.spec.js#writes exactly one revision, whatever the save touched
13 Legacy role writes differ from dedicated lock actionsinteractionapiproposed
Proves
BR-CAP-CRM-ENT-015-04 BR-CAP-CRM-ENT-017-04
Preconditions
A role is available for ordinary editing and dedicated lock administration.
Steps
Set a delete lock through the ordinary role write; compare its audit with a later dedicated lock action.
Expected
The ordinary role write retains the documented delete-lock exception; the dedicated action records its own reason and audit.
Data
Run-owned records and configuration in an isolated workspace.
Source
services-crm:modules/entities/tests/e2e/contacts.e2e.spec.js#answers 403 naming sys_locked for a replacement that sets a lock (E-14); react-console:acceptance/crm/playwright/journeys/affiliations/CRM-ACC-0196.spec.ts#CRM-ACC-0196
14 A locked classification blocks its ordinary mutationinteractionapiproposed
Proves
BR-CAP-CRM-ENT-015-09 BR-CAP-CRM-ENT-018-07
Preconditions
A classification is already locked against updates.
Steps
Attempt a classification correction and deletion through its ordinary routes.
Expected
Both operations are refused and the classification remains; this catalogue has no dedicated release action.
Data
Run-owned records and configuration in an isolated workspace.
Source
services-crm:docs/record-locks.md#Not covered yet; services-crm:modules/entities/tests/e2e/contact-types.e2e.spec.js#then, when the version is off, refuses the change (409)
15 Exercise each dedicated customer-lock changetransitionapiproposed
Proves
BR-CAP-CRM-ENT-015-02 BR-CAP-CRM-ENT-015-03 BR-CAP-CRM-ENT-015-05
Preconditions
Run-owned unlocked contact and organization records are available to a lock operator.
Steps
For each record, apply delete lock, strengthen to full lock, weaken to delete lock and release it. On another record, apply full lock directly and release it. Read the current version before each action and inspect both audits.
Expected
Every changed lock advances its owner version and contributes a reasoned audit; reads reflect each requested lock state.
Data
Run-owned records and configuration in an isolated workspace.
Source
services-crm:modules/entities/tests/integration/services/persistence/record-locks.queries.integration.spec.js#answers the newest two changes of the record, every property mapped, and where the page ended; services-crm:modules/entities/tests/e2e/contacts.e2e.spec.js#answers 403 naming sys_locked for a replacement that sets a lock (E-14); services-crm:modules/entities/services/persistence/record-locks.ts:changeRecordLock; services-crm:modules/entities/tests/integration/services/persistence/record-locks.integration.spec.js#refuses an element id the organization does not have, releasing nothing; services-crm:modules/entities/services/persistence/record-locks.ts:changeRecordLock; services-crm:modules/entities/services/persistence/record-locks.ts:changeRecordLock
16 Exercise every declared authority independentlypermissionapinegativeproposed
Proves
BR-CAP-CRM-ENT-015-01 BR-CAP-CRM-ENT-015-04 BR-CAP-CRM-ENT-015-07
Preconditions
An eligible record and configuration fixture exist for each operation; the caller can reach only the run’s workspace.
Steps
For each declared permission, execute its matching operation with that permission, then without it while retaining the other required grants. Read affected records after every refused mutation.
Expected
The authorized case reaches the operation; the missing-grant case is refused and preserves saved data. Record access alone does not authorize the other declared actions.
Data
Run-owned records and configuration in an isolated workspace.
Source
services-crm:aws/crm.service.ts:ApplicationPermissions; services-crm:modules/entities/aws/api/entities.routes.ts

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.