5. Manage User Access to an Object Group¶
Make sure that the user and the object group exist:
5.1. Grant Access to an Object Group¶
Grant a user access to an object group with API_SCURTY.GRANT_USER_OG_ACCESS. Access can only be granted to human users (HU) and generic users (GU).
- p_rw_access
If true, write access is granted. This only has an effect if the object group allows write access.
- p_scol_access
If true, the user can see all security columns of the object group.
In the following example the user ‘testuser’ gets read access to the object group ‘TEST_OG’ without access to security columns.
Example: Grant Read Access to ‘TEST_OG’
1EXECUTE SCRIPT API_SCURTY.GRANT_USER_OG_ACCESS(
2 'TEST_OG' -- p_object_group
3 ,'testuser' -- p_user_name
4 ,null -- p_rw_access
5 ,null -- p_scol_access
6);
The access right is stored in SCURTY.REP_USER_OG_ACCESS:
OBJECT_GROUP |
USER_NAME |
RW_ACCESS |
SCOL_ACCESS |
|---|---|---|---|
TEST_OG |
TESTUSER |
false |
false |
The access is applied to the database by the next security refresh (see When Do Changes Take Effect?).
5.2. Revoke Access to an Object Group¶
To revoke the access of a user to an object group, use API_SCURTY.REVOKE_USER_OG_ACCESS.
Example: Revoke the Access to ‘TEST_OG’
1EXECUTE SCRIPT API_SCURTY.REVOKE_USER_OG_ACCESS(
2 'TEST_OG' -- p_object_group
3 ,'testuser' -- p_user_name
4);
The entry is removed from SCURTY.REP_USER_OG_ACCESS.