R12 - MOAC Environment Setup
R12 - MOAC Environment Setup
R12 - MOAC Environment Setup
Pre-requisites for understanding how MOAC works in R12 are (Although these are not mandatory but knowledge of these would definitely help),
As an example, let us consider the PO_HEADERS_ALL table. This is owned by PO schema having records for every operating unit. To implement Org
security, a view has been created on top of it i.e. PO_HEADERS and is being owned by APPS schema.
If you see the content of this view, you would see the view has been created by accessing the value of CLIENT_INFO session field value which is being set by
respective applications like PO, AP using DBMS_APPLICATION_INFO.SET_CLIENT_INFO API.
So, if you want to give the access only for US operating unit (lets assume the ORG_ID to be 100) then you set
begin
dbms_application_info.set_client_info(100);
end;
If you query PO_HEADERS after the above statement is executed in your session then you would see all the POs only for operating unit 100. This
is to secure the data as per the user access,
You can also use FND_CLIENT_INFO.SET_ORG_CONTEXT API to set the ORG context which ultimately uses the above to set the ORG context.
begin
fnd_client_info.set_org_context(100);
end;
This is how all the applications (PO, AP etc) set the CLIENT_INFO field and set the ORG_CONTEXT prior to R12.
RLS feature was introduced in Oracle since Oracle 8i. The prime feature of RLS is implementing row level security while reading / inserting /
deleting the data from the Database. In brief, you can use RLS to restrict data based on user permissions / privileges.
The temp table is populated when you set user / org context.
After you set these up, if you query PO_HEADERS synonym then Oracle DB would automatically add the predicate (the list of operating units to
which user has access to) to the query and would only return rows for the operating units to which user has access to.
begin
MO_GLOBAL.INIT('SQLAP');
end;
Now the query returns the list of operating units to which OPERATIONS user has access to. And if you query from PO_HEADERS, you would see
result from these operating units.
Summary:
A. Oracle uses RLS to implement MOAC in R12
B. All multi-org tables now have synonym in APPS
C. The synonyms now have a policy defined which can be found in DBA_POLICIES
D. To setup multi-org context in R12 from the back end programmatically,
1. Call FND_GLOBAL.APPS_INITIALIZE
2. Call MO_GLOBAL.INIT
How is CLIENT_INFO being replaced in R12?
Let’s take an example.
In pre Release 12, you would have had following methodology for PO_HEADERS_ALL
a. A table is created in PO Schema, named PO_HEADERS_ALL
b. A synonym named PO_HEADERS_ALL is created in APPS schema, referring to PO.PO_HEADERS_ALL
c. Create a view PO_HEADERS in APPS schema, as "select * from po_headers_all where org_id=client_info"
Does this mean, if I create a new custom table, I will have to apply RLS [ Row Level Security ] against Custom table too?
Yes indeed, if it contains data partitioned by ORG_ID. All you need to do in such case is to assign package function MO_GLOBAL.ORG_SECURITY to
that table/synonym/view.
Will the Multi Org Row Level security be applied against the table or the synonym or the view?
In theory, RLS can be applied against any of the above objects. However in practice, you will apply RLS against Objects in APPS Schema. This
means, you will most probably apply RLS on Synonyms. Basically, the Multi Org Views are now replaced by RLS Secured Synonyms. Hence no code
change is required where the pre-R12 Multi-Org secured view was being accessed. The responsibility of securing data as per ORG_ID now
lies with RLS [also known as VPD - Virtual Private Database].
I have made changes to my Multi Org Security Profile, by attaching a new Org Hierarchy. Do i need to run any process?
Just like we do in HRMS, it is advised that any changes to Security Profiles must be followed by running "Security List Maintenance"
What is MO_GLOBAL.INIT
Purpose of mo_global.init :-
It will check if new Multi Org Security Profile is set, to decide if new Security Profile method will be used.
If the new MO security profile is set, then mo_global.init inserts one record, for each Organization in Org Hierarchy, in table
mo_glob_org_access_tmp
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')