1. Manage Tenant Groups¶
A tenant group combines the tenant definitions for one business meaning, e.g. the BDomain, which may be stored in differently named columns (see Row Level Security).
1.1. Add a Tenant Group¶
Use API_SCURTY.ADD_TENANT_GROUP to add a tenant group. p_all_tnt_code defines the code that grants access to all tenants of the group (default ‘ALL’). It allows a user to be granted access to all tenants, i.e. without row restriction, instead of granting every single tenant code.
Example: Add the Tenant Group ‘TEST_TENANT’
1EXECUTE SCRIPT API_SCURTY.ADD_TENANT_GROUP(
2 'TEST_TENANT' -- p_tnt_group
3 ,'Tenant-Test' -- p_tnt_group_desc
4 ,null -- p_all_tnt_code (default 'ALL')
5);
The new tenant group is stored in SCURTY.REP_TENANT_GROUPS:
TNT_GROUP |
TNT_GROUP_DESC |
ALL_TNT_CODE |
|---|---|---|
TEST_TENANT |
Tenant-Test |
ALL |
1.2. Change a Tenant Group¶
Change a tenant group with API_SCURTY.CHANGE_TENANT_GROUP. NULL leaves a parameter unchanged, while a blank (’ ‘) restores its default value.
In the following example the description and the all-tenant code are changed. This is necessary if ‘ALL’ is a real tenant code of the group: afterwards ‘ALL’ is interpreted as a normal tenant code, while ‘ALL-TNT’ grants access to all tenants.
Example: Change the All-Tenant Code
1EXECUTE SCRIPT API_SCURTY.CHANGE_TENANT_GROUP(
2 'TEST_TENANT' -- p_tnt_group
3 ,'Test Tenant-Change' -- p_tnt_group_desc
4 ,'ALL-TNT' -- p_all_tnt_code
5);
The entry in SCURTY.REP_TENANT_GROUPS has changed:
TNT_GROUP |
TNT_GROUP_DESC |
ALL_TNT_CODE |
|---|---|---|
TEST_TENANT |
Test Tenant-Change |
ALL-TNT |
1.3. Remove a Tenant Group¶
To remove a tenant group, use API_SCURTY.REMOVE_TENANT_GROUP.
Warning
Removing a tenant group also deletes, without further confirmation, all its tenant rules and all tenant access rights of the users for this group.
Example: Remove the Tenant Group ‘TEST_TENANT’
1EXECUTE SCRIPT API_SCURTY.REMOVE_TENANT_GROUP(
2 'TEST_TENANT' -- p_tnt_group
3);
The tenant group is removed from SCURTY.REP_TENANT_GROUPS.