@belyaev
Hi Andrey,
I stumbled upon this topic because I encounter a similar issue.
I checked the example and I’m afraid to say you are cheating good sir! At least for what I’m trying to achieve.
I want to to create a role at global admin level that then tenant admins can assign to users in their tenant.
In the example, the User role is actually created by the walmart_admin role (entity inspector, see screenshot). this means it does not show up in the role browser when the costco_admin logs in because of the tenant_id. This means the role must have been assigned by the global admin user and not a tenant admin.
In this case the user_role relation is created through migration scripts, that explains how the relation were created and the tenant_ids are “cheated in”.
After digging a bit and reading the docs again, i found the reason for not seeing the admin defined role in any of the tenant admin users, from the docs:
Every time a tenant user reads tenant-specific data, the system adds where condition on TENANT_ID
to JPQL query in order to read the data of the current tenant only. Data with no TENANT_ID
or with different TENANT_ID
will be omitted.
Any suggestions on how to create predefined roles and share them with tenant admins? I don’t expect tenant to understand security details regarding the implementation.
predefined roles
Predefined roles are shared with tenants. I had a rather animated discussion regarding predefined role definitions here → Design time roles - wildcards and packages - #14 от пользователя tom.monnier - CUBA.Platform.
In the backend I implemented my solution as shown in that topic for permissions on the entities.But I don’t have metadata information in the back-end about possible screens and menustructure. Thats why I created a dedicated screen just to determine all the screens and menu items based on the entity permissions and assign them to a db stored role. If I would have access to the metadata in the backend, it would have been a predefined role in the first place.
@AlexBudarov replied in that topic regarding possible future enhancements, but that is not implemented today
Hi,
I think that this can be implemented as an optional assistance in the role editing UI. It would simplify setting up role permissions in runtime role editor and in Studio’s role designer.
Sorry for the long post, but it I try to be as precise as possible.