Hi,
I am currently trying to change the name patterns for some built-in sec and sys entities on my applications, in order to make the audit log more readable for an auditor user.
We are having trouble with two of them, Config (sys$Config) and UserRole (sec$UserRole). We had to ideas about this issue.
The first and clearly less optimal idea was to programmatically change the instance names case by case on our custom audit log screen. This is a naive approach, however for the case of UserRole this does not work since the name pattern we wish to provide is - and if the role is removed we only get a null reference to the removed entity.
The second idea was to create entities that inherit from the original ones in order to manipulate ourselves the name pattern for these. However neither Config nor UserRole are given as options to be extended, therefore we could not implement this.
Is there any other way of changing UserRole and Config name patterns?
Thanks beforehand!
T.
Hi,
Yes, you can specify another value for metadata annotation in the metadata.xml file.
See here: A.metadata.xml - CUBA Platform. Developer’s Manual
1 Like
Thank you so much, we will be trying this!
I read the documentation and tried to solve the problem. However the changes I made on metadata.xml do not seem to be working. I understand there are no syntax errors in this code:
<annotations>
<entity class="com.haulmont.cuba.security.entity.UserRole">
<annotation name="com.haulmont.chile.core.annotations.NamePattern">
<attribute name="namePattern" value="%s - %s|user,role"/>
</annotation>
</entity>
</annotations>
What could the problem be?
Thanks again!
<attribute name=“namePattern”
The attribute name is wrong here. You need to specify the name of the annotation’s attribute.
1 Like
It worked now! Thanks!