RESTRICT ROWS
Configures the column used for row-level access control (RLAC); you can only define one primary key column.
If the column is already configured, running the RESTRICT ROWS command replaces the definition.
|
Use DESCRIBE TABLE to view the existing restrictions on the table. |
Syntax
RESTRICT ROWS ON [<keyspace_name>.]<table_name> USING <pk_column_name> ;
Syntax legend
| Syntax conventions | Description |
|---|---|
UPPERCASE |
Literal keyword. |
Lowercase |
Not literal. |
|
Variable value. Replace with a user-defined value. |
|
Optional.
Square brackets ( |
|
Group.
Parentheses ( |
|
Or.
A vertical bar ( |
|
Repeatable.
An ellipsis ( |
|
Single quotation ( |
|
Map collection.
Braces ( |
Set, list, map, or tuple.
Angle brackets ( |
|
|
End CQL statement.
A semicolon ( |
|
Separate the command line options from the command arguments with two hyphens ( |
|
Search CQL only: Single quotation marks ( |
|
Search CQL only: Identify the entity and literal value to overwrite the XML element in the schema and solrConfig files. |
Examples
This example uses the cyclist_name so that each cyclist can view only their own expenses.
RLAC requires two commands in order to implement the restrictions
-
a single RESTRICT command on the rows to filter
-
one or more GRANT commands to assign permissions
For the cyclist_expenses table, configure the cyclist_name column for filtering so that permissions can be assigned.
RESTRICT ROWS ON cycling.cyclist_expenses USING cyclist_name;
Grant cyclist Vera Adrian permission to view her own expenses:
GRANT SELECT ON 'Vera ADRIAN' ROWS IN cycling.cyclist_expenses TO cycling_accounts;