Hi,
In my tenant.yaml
I’d like to create a role admin
and a rule addRoleToUser
that assigns the admin role to the user after signup.
I have the following setting for the first part:
roles:
- name: admin
description: Admin
permissions:
- permission_name: 'read:admin-dashboard'
resource_server_identifier: website
and the following for the rule:
- name: Set user roles after signup
script: ./rules/addAdminRoleToNewUser.js
stage: login_success
enabled: true
order: 2
The rule uses the management API to assign the role to the user (management.users.assignRoles(...)
), but to do so I need the id of the role.
How can I pass the role id to the rule so that it can be used by the script? I’m aware that there is a rulesConfigs
prop to set config values that can be used in the rule. Would this be the recommended way? How would I set the value here to the id of the admin role that was created above?
rulesConfigs:
- key: "ADMIN_ROLE_ID"
value: ???