Pages

OracleEBSpro is purely for knowledge sharing and learning purpose, with the main focus on Oracle E-Business Suite Product and other related Oracle Technologies.

I'm NOT responsible for any damages in whatever form caused by the usage of the content of this blog.

I share my Oracle knowledge through this blog. All my posts in this blog are based on my experience, reading oracle websites, books, forums and other blogs. I invite people to read and suggest ways to improve this blog.


Wednesday, March 13, 2013

Purpose of MO_GLOBAL.ORG_SECURITY and MO_GLOBAL.SET_POLICY_CONTEXT


The purpose of Row-Level-Security is to hide certain data[based on some conditions]. RLS does so by appending a where clause to the secured object.

1. MO_GLOBAL.ORG_SECURITY is a function that returns a predicate for the WHERE CLAUSE
2. The where clause will be appended to Table/Synonym/View for which Multi Org Row Level security is enabled
This procedure has two parameters
   1. p_access_mode
   Pass a value "S" in case you want your current session to work against 

   Single ORG_ID
   Pass a value of "M" in case you want your current session to work 

   against multiple ORG_ID’s
   2. p_org_id
   Only applicable if p_access_mode is passed value of "S"


In SQL*Plus, I wish to set my session to work against a specific Org [one single org]. How do I do that in R12

SQL>> exec MO_GLOBAL.SET_POLICY_CONTEXT(’S’,101);
In the above case, ORG_ID 101 will be assigned as current org for your session.
Internally, following code in blue will be executed by Oracle when you set your context to single Org,dbms_session.set_context(’multi_org2’, ’current_org_id’, 101);

If the current database session is initialised for Single Org[as in above step], then Where clause appended to object by Row-Level-Security will be
WHERE org_id = sys_context(’multi_org2’,’current_org_id’)




begin
apps.mo_global.set_policy_context('S','101');

end;

No comments:

Post a Comment