Extending sec entities in JMIX project

Hello,
Is it possible to extend sec entities eg. sec_group, sec_role in Jmix project. We can see, sec_user entity is already extended on project creation. Want to know if there’s option for extending other entities also.
If yes, how?

Thanks and Regards

You can extend and replace any JPA entity provided by an add-on:

  • When creating a new entity, say ExtFoo, select Foo in the “Parent” field
  • In the entity designer of the new entity, select “Replace parent” checkbox
  • You will have the new entity code like this:
    @JmixEntity
    @Entity
    @ReplaceEntity(Foo.class)
    public class ExtFoo extends Foo {
    
    

You can also extend and replace any screen from an add-on: use “Override an existing screen” for this.

But regarding role entities, it’s complicated. The roles you see in the UI are actually DTO entities (ResourceRoleModel, RowLevelRoleModel), because they correspond to both annotated role classes and database roles. So I would recommend using security roles as is and introduce additional features in your own entities, maybe referencing roles by their codes. You can get the role model class by code using ResourceRoleRepository and RowLevelRoleRepository beans.

Regards,
Konstantin