Thursday, November 26, 2009

MOAC functions

MO_GLOBAL Package
MOAC functionality is provided through the MO_GLOBAL package (AFMOGBLB.pls).  Following are some of the more important functions and procedures in the package.

Init() This is generally called by forms and reports to setup the list of orgs that can be accessed.  It calls the set_org_access procedure, which in turn calls populate_orgs.  This inserts the orgs a user is allowed to access in a global temporary table -- MO_GLOB_ORG_ACCESS_TMP.  The table is populated based on the MO: Security Profile and MO: Operating Unit profile option values.

Org_security() This returns a sql predicate (where clause) that controls which records can be accessed. 
Example:
EXISTS (SELECT 1
                    FROM mo_glob_org_access_tmp oa
                    WHERE oa.organization_id = org_id)
This is used in dbms_rls.add_policy to add the vpd security to synonyms.

Check_access() Checks to see if an org can be accessed by a user.  If  access mode is M (Multiple), see if the org_id is in mo_glob_org_access_tmp.


To Set Policy Context at VPD
Single-org:
Execute mo_global.set_policy_context('S',&org_id);

Multi-org:
Begin
FND_GLOBAL.apps_initialize(
   l_user_id,    -- User id
   l_resp_id,    -- Responsibility Id
   200);           -- Application Id
MO_GLOBAL.init('SQLAP');
End;
Related Posts Plugin for WordPress, Blogger...