Row Level Security¶
Row level security is implemented through the configuration of filter queries, that are applied at backend. This provides a very flexible way to restrict rows - you can restrict rows for any table in SAS, be that a dataset or a database.
See also: Column Level Security
The columns in MPE_ROW_LEVEL_SECURITY should be configured as follows:
Determines whether the rule applies to the VIEW page, the EDIT page, or ALL pages.
The SAS Group to which the rule applies. The user could also be a member of a DC group. If a user is in none of these groups, no rules apply. If the user is in multiple groups, then the rules for each are applied with an OR condition.
The library of the target table against which the rule will be applied
The target table against which the rule will be applied
When creating multiple subgroups (identified by SUBGROUP_ID) this determines whether those groups are joined using an AND, or an OR condition. This value should be the same for the entire query (unique per RLS_SCOPE/RLS_GROUP/RLS_LIBREF/RLS_TABLE combination).
This determines how individual clauses are joined at subgroup level (identified by SUBGROUP_ID). Valid values: AND, OR.
This variable is an integer, and used to divide a complex filter into numerous subgroups.
This is the name of the variable against which a filter value will be applied
The available operator will depend on whether the column is character or numeric. Example values:
This is the value used to the right of the operator. It is important to enter the values in the correct format, else validation failures will ensue (the backend will reject incorrect syntax to avoid the risk of SAS code injection).
The format depends on the operator, and the variable type.
- All character values MUST be enclosed in single quotes (eg 'example')
- IN and NOT IN must be wrapped in brackets
- BETWEEN must contain an AND
If there are invalid values, an error message will be shown, identifying which value was invalid. If you would like to inspect the validation routine, take a look at mp_filtercheck.sas.
If you would like this rule to be applied, be sure this value is set to 1.
Example values as follows:
|EDIT||Group 1||MYLIB||MYDS||AND||AND||1||VAR_1||=||Some text value||1|
If a user is in Group 2, and querying an EDIT table, the query will look like this:
select * from mylib.myds where ( var_4 CONTAINS ';%badmacro()' )
If the user is in both Group 1 AND Group 2, querying a VIEW-only table, the filter will be as follows:
select * from mylib.myds where (var_2 IN ('this','or','that') AND var_3 < 42 ) OR ( var_4 CONTAINS ';%badmacro()' )