1 package fnd_ldap_user as
2 /* $Header: AFSCOLUS.pls 120.20.12010000.1 2008/07/25 14:21:23 appldev ship $ */
3 --
4 /*****************************************************************************/
5
6 -- Start of Package Globals
7
8 -- End of Package Globals
9 --
10 -------------------------------------------------------------------------------
11 /*
12 ** Name : change_password
13 ** Type : Public, FND Internal
14 ** Desc : This function changes OID password for a user in OID.
15 ** Pre-Reqs :
16 ** Parameters: p_user_guid: user GUID
17 ** p_user_name : user name
18 ** p_expire_password :
19 ** - fnd_ldap_wrapper.G_TRUE if
20 ** password to be expired on next login (for example when
21 ** admin updates a user password)
22 ** - fnd_ldap_wrapper.G_FALSE if
23 ** password NOT to be expired on next login (for example when
24 ** a user updates his/her own password)
25 ** x_password:
26 ** EXTERNAL or null depending on APPS_SSO_LOCAL_LOGIN profile
27 ** x_result :
28 ** fnd_ldap_wrapper.G_SUCCESS or
29 ** fnd_ldap_wrapper.G_FAILURE
30 ** Notes :
31 */
32 procedure change_password(p_user_guid in raw,
33 p_user_name in varchar2,
34 p_new_pwd in varchar2,
35 p_expire_password in pls_integer,
36 x_password out nocopy varchar2,
37 x_result out nocopy pls_integer);
38 --
39 -------------------------------------------------------------------------------
40 /*
41 ** Name : change_user_name
42 ** Type : Public, FND Internal
43 ** Desc : This function creates a user name in OID
44 ** Pre-Reqs :
45 ** Returns : FND_LDAP_UTIL.G_SUCCESS if
46 ** - a user name is successfully changed in OID
47 ** FND_LDAP_UTIL.G_FAILURE if
48 ** - user name change fails
49 */
50 procedure change_user_name(p_user_guid in raw,
51 p_old_user_name in varchar2,
52 p_new_user_name in varchar2,
53 x_result out nocopy pls_integer);
54 --
55 -------------------------------------------------------------------------------
56 /*
57 ** Name : create_user
58 ** Type : Public, FND Internal
59 ** Desc : This function creates a user in OID for the application it is
60 ** invoked from. It only creates a user if a user doesn't exists
61 ** already. If a user eixts with the same name, it will return
62 ** FND_LDAP_UTIL.G_FAILURE
63 ** Pre-Reqs :
64 ** Parameters: p_ldap_user : user record. See FND_LDAP_UTIL.ldap_user_type
65 ** for more details
66 ** Returns : FND_LDAP_UTIL.G_SUCCESS if
67 ** - a user is successfully created in OID
68 ** FND_LDAP_UTIL.G_FAILURE if
69 ** - user creation fails
70 */
71 function create_user(p_ldap_user in fnd_ldap_util.ldap_user_type) return pls_integer;
72 --
73 -------------------------------------------------------------------------------
74 /*
75 ** Name : create_user
76 ** Type : Public, FND Internal
77 ** Desc : This procedure creates a user in OID for the application it is
78 ** invoked from. If a user already exists with the same name, it
79 ** checks whether the profile APPS_SSO_LINK_SAME_NAMES is enabled.
80 *8 If the profile is enabled, it simply links the users and returns
81 ** G_SUCCESS with appropriate x_user_guid and x_password. If the
82 ** profile is disabled, it throws an exception.
83 ** Pre-Reqs :
84 ** Parameters:
85 ** p_user_name: user name
86 ** p_password: unencrypted password
87 ** p_start_date: start date of the user, default sysdate
88 ** p_end_date: end date of the user, default null
89 ** p_description: description of the user, default null
90 ** p_email_address: email address, default null
91 ** p_fax: fax, default null
92 ** p_expire_password:
93 ** - fnd_ldap_wrapper.G_TRUE if
94 ** password to be expired on first login (for example when
95 ** admin creates a user)
96 ** - fnd_ldap_wrapper.G_FALSE if
97 ** password NOT to be expired on first login (for example when
98 ** cerated via self service)
99 ** x_user_guid:
100 ** GUID of the user created
101 ** x_password:
102 ** EXTERNAL or null depending on APPS_SSO_LOCAL_LOGIN profile
103 ** x_result: fnd_ldap_wrapper.G_SUCCESS
104 ** or fnd_ldap_wrapper.G_FAILURE
105 ** Pre-Reqs :
106 ** Throws : user_create_failure if user creation fails
107 */
108 procedure create_user(p_user_name in varchar2,
109 p_password in varchar2,
110 p_start_date in date default sysdate,
111 p_end_date in date default null,
112 p_description in varchar2 default null,
113 p_email_address in varchar2 default null,
114 p_fax in varchar2 default null,
115 p_expire_password in pls_integer ,
116 x_user_guid out nocopy raw,
117 x_password out nocopy varchar2,
118 x_result out nocopy pls_integer);
119 --
120 -------------------------------------------------------------------------------
121 /*
122 ** Name : link_user
123 ** Type : Public, FND Internal
124 ** Desc : This procedure links the user with a user with same name in OID.
125 ** If no user exists with the same name, it returns with G_FAILURE.
126 ** If application is not SSO enabled, it
127 ** simply returns G_SUCCESS without linking the user in OID
128 ** Pre-Reqs :
129 ** Parameters: x_user_guid:
130 ** GUID of the user linked
131 ** x_password:
132 ** EXTERNAL or null
133 ** x_result:
134 ** FND_LDAP_WRAPPER.G_SUCCESS if
135 ** - a user is successfully linked to user in OID
136 ** - or application is not SSO enabled
137 ** FND_LDAP_WRAPPER.G_FAILURE if
138 ** - application is SSO enabled and user linking fails
139 ** Notes :
140 */
141 procedure link_user(p_user_name in varchar2,
142 x_user_guid out nocopy raw,
143 x_password out nocopy varchar2,
144 x_result out nocopy pls_integer);
145 --
146 -------------------------------------------------------------------------------
147 /*
148 ** Name : unlink_user
149 ** Type : Public, FND Internal
150 ** Desc : This procedure unsubscribes the user in OID if there is no other FND user linked
151 ** to the same OID user
152 ** If no user exists with the same name, it returns with G_FAILURE.
153 ** If application is not SSO enabled, it
154 ** simply returns G_SUCCESS without unlinking the user in OID
155 ** Pre-Reqs :
156 ** Parameters: p_user_guid:
157 ** GUID of the user to be unlinked
158 ** x_password:
159 ** EXTERNAL or null
160 ** x_result:
161 ** FND_LDAP_WRAPPER.G_SUCCESS if
162 ** - a user is successfully unlinked
163 ** - or application is not SSO enabled
164 ** FND_LDAP_WRAPPER.G_FAILURE if
165 ** - application is SSO enabled and user unlinking fails
166 ** Notes :
167 */
168 procedure unlink_user(p_user_guid in fnd_user.user_guid%type,
169 p_user_name in varchar2,
170 x_result out nocopy pls_integer);
171 --
172 -------------------------------------------------------------------------------
173 /*
174 ** Name : user_exists
175 ** Type : Public, FND Internal
176 ** Desc : This function creates a user in OID for the application it is
177 ** invoked from
178 ** Notes : This API doesn't check for profile values. Use fnd_ldap_wrapper
179 ** Pre-Reqs :
180 ** Parameters: user_name : user name
181 ** Returns : FND_LDAP_UTIL.G_SUCCESS if
182 ** - the user exists
183 ** FND_LDAP_UTIL.G_FAILURE if
184 ** - the user doesn't exist
185 */
186 function user_exists(p_user_name in varchar2) return pls_integer;
187 function user_exists(ldap in dbms_ldap.session,p_user_name in varchar2) return pls_integer;
188 --
189 -------------------------------------------------------------------------------
190 /*
191 ** Name : delete_user
192 ** Type : Public, FND Internal
193 ** Desc : If the OID user was created from the same instance where the
194 ** fnd_user is now being rejected/released, *and* the OID user is
195 ** still inactive, then we will delete it.If either of these
196 ** criteria is not fulfilled, we can't touch the OID user even if
197 ** we delete the pending FND_USER record.
198 ** Pre-Reqs :
199 ** Parameters: p_user_name : user name to be deleted
200 ** p_result :
201 ** FND_LDAP_UTIL.G_SUCCESS if
202 ** - the user is successfully deleted in OID
203 ** FND_LDAP_UTIL.G_FAILURE if
204 ** - if user deletion fails
205 ** Notes :
206 */
207 procedure delete_user(p_user_guid in fnd_user.user_guid%type,
208 x_result out nocopy pls_integer);
209 --
210 -------------------------------------------------------------------------------
211 /*
212 ** Name : update_user
213 ** Type : Public, FND Internal
214 ** Desc : This procedure updates a user in OID for the application it is
215 ** invoked from. If the user doesn't exist, it
216 ** returns with G_FAILURE.
217 ** Pre-Reqs :
218 ** Parameters: p_user_guid: user GUID
219 ** p_user_name: user name
220 ** p_password: unencrypted password
221 ** p_start_date: start date of the user, default sysdate
222 ** p_end_date: end date of the user, default null
223 ** p_description: description of the user, default null
224 ** p_email_address: email address, default null
225 ** p_fax: fax, default null
226 ** x_password:
227 ** EXTERNAL or null depending on APPS_SSO_LOCAL_LOGIN profile
228 ** x_result:
229 ** FND_LDAP_UTIL.G_SUCCESS if
230 ** - the user is successfully updated in OID
231 ** FND_LDAP_UTIL.G_FAILURE if
232 ** - user update fails
233 ** Notes :
234 */
235 procedure update_user(p_user_guid in raw,
236 p_user_name in varchar2,
237 p_password in varchar2 default null,
238 p_start_date in date default null,
239 p_end_date in date default null,
240 p_description in varchar2 default null,
241 p_email_address in varchar2 default null,
242 p_fax in varchar2 default null,
243 x_password out nocopy varchar2,
244 x_result out nocopy pls_integer);
245
246 --
247 -------------------------------------------------------------------------------
248 /*
249 ** Name : update_user
250 ** Type : Public, FND Internal
251 ** Desc : This procedure updates a user in OID for the application it is
252 ** invoked from. If the user doesn't exist, it
253 ** returns with G_FAILURE.
254 ** Pre-Reqs :
255 ** Parameters: p_user_guid: user GUID
256 ** p_user_name: user name
257 ** p_password: unencrypted password
258 ** p_start_date: start date of the user, default sysdate
259 ** p_end_date: end date of the user, default null
260 ** p_description: description of the user, default null
261 ** p_email_address: email address, default null
262 ** p_fax: fax, default null
263 ** p_expire_password:
264 ** - fnd_ldap_wrapper.G_TRUE if
265 ** password to be expired on next login (for example when
266 ** admin updates a user password)
267 ** - fnd_ldap_wrapper.G_FALSE if
268 ** password NOT to be expired on next login (for example when
269 ** a user updates his/her own password)
270 ** x_password:
271 ** EXTERNAL or null depending on APPS_SSO_LOCAL_LOGIN profile
272 ** x_result:
273 ** FND_LDAP_UTIL.G_SUCCESS if
274 ** - the user is successfully updated in OID
275 ** FND_LDAP_UTIL.G_FAILURE if
276 ** - user update fails
277 ** Notes :
278 */
279
280 procedure update_user(p_user_guid in raw,
281 p_user_name in varchar2,
282 p_password in varchar2 default null,
283 p_start_date in date default null,
284 p_end_date in date default null,
285 p_description in varchar2 default null,
286 p_email_address in varchar2 default null,
287 p_fax in varchar2 default null,
288 p_expire_password in pls_integer,
289 x_password out nocopy varchar2,
290 x_result out nocopy pls_integer) ;
291
292 -------------------------------------------------------------------------------
293 /*
294 ** Name : get_user_guid_and_count
295 ** Type : Public, FND Internal
296 ** Desc : This procedure retrieves GUID from OID for the given userid
297 ** Pre-Reqs :
298 ** Parameters: p_user_name: user name
299 ** Parameters: out the number of entries fuond
300 ** Notes :
301 */
302 function get_user_guid_and_count(p_user_name in varchar2, n out nocopy pls_integer) return varchar2;
303 --
304 --
305 -------------------------------------------------------------------------------
306 /*
307 ** Name : get_user_guid
308 ** Type : Public, FND Internal
309 ** Desc : This procedure retrieves GUID from OID for the given user
310 ** Pre-Reqs :
311 ** Parameters: p_user_name: user name
312 ** Notes :
313 */
314 function get_user_guid(p_user_name in varchar2) return raw;
315 function get_user_guid(p_ldap_session in dbms_ldap.session, p_user_name in varchar2)return raw ;
316 --
317 -------------------------------------------------------------------------------
318 /*
322 ** Pre-Reqs :
319 ** Name : get_attribute_value
320 ** Type : Public, FND Internal
321 ** Desc : This procedure retrieves value for an attribute from OID given a ** user name
323 ** Parameters: p_user_name: user name
324 ** p_attribute_name: attribute name
325 ** Notes :
326 */
327 function get_attribute_value(p_user_name in varchar2, p_attribute_name in varchar2) return varchar2;
328 --
329 -------------------------------------------------------------------------------
333 ** Desc : This function queries the the OID based on the search filter constructed from the
330 /*
331 ** Name : user_exists_with_filter
332 ** Type : Public, FND Internal
334 input attribute name and value pair.
335 ** Pre-Reqs :
336 ** Parameters : p_attr_name, p_attr_value
337 ** Notes : REMOVED
338 */
339 --function user_exists_with_filter(p_attr_name in varchar2, p_attr_value in varchar2) return pls_integer;
340 --
341 -------------------------------------------------------------------------------
342 /*
343 ** Name : validate_login
344 ** Type : Public, FND Internal
345 ** Desc : This procedure validates a user for a given password
346 ** Calling this API with invalid password will eventually LOCK the OiD Account.
347 ** It will return VALID only when the password is valid and the OiD Account is active and enabled.
348 ** When return INVALID will put on the FND Stack one of the following error codes
349 ** FND_SSO_USER_PASSWD_EMPTY: wrong call parameters
350 ** FND-9903: when OiD Setup is not correct
351 ** FND_SSO_INV_AUTH_MODE: OiD SSL setup is incorrect
352 ** FND_SSO_SYSTEM_NOT_AVAIL: Cannot connect to OiD
353 ** FND-9914: Unexpected error connecting to OiD
354 ** FND_SSO_NOT_LINKED: the given user name has no SSO associated
355 ** FND_SSO_USER_NOT_FOUND: FND_USER.USER_GUID is invalid or corrupted
356 ** FND_APPL_LOGIN_FAILED: Invalid Passowrd or unmanaged error validing password.
357 ** FND_SSO_LOCKED: SSO Account is locked
358 **
359 **
360 ** Only if the password is CORRECT , may fail with the following errors
361 **
362 ** FND_SSO_NOT_ACTIVE: end_date is before today or start date is in the future.
363 ** FND_SSO_PASSWORD_EXPIRED: SSO password is expired
364 ** FND_SSO_USER_DISABLED: SSO account is disabled
365 **
366 ** Pre-Reqs :
367 ** Parameters: p_user_name: user name
368 ** p_password: password
369 ** Notes :
370 */
371 function validate_login(p_user_name in varchar2, p_password in varchar2) return pls_integer;
372 --
373 -------------------------------------------------------------------------------
374
375 end fnd_ldap_user;