How to use role in entity

In my cuba application i manage subscribers by role and groups. for that i have separate entity of subscribers which has association with sec$role and sec$group.
How can i do this in jmix.


You can store the role code in entities, and use ResourceRoleRepository or RowLevelRoleRepository to get the role when needed, for example:

private ResourceRoleRepository resourceRoleRepository;

public ResourceRole getRole(String code) {
    return resourceRoleRepository.getRoleByCode(code);