DRAG DROP
You have a table that contains a column named Department. Each user is assigned to a database role name that matches the Department column value. Users authenticate to the database with accounts that are assigned to their department’s database role. You belong to the db_owner role and have rights to run the EXECUTE AS USER statement.
Users must only view records that match their department.
You need to implement Microsoft SQL Server row-level security (RLS) and test the implementation.
Which three actions should you perform in sequence? To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.
Answer:
Explanation:
Step 1: Create a filter predicate by using a SQL Server inline table-valued user-defined function. Create a new schema, and an inline table-valued function.
Step 2: Create a security policy Create a security policy adding the function as a filter predicate. The CREATE SECURITY POLICY command creates a security policy for row level security.
Step 3: Run EXECUTE AS USER
References: https://docs.microsoft.com/en-us/sql/t-sql/statements/create-security-policy-transact-sql?view=sqlserver-2017
https://docs.microsoft.com/en-us/sql/relational-databases/security/row-level-security
Leave a Reply