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 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
RLAC requires two commands to implement the restrictions:
-
One
RESTRICTcommand on the rows to filter -
One or more
GRANTcommands to assign permissions
The following example uses a cyclist_name column to permit each cyclist to view only their own expenses.
-
For the
cyclist_expensestable, configure thecyclist_namecolumn for filtering so that permissions can be assigned:RESTRICT ROWS ON cycling.cyclist_expenses USING cyclist_name; -
Grant a cyclist, Vera Adrian, permission to view her own expenses:
GRANT SELECT ON 'Vera ADRIAN' ROWS IN cycling.cyclist_expenses TO cycling_accounts;