Preserve Security Roles within application

Hello!

It occurs to me that once I’ve taken a long time setting up security roles, as soon as the app is cloned or deployed, those roles are lost, as they’re database-driven. Is there any way to preserve these settings (to hide menu options, screens, and attributes for certain roles)? I would think that there’s got to be a way to do this, but I have no idea how to do this.

Thanks in advance!

Hi,

you can export roles in JSON/ZIP format just right in the Roles screen (look up for button in table).
To load this data automatically you can use standard import data service (see docs for details).

Regards,
Ilia.

1 Like

hi,

currently in version 7.1 there is the ability to use the JSON export from the entity inspector. In order to import you can use the admin-addon, which has the auto-import subsystem, which allows you to easily put the JSON in source code and execute it automatically at application start: GitHub - cuba-platform/admin-tools-addon: Interactive runtime diagnosis for CUBA applications

For CUBA 7.2 it seems there might be an enhancement, which will allow you to express security related constrains at compile time in source code additionally: Design-time security · Issue #2172 · cuba-platform/cuba · GitHub

Cheers
Mario

3 Likes

Thank you so much!

Thank you very much for this information and the details provided. It is very much appreciated!