1 PACKAGE AMS_access_PVT AUTHID CURRENT_USER AS
2 /* $Header: amsvaccs.pls 115.25 2002/12/18 09:42:29 cgoyal ship $ */
3
4 TYPE access_rec_type IS RECORD(
5 ACTIVITY_ACCESS_ID NUMBER,
6 LAST_UPDATE_DATE DATE,
7 LAST_UPDATED_BY NUMBER,
8 CREATION_DATE DATE,
9 CREATED_BY NUMBER,
10 LAST_UPDATE_LOGIN NUMBER,
11 OBJECT_VERSION_NUMBER NUMBER,
12 ACT_ACCESS_TO_OBJECT_ID NUMBER,
13 ARC_ACT_ACCESS_TO_OBJECT VARCHAR2(30),
14 USER_OR_ROLE_ID NUMBER,
15 ARC_USER_OR_ROLE_TYPE VARCHAR2(30),
16 ACTIVE_FROM_DATE DATE,
17 ADMIN_FLAG VARCHAR2(1),
18 APPROVER_FLAG VARCHAR2(1),
19 ACTIVE_TO_DATE DATE,
20 OWNER_FLAG VARCHAR2(1),
21 DELETE_FLAG VARCHAR2(1)
22 );
23 ---------------------------------------------------------------------
24 -- PROCEDURE
25 -- create_access
26 --
27 -- PURPOSE
28 -- Create a new access.
29 --
30 -- PARAMETERS
31 -- p_access_rec: the new record to be inserted
32 -- x_access_id: return the access_id of the new access
33 --
34 -- NOTES
35 -- 1. object_version_number will be set to 1.
36 -- 2. If access_id is passed in, the uniqueness will be checked.
37 -- Raise exception in case of duplicates.
38 -- 3. If access_id is not passed in, generate a unique one from
39 -- the sequence.
40 -- 4. If a flag column is passed in, check if it is 'Y' or 'N'.
41 -- Raise exception for invalid flag.
42 -- 5. If a flag column is not passed in, default it to 'Y' or 'N'.
43 -- 6. Please don't pass in any FND_API.g_mess_char/num/date.
44 ---------------------------------------------------------------------
45 PROCEDURE create_access(
46 p_api_version IN NUMBER,
47 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
48 p_commit IN VARCHAR2 := FND_API.g_false,
49 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
50
51 x_return_status OUT NOCOPY VARCHAR2,
52 x_msg_count OUT NOCOPY NUMBER,
53 x_msg_data OUT NOCOPY VARCHAR2,
54
55 p_access_rec IN access_rec_type,
56 x_access_id OUT NOCOPY NUMBER
57 );
58
59
60 ---------------------------------------------------------------------
61 -- PROCEDURE
62 -- check_function_security
63 --
64 -- PURPOSE
65 -- Check the availability of the function in the security model
66 --
67 -- PARAMETERS
68 -- p_function_name: Name of the function
69 -- x_access_id: return the access
70 --
71 -- DESCRIPTION
72 -- This is the wrapper function over fnd_function.test
73 ---------------------------------------------------------------------
74 FUNCTION check_function_security( p_function_name IN VARCHAR2 )
75 RETURN NUMBER;
76 --------------------------------------------------------------------
77 -- PROCEDURE
78 -- delete_access
79 --
80 -- PURPOSE
81 -- Delete a access.
82 --
83 -- PARAMETERS
84 -- p_access_id: the access_id
85 -- p_object_version: the object_version_number
86 --
87 -- NOTES
88 -- 1. Raise exception if the object_version_number doesn't match.
89 --------------------------------------------------------------------
90 PROCEDURE delete_access(
91 p_api_version IN NUMBER,
92 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
93 p_commit IN VARCHAR2 := FND_API.g_false,
94 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
95
96 x_return_status OUT NOCOPY VARCHAR2,
97 x_msg_count OUT NOCOPY NUMBER,
98 x_msg_data OUT NOCOPY VARCHAR2,
99
100 p_access_id IN NUMBER,
101 p_object_version IN NUMBER
102 );
103
104
105 -------------------------------------------------------------------
106 -- PROCEDURE
107 -- lock_access
108 --
109 -- PURPOSE
110 -- Lock a access.
111 --
112 -- PARAMETERS
113 -- p_access_id: the access_id
114 -- p_object_version: the object_version_number
115 --
116 -- NOTES
117 -- 1. Raise exception if the object_version_number doesn't match.
118 --------------------------------------------------------------------
119 PROCEDURE lock_access(
120 p_api_version IN NUMBER,
121 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
122 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
123
124 x_return_status OUT NOCOPY VARCHAR2,
125 x_msg_count OUT NOCOPY NUMBER,
126 x_msg_data OUT NOCOPY VARCHAR2,
127
128 p_access_id IN NUMBER,
129 p_object_version IN NUMBER
130 );
131
132
133 ---------------------------------------------------------------------
134 -- PROCEDURE
135 -- update_access
136 --
137 -- PURPOSE
138 -- Update a access.
139 --
140 -- PARAMETERS
141 -- p_access_rec: the record with new items
142 --
143 -- NOTES
144 -- 1. Raise exception if the object_version_number doesn't match.
145 -- 2. If an attribute is passed in as FND_API.g_miss_char/num/date,
146 -- that column won't be updated.
147 ----------------------------------------------------------------------
148 PROCEDURE update_access(
149 p_api_version IN NUMBER,
150 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
151 p_commit IN VARCHAR2 := FND_API.g_false,
152 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
153
154 x_return_status OUT NOCOPY VARCHAR2,
155 x_msg_count OUT NOCOPY NUMBER,
156 x_msg_data OUT NOCOPY VARCHAR2,
157 p_access_rec IN access_rec_type
158 );
159
160
161 ---------------------------------------------------------------------
162 -- PROCEDURE
163 -- update_object_owner
164 --
165 -- PURPOSE
166 -- Update a access.
167 --
168 -- PARAMETERS
169 -- p_access_rec: the record with new items
170 --
171 -- NOTES
172 -- 1. Raise exception if the object_version_number doesn't match.
173 -- 2. If an attribute is passed in as FND_API.g_miss_char/num/date,
174 -- that column won't be updated.
175 ----------------------------------------------------------------------
176 PROCEDURE update_object_owner(
177 p_api_version IN NUMBER,
178 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
179 p_commit IN VARCHAR2 := FND_API.g_false,
180 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
181 x_return_status OUT NOCOPY VARCHAR2,
182 x_msg_count OUT NOCOPY NUMBER,
183 x_msg_data OUT NOCOPY VARCHAR2,
184 p_object_type IN VARCHAR2,
185 p_object_id IN NUMBER,
186 p_resource_id IN NUMBER,
187 p_old_resource_id IN NUMBER
188 );
189
190 ---------------------------------------------------------------------
191 -- PROCEDURE
192 -- validate_access
193 --
194 -- PURPOSE
195 -- Validate a access record.
196 --
197 -- PARAMETERS
198 -- p_access_rec: the access record to be validated
199 --
200 -- NOTES
201 -- 1. p_access_rec should be the complete access record. There
202 -- should not be any FND_API.g_miss_char/num/date in it.
203 ----------------------------------------------------------------------
204 PROCEDURE validate_access(
205 p_api_version IN NUMBER,
206 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
207 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
208
209 x_return_status OUT NOCOPY VARCHAR2,
210 x_msg_count OUT NOCOPY NUMBER,
211 x_msg_data OUT NOCOPY VARCHAR2,
212 p_access_rec IN access_rec_type
213 );
214
215 ---------------------------------------------------------------------
216 -- FUNCTION
217 -- check_owner
218 -- PURPOSE
219 -- check whether the input user is the owner of the activity.
220 ---------------------------------------------------------------------
221 FUNCTION check_owner(
222 p_object_id IN NUMBER,
223 p_object_type IN VARCHAR2,
224 p_user_or_role_id IN NUMBER,
225 p_user_or_role_type IN VARCHAR2
226 )
227 RETURN VARCHAR2;
228
229 PRAGMA RESTRICT_REFERENCES(check_owner, WNDS);
230 ---------------------------------------------------------------------
231 -- PROCEDURE
232 -- check_update_access
233 --
234 -- PURPOSE
235 -- return the access of a user or a group
236 -- F : FULL: User can update sensitive metric data
237 -- R : RESTRICTED : User can only update data other than sensitive metric data
238 -- N : NULL : User is not in the access list
239 -- PARAMETERS
240 -- p_access_rec: the access record to be validated
241 -- Only following PARAM are req.
242 -- p_access_rec.act_access_to_object_id ,
243 -- p_access_rec.arc_act_access_to_object ,
244 -- p_access_rec.user_or_role_id ,
245 -- p_access_rec.arc_user_or_role_type
246 --
247 --
248 ----------------------------------------------------------------------
249 FUNCTION check_update_access(
250 p_object_id IN NUMBER,
251 p_object_type IN VARCHAR2,
252 p_user_or_role_id IN NUMBER,
253 p_user_or_role_type IN VARCHAR2
254 )
255 RETURN VARCHAR2;
256
257
258 ---------------------------------------------------------------------
259 -- PROCEDURE
260 -- check_view_access
261 --
262 -- PURPOSE
263 -- return the access of a user or a group
264 -- Y : User can view the object i.e CAMP, EVEN or DELIV
265 -- N : User cannot view the object i.e CAMP, EVEN or DELIV
266
267 -- PARAMETERS
268 -- p_access_rec: the access record to be validated
269 -- Only following PARAM are req.
270 -- p_access_rec.act_access_to_object_id ,
271 -- p_access_rec.arc_act_access_to_object ,
272 -- p_access_rec.user_or_role_id ,
273 -- p_access_rec.arc_user_or_role_type
274 -- NOTES
275 ----------------------------------------------------------------------
276 FUNCTION check_view_access(
277 p_object_id IN NUMBER,
278 p_object_type IN VARCHAR2,
279 p_user_or_role_id IN NUMBER,
280 p_user_or_role_type IN VARCHAR2
281 )
282 RETURN VARCHAR2;
283
284 PRAGMA RESTRICT_REFERENCES(check_view_access, WNDS);
285
286
287 FUNCTION get_source_code(
288 p_object_type IN VARCHAR2,
289 p_object_id IN NUMBER
290 )
291 RETURN VARCHAR2;
292
293 PRAGMA RESTRICT_REFERENCES(get_source_code, WNDS);
294
295
296 ---------------------------------------------------------------------
297 -- PROCEDURE
298 -- check_access_items
299 --
300 -- PURPOSE
301 -- Perform the item level checking including unique keys,
302 -- required columns, foreign keys, domain constraints.
303 --
304 -- PARAMETERS
305 -- p_access_rec: the record to be validated
306 -- p_validation_mode: JTF_PLSQL_API.g_create/g_update
307 ---------------------------------------------------------------------
308 PROCEDURE check_access_items(
309 p_access_rec IN access_rec_type,
310 p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
311 x_return_status OUT NOCOPY VARCHAR2
312 );
313
314
315 ---------------------------------------------------------------------
316 -- PROCEDURE
317 -- check_access_record
318 --
319 -- PURPOSE
320 -- Check the record level business rules.
321 --
322 -- PARAMETERS
323 -- p_access_rec: the record to be validated; may contain attributes
324 -- as FND_API.g_miss_char/num/date
325 -- p_complete_rec: the complete record after all "g_miss" items
326 -- have been replaced by current database values
327 ---------------------------------------------------------------------
328 PROCEDURE check_access_record(
329 p_access_rec IN access_rec_type,
330 p_complete_rec IN access_rec_type := NULL,
331 x_return_status OUT NOCOPY VARCHAR2
332 );
333
334
338 --
335 ---------------------------------------------------------------------
336 -- PROCEDURE
337 -- init_access_rec
339 -- PURPOSE
340 -- Initialize all attributes to be FND_API.g_miss_char/num/date.
341 ---------------------------------------------------------------------
342 PROCEDURE init_access_rec(
343 x_access_rec OUT NOCOPY access_rec_type
344 );
345
346
347 ---------------------------------------------------------------------
348 -- PROCEDURE
349 -- complete_access_rec
350 --
351 -- PURPOSE
352 -- For update_access, some attributes may be passed in as
353 -- FND_API.g_miss_char/num/date if the user doesn't want to
354 -- update those attributes. This procedure will replace the
355 -- "g_miss" attributes with current database values.
356 --
357 -- PARAMETERS
358 -- p_access_rec: the record which may contain attributes as
359 -- FND_API.g_miss_char/num/date
360 -- x_complete_rec: the complete record after all "g_miss" items
361 -- have been replaced by current database values
362 ---------------------------------------------------------------------
363 PROCEDURE complete_access_rec(
364 p_access_rec IN access_rec_type,
365 x_complete_rec OUT NOCOPY access_rec_type
366 );
367
368 --=========================================================================
369 -- PROCEDURE
370 -- Check_Admin_access
371 -- PURPOSE
372 -- To give the Admin user full previledges for the security
373 -- PARAMETER
374 -- p_resource_id ID of the person loggin in
375 -- output TRUE if the resource has the admin previledges
376 -- FALSE if the resource doesn't have the admin previledges
377 -- Notes
378 -- Ref Bug#1387652
379 -- HISTORY
380 --=========================================================================
381 FUNCTION Check_Admin_access(
382 p_resource_id IN NUMBER )
383 RETURN BOOLEAN ;
384 PRAGMA RESTRICT_REFERENCES(Check_Admin_access, WNDS);
385 END AMS_access_PVT;