3. Manage Tenant Access

Make sure that the object group, the tenant group with its tenant rules, and the user exist, and that the user has access to the object group:

Important

Tenant access can only be granted to users of the types HU and GU.

3.1. Grant Tenant Access to a User

Use API_SCURTY.GRANT_USER_TNT_ACCESS.

With tenant access, the user only sees the rows of the object group that belong to the granted tenant codes, e.g. specific BDomains (see Row Level Security).

p_tnt_code

One or more tenant codes as SQL array, e.g. ARRAY('TESTING', 'PROD'). The all-tenant code of the group (default ‘ALL’) grants access to all tenants. Granting the all-tenant code replaces the specific codes of the user, and granting a specific code replaces the all-tenant code.

p_scol_access

Decides whether the user sees the security columns of the rows of these tenants. A user may therefore see security columns for one BDomain but not for others.

Example: Grant Access to the Tenant ‘TESTING’

1EXECUTE SCRIPT API_SCURTY.GRANT_USER_TNT_ACCESS(
2    'TEST_OG'           -- p_object_group
3   ,'TESTUSER'          -- p_user_name
4   ,'TEST_TENANT'       -- p_tnt_group
5   ,ARRAY('TESTING')    -- p_tnt_code
6   ,false               -- p_scol_access
7);

The access right is stored in SCURTY.REP_USER_TNT_ACCESS:

OBJECT_GROUP

USER_NAME

TNT_GROUP

TNT_CODE

SCOL_ACCESS

TEST_OG

TESTUSER

TEST_TENANT

TESTING

false

The access is applied to the database by the next security refresh.

3.2. Revoke Tenant Access from a User

To revoke tenant access from a user, execute API_SCURTY.REVOKE_USER_TNT_ACCESS.

Example: Revoke the Access to the Tenant ‘TESTING’

1EXECUTE SCRIPT API_SCURTY.REVOKE_USER_TNT_ACCESS(
2    'TEST_OG'           -- p_object_group
3   ,'TESTUSER'          -- p_user_name
4   ,'TEST_TENANT'       -- p_tnt_group
5   ,ARRAY('TESTING')    -- p_tnt_code
6);

The entry is removed from SCURTY.REP_USER_TNT_ACCESS.