In SQL Server, implementing Row-Level Security enables to control access to rows in a database table based on the characteristics of the user executing a query (e.g., group membership or execution context).
In this post, let us see an example for RLS with Session_Context, advantage of this technique is we don't need to create separate users to enforce row level security.
We can implement RLS by creating SECURITY POLICY and predicates created as inline table valued functions.
Let us consider this use case, an Insurance provider company database has all the agency company, its adviser, policy and commission details. Insurance provider has the application dashboard where any agency / individual adviser from an agency company can login (using single sign on) and view their details.
Requirement for Insurance provider is one agency company data should not be exposed to other company and only admins can modify the commission data within their company.
In this post, let us see an example for RLS with Session_Context, advantage of this technique is we don't need to create separate users to enforce row level security.
We can implement RLS by creating SECURITY POLICY and predicates created as inline table valued functions.
Let us consider this use case, an Insurance provider company database has all the agency company, its adviser, policy and commission details. Insurance provider has the application dashboard where any agency / individual adviser from an agency company can login (using single sign on) and view their details.
Requirement for Insurance provider is one agency company data should not be exposed to other company and only admins can modify the commission data within their company.