on 2023 Feb 03 4:12 PM
There's a requirement on my project to be able to save logs for any read access done in backoffice of an employee. Anytime they access a record, it needs to be audited.
For example, employee "bob" enters backoffice and reads from the Product table, product with code "ABCD". Is there a way to be able to log that event? "bobs reads product ABCD"
I tried using a LoadInterceptor on Item type, but that causes a bunch of issues and infinite loops when trying to log the current user who's accessing the item.
Request clarification before answering.
Hi Fox,
load interceptor is not the feasible way to meet your scenario, because load interceptor can be triggered whenever data is loaded from DB, it means audit will happen not just from Backoffice
A feasible way is to use audit logging api in the editor area widget, it means introducing a subclass for DefaultEditorAreaControllerModelOperationsDelegate, overwrite the retrieveAndSetCurrentContext(final Object inputData) method which will be invoked whenever data is loaded in editor area widget:
...
public class CustomizedEditorAreaControllerModelOperationsDelegate extends DefaultEditorAreaControllerModelOperationsDelegate
{
...
public String retrieveAndSetCurrentContext(final Object inputData)
{
AuditableActions.audit(AuditableActions.withName("Access Data")
.withAttribute("data type", inputData.getClass()).withAttribute("by user", getCockpitUserService().getCurrentUser());
super.retrieveAndSetCurrentContext(inputData);
}
...
}
<alias name="customizedEditorAreaModelOperationsDelegate" alias="editorAreaModelOperationsDelegate"/>
<bean id="customizedEditorAreaModelOperationsDelegate"
class="...CustomizedEditorAreaControllerModelOperationsDelegate"
scope="prototype">
<constructor-arg>
<null/>
</constructor-arg>
</bean>
As of audit logging API, you can refer to https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/aa417173fe4a4ba5a473c93eb730a417/65ce70aea...
Hopefully it can help you a little.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.