tg icon indicating copy to clipboard operation
tg copied to clipboard

Entity Master: simple audit info (who and when)

Open 01es opened this issue 2 years ago • 0 comments

Description

Every persistent entity, extending AbstractPersistentEntity, includes information about who/when created it and who/when changed it last. This information needs to be made available to users with the relevant privileges. The following is proposed:

  • [ ] 1. Create action-entity EntityAuditInfoAction (aka functional entity) with property entity: AbstractPersistenEntity as @Require. The value of this property should represent an entity instance for which the audit info needs to be obtained. Entity EntityAuditInfoAction should be registered as one of the standard platform domain entity types in PlatformDomainTypes.

  • [ ] 2. Security token EntityAuditInfoAction_CanExecute_Token needs to be registered as one of the standard platform security tokens in SecurityTokenProvider.

  • [ ] 3. Provide a master for EntityAuditInfoAction that would display the key and desc (if present) of EntityAuditInfoAction.entity in the master title and the entity properties id, version, createdBy, createdDate, lastUpdatedBy, lastUpdatedDate in the body of the master with 2x3 layout. The standard button CANCEL should read CLOSE and there is no need for button SAVE.

  • [ ] 4. A producer is required to process the action context and populate EntityAuditInfoAction.entity with the value of master entity. Event is the master entity is null or not persisted, try assigning it – the relevant validation should take place in EntityAuditInfoAction. If EntityAuditInfoAction becomes invalid, propagate the validation result back to the client by throwing a corresponding Result instance. There could an edge-case, where master entity is not an instance of AbstractPersistentEntity. In that case simply throw failure with message "No audit information is available.".

  • [ ] 5. Unlike other standard platform-level masters and centres that get registered at the level of concrete applications, EntityAuditInfoAction master needs to be registered at the platform level.

  • [ ] 6. Enhance the Entity Master dialog to include an action to invoke the master for EntityAudtInfoAction (icons:info-outline) as illustrated in the image below (label 1). The action's configuration should include a master entity in its context to be processed in the producer. This action should be displayed only for masters, which correspond to entities extending AbstractPersistentEntity.

    image

Once the full data auditing functionality is supported, the same mechanism can be used to invoke a review of the full entity change history.

Expected outcome

Ability to quickly view who and when initially created and was the last user to change a persistent entity instance.

01es avatar Feb 22 '23 07:02 01es