2. Manage Objects in an Object Group

Objects are assigned to an object group by search rules (discover rules). Make sure that the object group exists: Add an Object Group.

2.1. Add Objects to an Object Group

Use API_SCURTY.ADD_OG_OBJ_DISCOVER_RULE to add a discover rule. It defines regular expressions to include and exclude schemas, objects, and object comments. Include patterns default to ‘.*’, exclude patterns are optional. Within a rule, an object must match all include patterns and none of the exclude patterns; an object group may have several rules.

Example: Add All Objects Containing ‘_TAB’ of the Schemas PSV_TEST_TA and PSV_TEST_DR

 1EXECUTE SCRIPT API_SCURTY.ADD_OG_OBJ_DISCOVER_RULE(
 2    'TEST_OG'             -- p_object_group
 3   ,'PSV_TEST_(TA|DR)'    -- p_schema_incl_pattern
 4   ,null                  -- p_schema_excl_pattern
 5   ,'.*_TAB.*'            -- p_object_incl_pattern
 6   ,null                  -- p_object_excl_pattern
 7   ,'.*'                  -- p_comment_incl_pattern
 8   ,null                  -- p_comment_excl_pattern
 9   ,'test-tabs'           -- p_rule_comment
10);

The rule is stored in SCURTY.REP_OG_OBJ_DISCOVER_RULES:

RULE_ID

OBJECT_GROUP

SCHEMA_INCL_PATTERN

SCHEMA_EXCL_PATTERN

OBJECT_INCL_PATTERN

OBJECT_EXCL_PATTERN

COMMENT_INCL_PATTERN

COMMENT_EXCL_PATTERN

RULE_COMMENT

66

TEST_OG

PSV_TEST_(TA|DR)

(null)

._TAB.

(null)

.*

(null)

test-tabs

After the next security refresh (see When Do Changes Take Effect?), the matching objects are listed in SCURTY.REP_OG_OBJECTS:

OBJECT_GROUP

OBJECT_SCHEMA

OBJECT_NAME

OBJECT_TYPE

LVL

TEST_OG

PSV_TEST_DR

TEST_TAB

VIEW

0

TEST_OG

PSV_TEST_TA

TEST_TAB

VIEW

0

2.2. Change a Discover Rule

Change a discover rule with API_SCURTY.CHANGE_OG_OBJ_DISCOVER_RULE. NULL leaves a parameter unchanged, while a blank (’ ‘) restores its default value (’.*’ for include patterns, no pattern for exclude patterns).

In the following example a schema exclude pattern is added and the rule comment is changed; all other values stay the same.

Example: Exclude the Schema PSV_TEST_TA

 1EXECUTE SCRIPT API_SCURTY.CHANGE_OG_OBJ_DISCOVER_RULE(
 2    66               -- p_rule_id
 3   ,null             -- p_schema_incl_pattern
 4   ,'PSV_TEST_TA'    -- p_schema_excl_pattern
 5   ,null             -- p_object_incl_pattern
 6   ,null             -- p_object_excl_pattern
 7   ,null             -- p_comment_incl_pattern
 8   ,null             -- p_comment_excl_pattern
 9   ,'change-test'    -- p_rule_comment
10);

The rule in SCURTY.REP_OG_OBJ_DISCOVER_RULES has changed:

RULE_ID

OBJECT_GROUP

SCHEMA_INCL_PATTERN

SCHEMA_EXCL_PATTERN

OBJECT_INCL_PATTERN

OBJECT_EXCL_PATTERN

COMMENT_INCL_PATTERN

COMMENT_EXCL_PATTERN

RULE_COMMENT

66

TEST_OG

PSV_TEST_(TA|DR)

PSV_TEST_TA

._TAB.

(null)

.*

(null)

change-test

After the next refresh, SCURTY.REP_OG_OBJECTS only contains the object of the schema PSV_TEST_DR:

OBJECT_GROUP

OBJECT_SCHEMA

OBJECT_NAME

OBJECT_TYPE

LVL

TEST_OG

PSV_TEST_DR

TEST_TAB

VIEW

0

2.3. Remove a Discover Rule

When a discover rule is removed with API_SCURTY.REMOVE_OG_OBJ_DISCOVER_RULE, all objects found by this rule are removed from the object group (with the next refresh).

Example: Remove the Rule 66

1EXECUTE SCRIPT API_SCURTY.REMOVE_OG_OBJ_DISCOVER_RULE(
2    66    -- p_rule_id
3);

The rule is removed from SCURTY.REP_OG_OBJ_DISCOVER_RULES, and after the next refresh its objects are no longer listed in SCURTY.REP_OG_OBJECTS.