DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_SECURITY

Source


1 PACKAGE BODY FA_SECURITY AS
2 /* $Header: faxsecb.pls 120.8 2005/07/25 19:43:37 bridgway ship $ */
3 
4 /* =============================================================================
5         Name:           build_predicate
6 
7         Description:    Different object has a different predicate.  After the
8                         object is identified, construct the predicate with the
9                         org_id_list from the application context.
10 
11         Parameters:     obj_schema      VARCHAR2
12                         obj_name        VARCHAR2
13 ============================================================================= */FUNCTION build_predicate (obj_schema VARCHAR2, obj_name VARCHAR2 )
14 RETURN VARCHAR2 IS
15 
16     l_security_profile_id 	number := NULL;
17 
18 BEGIN
19 
20    if (not G_predicate_init or
21        G_user_id <> fnd_global.user_id or
22        G_resp_id <> fnd_global.resp_id) then
23 
24       fnd_profile.get('FA_SECURITY_PROFILE_ID', l_security_profile_id);
25 
26       IF (l_security_profile_id is NULL) THEN
27 
28          G_predicate_stmt := '';
29 
30       ELSE
31 
32          DBMS_SESSION.SET_CONTEXT('fixed_assets',
33                                   'fa_security_profile_id',
34                                   l_security_profile_id);
35 
36          G_predicate_stmt :=
37            'org_id is null or
38             org_id in
39              (SELECT organization_id
40                 FROM per_organization_list
41                WHERE security_profile_id =
42                      SYS_CONTEXT(''fixed_assets'', ''fa_security_profile_id''))';
43 
44       END IF;
45 
46       G_predicate_init := TRUE;
47       G_user_id        := fnd_global.user_id;
48       G_resp_id        := fnd_global.resp_id;
49 
50    END IF;
51 
52    return g_predicate_stmt;
53 
54 EXCEPTION
55     WHEN NO_DATA_FOUND THEN
56         DBMS_SESSION.SET_CONTEXT('fixed_assets', 'fa_org_id_list', NULL);
57         return g_predicate_stmt;
58 
59 END build_predicate;
60 
61 END fa_security;
62