Using the script API_SCURTY.ADD_TENANT_GROUP to add a tenant group only one variable is needed. The mandatory variable is the name the tenant group should get. Furthermore, there are two optional parameters that can be set, namely a description of the tenant group which should be added, as well as a tenant code. This code is set to 'ALL' per default, meaning a user, who got this code assigned as well, gains an unfiltered view of all rows belonging to this tenant group. This means that by changing this variable, one can limit which rows of a tenant can be seen by which user. As a 'null' is provided in the example below, the tenant code will default to 'ALL'.
EXECUTE SCRIPT API_SCURTY.ADD_TENANT_GROUP (
'TEST_Tenant' -- p_tnt_group
,'Tenant-Test' -- p_tnt_group_desc
,null -- p_all_tnt_code
);
The newly added tenant group can be found in the table SCURTY.REP_TENANT_GROUPS.
TNT_GROUP | TNT_GROUP_DESC | ALL_TNT_CODE |
---|---|---|
TEST_TENANT | Tenant-Test | ALL |
To be able to change parameters of a tenant group one only has to provide the exact name of the tenant group that should be modified to the script API_SCURTY.CHANGE_TENANT_GROUP. By providing a 'null' for the other parameters, the already saved values will be kept. However, by providing anything else than a 'null' value, the old value will be overwritten.
In this example the description and the tenant code will be changed.
EXECUTE SCRIPT API_SCURTY.CHANGE_TENANT_GROUP (
'TEST_TENANT' -- p_tnt_group
,'Test Tenant-Change' -- p_tnt_group_desc
,'TEST' -- p_all_tnt_code
);
The modifications can be seen in the table SCURTY.REP_TENANT_GROUPS.
TNT_GROUP | TNT_GROUP_DESC | ALL_TNT_CODE |
---|---|---|
TEST_TENANT | Test Tenant-Change | TEST |
To remove a tenant group, one only has to provide the name of the tenant group to the script API_SCURTY.REMOVE_TENANT_GROUP.
EXECUTE SCRIPT API_SCURTY.REMOVE_TENANT_GROUP (
'TEST_TENANT' -- p_tnt_group
);
After successfully running the command above, there should no longer be an entry with the TNT_GROUP variable set to 'TEST_TENANT' in the table SCURTY.REP_TENANT_GROUPS.