Evgeny Shvarov · Feb 25, 2017

How to deploy resources and roles?

Hi, Community!

Consider I have ResourceA which is used by role RoleA in dev environment and want to deploy it with the solution on a target system.

Would you please share the best practices to make it?

Thank you in advance!

0 446
Discussion (8)0
Log in or sign up to continue

There are many predefined methods defined by Cache under Security.* package to maintain/manage Roles/Users/Resources ...ect.

Specific to your query, you can use below command to export/import Roles:

Write ##class(Security.Roles).Export("C:\RolesExport.xml")
Write ##class(Security.Roles).Import("C:\RolesExport.xml")

Please refer to below class doc for more:$c2JR50xdHrcUuUzSzc&CSPSHARE=1


In case it's not obvious to people, the Security package is only available in the %SYS namespace.

True John, agree with you. Its only available from %SYS.

Thank you, Bachhar for the thorough and full answer!

What if I want to export Resources only and then manage it on a target system manually?

It's not obvious how to export Resources only.

Write ##class(Security.Resources).Export("C:\Resources.xml")
Write ##class(Security.Resources).Import("C:\Resources.xml")

Note that apart from Export and Import options -

If you are using a %Installer Manifest for your deployment (for any environment - test or prod) - you can include in that manifest also the creation of Security elements such as Resources and Roles, etc.

For example:



    Description="Database user"
    RolesGranted= />

See more information here (in the docs).

[Defining a Role as part of a manifest is also included in an example in [@Eduard Lebedyuk]'s post here]