[Home] [Help]
PACKAGE BODY: APPS.BIS_VG_SECURITY
Source
1 PACKAGE BODY BIS_VG_SECURITY AS
2 /* $Header: BISTSECB.pls 115.8 2002/03/27 08:18:49 pkm ship $ */
3
4 -- Copyright (c) 1998 Oracle Corporation, Redwood Shores, CA, USA
5 -- All rights reserved.
6 --
7 -- FILENAME
8 --
9 -- BISTLATB.pls
10 --
11 -- DESCRIPTION
12 --
13 -- body of view genrator to substitute lookup code
14 --
15 -- NOTES
16 --
17 -- HISTORY
18 --
19 -- 23-JUL-98 Created
20 -- 11-MAR-99 Modified by WNASRALL.US
21 -- 11-DEC-01 Edited by DBOWLES Added dr driver comments.
22 --
23
24
25 TYPE TAG_FUNC_PAIR IS RECORD
26 (SECURITY_TAG varchar2(100)
27 , SECURITY_FUNCTION varchar2(1000)
28 );
29
30 TYPE TAG_FUNC_TABLE IS Table of TAG_FUNC_PAIR
31 INDEX BY BINARY_INTEGER;
32
33 G_SECURITY_FUNCTION_TABLE TAG_FUNC_TABLE;
34
35 G_PKG_NAME CONSTANT VARCHAR(30) := 'BIS_VG_SECURITY';
36
37
38 --============================================================================
39 --PROCEDURE : parse_SEC_select
40 -- PARAMETERS:
41 -- 1. p_View_Select_Table table of varchars to hold select
42 -- 2. p_pointer pointer to the lookup column in select table
43 -- 3. x_tbl name of security column
44 -- 4. x_app the application to use for security
45 -- 5. x_pointer pointer to the character after the delimiter
46 -- (select table)
47 -- 6. x_return_status error or normal
48 -- 7. x_error_Tbl table of error messages
49 ----
50 -- COMMENT : Call this procedure to add a particular lookup select
51 -- information to a view.
52 --EXCEPTION : None
53 -- ==========================================================================
54
55
56 PROCEDURE parse_SEC_select
57 ( p_View_Select_Table IN BIS_VG_TYPES.View_Text_Table_Type
58 , p_pointer IN BIS_VG_TYPES.View_Character_Pointer_Type
59 , x_tbl OUT VARCHAR2
60 , x_app OUT VARCHAR2
61 , x_pointer OUT BIS_VG_TYPES.View_Character_Pointer_Type
62 , x_return_status OUT VARCHAR2
63 , x_error_Tbl OUT BIS_VG_UTIL.Error_Tbl_Type
64 )
65 IS
66 l_pointer BIS_VG_TYPES.View_Character_Pointer_Type;
67 l_tag VARCHAR2(300);
68 l_index NUMBER;
69 BEGIN
70 BIS_DEBUG_PUB.Add('> parse_SEC_select');
71 x_return_status := FND_API.G_RET_STS_SUCCESS;
72 -- get the security tag
73 l_tag := bis_vg_parser.skip_tag
74 ( p_view_select_table
75 , p_pointer
76 , l_pointer
77 , x_return_status
78 , x_error_Tbl
79 );
80
81 -- get the table alias
82 x_tbl := bis_vg_parser.get_token ( p_view_select_table
83 , l_pointer
84 , ':'''
85 , l_pointer
86 , x_return_status
87 , x_error_Tbl
88 );
89
90 IF (x_tbl IS NULL) THEN
91 BIS_VG_UTIL.Add_Error_message
92 ( p_error_msg_name => bis_vg_security.SECURITY_COL_EXP_MSG
93 , p_error_proc_name => G_PKG_NAME||'.parse_SEC_select '
94 , p_error_msg_level => FND_MSG_PUB.G_MSG_LVL_ERROR
95 , p_token1 => 'tag'
96 , p_value1 => l_tag
97 , p_error_table => x_error_tbl
98 , x_error_table => x_error_tbl
99 );
100 bis_vg_log.update_failure_log( x_error_tbl
101 , x_return_status
102 , x_error_Tbl
103 );
104 RAISE FND_API.G_EXC_ERROR;
105
106 END IF;
107 x_app := bis_vg_util.get_char(p_view_select_table
108 , l_pointer
109 , x_return_status
110 , x_error_Tbl
111 );
112
113 l_tag := l_tag || ':' || x_tbl || x_app;
114
115
116 IF (x_app = ':') THEN
117 -- there is an application id which is separate
118 l_pointer := bis_vg_util.increment_pointer( p_view_select_table
119 , l_pointer
120 , x_return_status
121 , x_error_Tbl
122 );
123 -- get the organization id
124 x_app := x_tbl;
125 BIS_DEBUG_PUB.Add('Application = ' || x_app);
126
127 -- Find the field name
128 x_tbl := bis_vg_parser.get_token_increment_pointer( p_view_select_table
129 , l_pointer
130 , ''''
131 , l_pointer
132 , x_return_status
133 , x_error_Tbl
134 );
135
136 l_tag := l_tag || x_tbl;
137
138 -- Look up the security function
139 l_index := G_SECURITY_FUNCTION_TABLE.FIRST;
140
141 LOOP
142 IF G_SECURITY_FUNCTION_TABLE(l_index).SECURITY_TAG=UPPER(x_app) THEN
143 x_app := G_SECURITY_FUNCTION_TABLE(l_index).SECURITY_FUNCTION;
144 EXIT;
145 END IF;
146
147 IF l_index = G_SECURITY_FUNCTION_TABLE.LAST THEN
148 -- No entry for tag
149 BIS_VG_UTIL.Add_Error_message
150 ( p_error_msg_name => bis_vg_security.SECURITY_FUN_EXP_MSG
151 , p_error_proc_name => G_PKG_NAME||'. parse_SEC_select'
152 , p_error_table => x_error_tbl
153 , p_token1 => 'tag'
154 , p_value1 => l_tag
155 , p_token2 => 'function'
156 , p_value2 => x_app
157 , p_error_msg_level => FND_MSG_PUB.G_MSG_LVL_ERROR
158 , x_error_table => x_error_tbl
159 );
160 bis_vg_log.update_failure_log( x_error_tbl
161 , x_return_status
162 , x_error_Tbl
163 );
164 RAISE FND_API.G_EXC_ERROR;
165 END IF;
166 l_index:=G_SECURITY_FUNCTION_TABLE.NEXT(l_index);
167 END LOOP;
168 ELSE
169 -- There is no applicartion-specific tag, so default to HR security
170 x_app := 'HR_SECURITY.SHOW_BIS_RECORD';
171
172 END IF;
173 x_pointer := l_pointer;
174 BIS_DEBUG_PUB.Add('l_fun = ' || x_app);
175 BIS_DEBUG_PUB.Add('l_tbl = ' || x_tbl);
176 BIS_DEBUG_PUB.Add('< parse_SEC_select');
177
178
179 EXCEPTION
180 when FND_API.G_EXC_ERROR then
181 x_return_status := FND_API.G_RET_STS_ERROR ;
182 RAISE;
183 when FND_API.G_EXC_UNEXPECTED_ERROR then
184 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
185 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
186 when others then
187 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
188 BIS_VG_UTIL.Add_Error_Message
189 ( p_error_msg_id => SQLCODE
190 , p_error_description => SQLERRM
191 , p_error_proc_name => G_PKG_NAME||'. parse_SEC_select'
192 , p_error_table => x_error_tbl
193 , x_error_table => x_error_tbl
194 );
195 bis_vg_log.update_failure_log( x_error_tbl
196 , x_return_status
197 , x_error_Tbl
198 );
199 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
200
201 END parse_SEC_select;
202
203
204 -- ============================================================================
205 -- PROCEDURE : add_Security_Info
206 -- PARAMETERS:
207 -- 1. p_View_Select_Table table of varchars to hold SELECT clause of view
208 -- 2. p_security_Pointer pointer to security tag
209 -- 3. x_Select_Table table of varchars to hold additional columns
210 -- 4. x_security_pointer pointer at end of security
211 -- 5. x_return_status error or normal
212 -- 6. x_error_Tbl table of error messages
213 --
214 -- COMMENT : Call this procedure to add a security information to a view.
215 -- EXCEPTION : None
216 -- ===========================================================================
217 PROCEDURE add_Security_Info
218 ( p_View_Select_Table IN BIS_VG_TYPES.View_Text_Table_Type
219 , p_security_pointer IN BIS_VG_TYPES.view_character_pointer_type
220 , x_Select_Table OUT BIS_VG_TYPES.view_text_table_type
221 , x_security_pointer OUT BIS_VG_TYPES.view_character_pointer_type
222 , x_return_status OUT VARCHAR2
223 , x_error_Tbl OUT BIS_VG_UTIL.Error_Tbl_Type
224 )
225 IS
226 l_tbl VARCHAR2(100);
227 l_app VARCHAR2(100);
228 l_result VARCHAR2(1000);
229 l_pointer BIS_VG_TYPES.view_character_pointer_type;
230 l_Table BIS_VG_TYPES.view_text_table_type;
231 BEGIN
232
233 BIS_DEBUG_PUB.Add('> add_Security_Info ');
234 x_return_status := FND_API.G_RET_STS_SUCCESS;
235
236 Parse_SEC_Select ( p_View_Select_Table
237 , p_security_pointer
238 , l_tbl
239 , l_app
240 , l_pointer
241 , x_return_status
242 , x_error_Tbl
243 );
244
245 BIS_DEBUG_PUB.Add('Function = ' || l_app);
246 BIS_DEBUG_PUB.Add('Table Column = ' || l_tbl);
247
248 -- l_result := '( ';
249 -- l_result := l_result ||l_tbl;
250 -- l_result := l_result || ' is null or ';
251
252 l_result := l_app;
253 l_result := l_result || '( ';
254 l_result := l_result ||l_tbl;
255 l_result := l_result ||' ) = ''TRUE''';
256 --
257 BIS_DEBUG_PUB.Add('l_result = ' || l_result);
258
259 x_select_table(x_select_table.COUNT + 1) := l_result;
260 --
261 -- position beyond 'is not null' string
262 l_table(1) := 'NULL';
263 --
264 x_security_pointer := bis_vg_parser.get_keyword_position
265 ( p_View_Select_Table
266 , l_table
267 , l_pointer
268 , x_return_status
269 , x_error_Tbl
270 );
271
272 -- increment the pointer four times to skip 'null'
273 FOR i IN 1 .. 4 LOOP
274 x_security_pointer := bis_vg_util.increment_pointer( p_view_select_table
275 , x_security_pointer
276 , x_return_status
277 , x_error_Tbl
278 );
279 END LOOP;
280 --
281 BIS_DEBUG_PUB.Add('< add_Security_Info ');
282
283 EXCEPTION
284 when FND_API.G_EXC_ERROR then
285 x_return_status := FND_API.G_RET_STS_ERROR ;
286 RAISE;
287 when FND_API.G_EXC_UNEXPECTED_ERROR then
288 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
289 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
290 when others then
291 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
292 BIS_VG_UTIL.Add_Error_Message
293 ( p_error_msg_id => SQLCODE
294 , p_error_description => SQLERRM
295 , p_error_proc_name => G_PKG_NAME||'.add_security_Info'
296 , p_error_table => x_error_tbl
297 , x_error_table => x_error_tbl
298 );
299 bis_vg_log.update_failure_log( x_error_tbl
300 , x_return_status
301 , x_error_Tbl
302 );
303 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
304
305 END add_security_Info;
306 --
307 --
308
309 BEGIN
310
311 G_SECURITY_FUNCTION_TABLE(2).SECURITY_TAG := 'HRTST';
312 G_SECURITY_FUNCTION_TABLE(2).SECURITY_FUNCTION :=
313 'HR_SECURITY.SHOW_BIS_RECORD';
314 G_SECURITY_FUNCTION_TABLE(1).SECURITY_TAG := 'GL';
315 G_SECURITY_FUNCTION_TABLE(1).SECURITY_FUNCTION :=
316 'GL_SECURITY_PKG.VALIDATE_ACCESS';
317
318 END BIS_VG_SECURITY;