19: ** Parameters :
20: */
21: procedure fnd_create_update(
22: p_event_type in varchar2
23: , p_user_name in fnd_user.user_name%type
24: , p_owner in varchar2
25: , p_unencrypted_password in varchar2
26: , p_description in fnd_user.description%type
27: , p_email_address in fnd_user.email_address%type
22: p_event_type in varchar2
23: , p_user_name in fnd_user.user_name%type
24: , p_owner in varchar2
25: , p_unencrypted_password in varchar2
26: , p_description in fnd_user.description%type
27: , p_email_address in fnd_user.email_address%type
28: , p_fax in fnd_user.fax%type
29: , p_start_date in varchar2
30: , p_end_date in varchar2
23: , p_user_name in fnd_user.user_name%type
24: , p_owner in varchar2
25: , p_unencrypted_password in varchar2
26: , p_description in fnd_user.description%type
27: , p_email_address in fnd_user.email_address%type
28: , p_fax in fnd_user.fax%type
29: , p_start_date in varchar2
30: , p_end_date in varchar2
31: , p_isenabled in varchar2
24: , p_owner in varchar2
25: , p_unencrypted_password in varchar2
26: , p_description in fnd_user.description%type
27: , p_email_address in fnd_user.email_address%type
28: , p_fax in fnd_user.fax%type
29: , p_start_date in varchar2
30: , p_end_date in varchar2
31: , p_isenabled in varchar2
32: , p_user_guid in fnd_user.user_guid%type
28: , p_fax in fnd_user.fax%type
29: , p_start_date in varchar2
30: , p_end_date in varchar2
31: , p_isenabled in varchar2
32: , p_user_guid in fnd_user.user_guid%type
33: , x_user_id out nocopy fnd_user.user_id%type
34: ) is
35: l_module_source varchar2(256);
36: l_apps_username_key fnd_oid_util.apps_user_key_type;
29: , p_start_date in varchar2
30: , p_end_date in varchar2
31: , p_isenabled in varchar2
32: , p_user_guid in fnd_user.user_guid%type
33: , x_user_id out nocopy fnd_user.user_id%type
34: ) is
35: l_module_source varchar2(256);
36: l_apps_username_key fnd_oid_util.apps_user_key_type;
37: l_apps_userguid_key fnd_oid_util.apps_user_key_type;
34: ) is
35: l_module_source varchar2(256);
36: l_apps_username_key fnd_oid_util.apps_user_key_type;
37: l_apps_userguid_key fnd_oid_util.apps_user_key_type;
38: l_user_name fnd_user.user_name%type;
39: l_found boolean;
40: l_allow_sync varchar2(1);
41: l_user_profiles fnd_oid_util.apps_sso_user_profiles_type;
42: l_profile_defined boolean;
41: l_user_profiles fnd_oid_util.apps_sso_user_profiles_type;
42: l_profile_defined boolean;
43: l_start_date date;
44: l_end_date date;
45: l_description fnd_user.description%type;
46: l_fax fnd_user.fax%type;
47: l_email_address fnd_user.email_address%type;
48:
49:
42: l_profile_defined boolean;
43: l_start_date date;
44: l_end_date date;
45: l_description fnd_user.description%type;
46: l_fax fnd_user.fax%type;
47: l_email_address fnd_user.email_address%type;
48:
49:
50: begin
43: l_start_date date;
44: l_end_date date;
45: l_description fnd_user.description%type;
46: l_fax fnd_user.fax%type;
47: l_email_address fnd_user.email_address%type;
48:
49:
50: begin
51: l_module_source := G_MODULE_SOURCE || 'fnd_create_update: ';
55: end if;
56: if (p_event_type = wf_oid.IDENTITY_MODIFY) then
57: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL) then
58: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'IDENTITY_MODIFY '
59: || 'event is handled by fnd_user_pkg.user_change().');
60: end if;
61: return;
62: end if;
63: --Check whether this guid already exists. Don't raise alerts because we receive echo
61: return;
62: end if;
63: --Check whether this guid already exists. Don't raise alerts because we receive echo
64: --from OID for each user that is created.
65: l_apps_userguid_key := fnd_oid_util.get_fnd_user(p_user_guid => p_user_guid);
66: -- Disable user in FND when user unsubscribed from the application in OID
67: if (p_event_type = wf_oid.SUBSCRIPTION_DELETE) then
68: update fnd_user set end_date= sysdate
69: where user_name = l_apps_userguid_key.user_name;
64: --from OID for each user that is created.
65: l_apps_userguid_key := fnd_oid_util.get_fnd_user(p_user_guid => p_user_guid);
66: -- Disable user in FND when user unsubscribed from the application in OID
67: if (p_event_type = wf_oid.SUBSCRIPTION_DELETE) then
68: update fnd_user set end_date= sysdate
69: where user_name = l_apps_userguid_key.user_name;
70: end if;
71: if (l_apps_userguid_key.user_id is not null) then
72: if(fnd_log.LEVEL_UNEXPECTED >= fnd_log.G_CURRENT_RUNTIME_LEVEL) then
77: return;
78: end if;
79: -- Check whether this user_name already exists. We won't link (update user_guid) here.
80: -- We let Auto Link profile or the linking page controls who is linked to whom.
81: l_apps_username_key := fnd_oid_util.get_fnd_user(p_user_name => p_user_name);
82: if (l_apps_username_key.user_id is not null) then
83: -- Is this user linked to someone else? Raise alert because it's a security threat.
84: if (l_apps_username_key.user_guid is not null and l_apps_username_key.user_guid <> p_user_guid) then
85: if(fnd_log.LEVEL_UNEXPECTED >=
103: -- Don't create user if disabled in OID
104: if (p_isenabled = 'INACTIVE' or p_isenabled = 'DISABLED') then
105: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL) then
106: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source,
107: 'User ' || p_user_name || ' will not be created in FND_USER, because ' ||
108: 'it''s Disabled in OID.');
109: end if;
110: return;
111: end if;
109: end if;
110: return;
111: end if;
112:
113: --This means neither user name nor guid exist in fnd_user
114: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL) then
115: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source,
116: 'User does not exist in FND_USER. About to create a new user...');
117: end if;
112:
113: --This means neither user name nor guid exist in fnd_user
114: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL) then
115: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source,
116: 'User does not exist in FND_USER. About to create a new user...');
117: end if;
118: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
119: then
120: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'Start_date input: ' || p_start_date);
120: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'Start_date input: ' || p_start_date);
121: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'End_date input: ' || p_end_date);
122: end if;
123: -- WF_ENTITY_MGR returns '*UNKNOWN*' string if the value was not found in attr_cache table
124: -- we should not populate the fnd_user table with this, for fax and description.
125:
126: -- Bug 5347086 - fnd_user_pkg does not check for UNKNOWN when creating the user. Doing it here
127: if (p_description in ('*UNKNOWN*','*NULL*')) then
128: l_description := null;
122: end if;
123: -- WF_ENTITY_MGR returns '*UNKNOWN*' string if the value was not found in attr_cache table
124: -- we should not populate the fnd_user table with this, for fax and description.
125:
126: -- Bug 5347086 - fnd_user_pkg does not check for UNKNOWN when creating the user. Doing it here
127: if (p_description in ('*UNKNOWN*','*NULL*')) then
128: l_description := null;
129: else
130: l_description := p_description;
163: then
164: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'End_date output: ' || l_end_date);
165: end if;
166:
167: x_user_id := fnd_user_pkg.CreateUserId(
168: x_user_name => p_user_name
169: , x_owner => p_owner
170: , x_unencrypted_password => fnd_web_sec.EXTERNAL_PWD -- passowrd will be set to EXTERNAL
171: , x_description => l_description
173: , x_start_date => l_start_date
174: , x_end_date => l_end_date
175: , x_fax => l_fax
176: , x_user_guid => p_user_guid
177: , x_change_source => fnd_user_pkg.change_source_oid
178: );
179:
180: -- API to set user profile value;
181: l_found := fnd_profile.save(x_name => 'APPS_SSO_LOCAL_LOGIN'
204:
205: procedure fnd_create_update(
206: p_wf_event in wf_event_t
207: , p_event_type in varchar2
208: , p_user_name in fnd_user.user_name%type
209: , p_user_guid in fnd_user.user_guid%type
210: , x_user_id out nocopy fnd_user.user_id%type
211: ) is
212:
205: procedure fnd_create_update(
206: p_wf_event in wf_event_t
207: , p_event_type in varchar2
208: , p_user_name in fnd_user.user_name%type
209: , p_user_guid in fnd_user.user_guid%type
210: , x_user_id out nocopy fnd_user.user_id%type
211: ) is
212:
213: l_module_source varchar2(256);
206: p_wf_event in wf_event_t
207: , p_event_type in varchar2
208: , p_user_name in fnd_user.user_name%type
209: , p_user_guid in fnd_user.user_guid%type
210: , x_user_id out nocopy fnd_user.user_id%type
211: ) is
212:
213: l_module_source varchar2(256);
214: l_description fnd_user.description%type;
210: , x_user_id out nocopy fnd_user.user_id%type
211: ) is
212:
213: l_module_source varchar2(256);
214: l_description fnd_user.description%type;
215: l_email_address fnd_user.email_address%type;
216: l_fax fnd_user.fax%type;
217: l_user_id number;
218: l_start_date varchar2(4000);
211: ) is
212:
213: l_module_source varchar2(256);
214: l_description fnd_user.description%type;
215: l_email_address fnd_user.email_address%type;
216: l_fax fnd_user.fax%type;
217: l_user_id number;
218: l_start_date varchar2(4000);
219: l_end_date varchar2(4000);
212:
213: l_module_source varchar2(256);
214: l_description fnd_user.description%type;
215: l_email_address fnd_user.email_address%type;
216: l_fax fnd_user.fax%type;
217: l_user_id number;
218: l_start_date varchar2(4000);
219: l_end_date varchar2(4000);
220: l_isenabled varchar2(4000);
310: l_event_name varchar2(256);
311: l_event_key varchar2(256);
312: l_change_source varchar2(256);
313: l_user_id number;
314: l_orcl_guid fnd_user.user_guid%type;
315:
316: begin
317: l_module_source := G_MODULE_SOURCE || 'identity_add: ';
318:
371: return varchar2 is
372:
373: l_module_source varchar2(256);
374: l_user_id number;
375: l_orcl_guid fnd_user.user_guid%type;
376:
377: begin
378: l_module_source := G_MODULE_SOURCE || 'identity_modify: ';
379:
380: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
381: then
382: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source, 'Begin');
383: end if;
384: --THIS SUBSCRIPTION IS NOT USED! fnd_user_pkg.user_change SUBSCRIPTION IS USED INSTEAD.
385: --Rada, 01/31/2005
386: l_orcl_guid := p_event.GetValueForParameter(
387: fnd_oid_util.G_ORCLGUID);
388: fnd_create_update(
435: then
436: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'End dating user: '||p_event.GetEventKey);
437: end if;
438:
439: update fnd_user
440: set end_date = sysdate
441: where user_name = p_event.GetEventKey;
442:
443: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
460: -------------------------------------------------------------------------------
461: /**
462: * This subscription handles the following events:
463: * OID -> User subscribing to an EBIZ instance
464: * EBIZ -> Linking of an FND_USER to OID user
465: * In both instances a SUBSCRIPTION_ADD event is raised. The change_source
466: * attribute is however different as below:
467: * OID -> change_source attribute is OID
468: * EBIZ -> change_source attribute is EBIZ
465: * In both instances a SUBSCRIPTION_ADD event is raised. The change_source
466: * attribute is however different as below:
467: * OID -> change_source attribute is OID
468: * EBIZ -> change_source attribute is EBIZ
469: * Please make sure that the change_source is indeed EBIZ and not FND_USER
470: * when the event is raised by EBIZ.
471: */
472: function subscription_add(
473: p_subscription_guid in raw
479: l_event_name varchar2(256);
480: l_event_key varchar2(256);
481: l_change_source varchar2(256);
482: l_user_id number;
483: l_orcl_guid fnd_user.user_guid%type;
484:
485: begin
486: l_module_source := G_MODULE_SOURCE || 'subscription_add: ';
487:
540: -------------------------------------------------------------------------------
541: /**
542: * This subscription handles the following events:
543: * OID -> User unsubscribing to an EBIZ instance
544: * EBIZ -> Uninking of an FND_USER with the OID user
545: * In both instances a SUBSCRIPTION_DELETE event is raises. The change_source
546: * attribute is however different as below:
547: * OID -> change_source attribute is OID
548: * EBIZ -> change_source attribute is EBIZ
545: * In both instances a SUBSCRIPTION_DELETE event is raises. The change_source
546: * attribute is however different as below:
547: * OID -> change_source attribute is OID
548: * EBIZ -> change_source attribute is EBIZ
549: * Please make sure that the change_source is indeed EBIZ and not FND_USER
550: * when the event is raised by EBIZ.
551: */
552: function subscription_delete(
553: p_subscription_guid in raw
559: l_event_name varchar2(256);
560: l_event_key varchar2(256);
561: l_change_source varchar2(256);
562: l_user_id number;
563: l_orcl_guid fnd_user.user_guid%type;
564:
565:
566: begin
567: l_module_source := G_MODULE_SOURCE || 'subscription_delete: ';
648: and entity_key_value = p_user_name
649: and attribute_name <> fnd_oid_util.G_CACHE_CHANGED;
650:
651: l_module_source varchar2(256);
652: l_user_name fnd_user.user_name%type;
653: l_result pls_integer;
654:
655: l_old_user_guid fnd_user.user_guid%type;
656: l_user_guid fnd_user.user_guid%type;
651: l_module_source varchar2(256);
652: l_user_name fnd_user.user_name%type;
653: l_result pls_integer;
654:
655: l_old_user_guid fnd_user.user_guid%type;
656: l_user_guid fnd_user.user_guid%type;
657: l_user_guid_changed boolean;
658:
659: l_old_person_party_id fnd_user.person_party_id%type;
652: l_user_name fnd_user.user_name%type;
653: l_result pls_integer;
654:
655: l_old_user_guid fnd_user.user_guid%type;
656: l_user_guid fnd_user.user_guid%type;
657: l_user_guid_changed boolean;
658:
659: l_old_person_party_id fnd_user.person_party_id%type;
660: l_person_party_id fnd_user.person_party_id%type;
655: l_old_user_guid fnd_user.user_guid%type;
656: l_user_guid fnd_user.user_guid%type;
657: l_user_guid_changed boolean;
658:
659: l_old_person_party_id fnd_user.person_party_id%type;
660: l_person_party_id fnd_user.person_party_id%type;
661: l_person_party_id_changed boolean;
662: l_apps_sso_link_truth_src varchar2(5);
663: l_profile_defined boolean;
656: l_user_guid fnd_user.user_guid%type;
657: l_user_guid_changed boolean;
658:
659: l_old_person_party_id fnd_user.person_party_id%type;
660: l_person_party_id fnd_user.person_party_id%type;
661: l_person_party_id_changed boolean;
662: l_apps_sso_link_truth_src varchar2(5);
663: l_profile_defined boolean;
664: begin
812: , p_event in out nocopy wf_event_t)
813: return varchar2 is
814:
815: l_module_source varchar2(256);
816: l_user_name fnd_user.user_name%type;
817: l_user_guid fnd_user.user_guid%type;
818: l_result pls_integer;
819:
820: begin
813: return varchar2 is
814:
815: l_module_source varchar2(256);
816: l_user_name fnd_user.user_name%type;
817: l_user_guid fnd_user.user_guid%type;
818: l_result pls_integer;
819:
820: begin
821: l_module_source := G_MODULE_SOURCE || ' on_demand_user_create: ';
865: return varchar2 is
866:
867: l_module_source varchar2(256);
868: l_event_id wf_entity_changes.entity_id%type;
869: l_user_name fnd_user.user_name%type;
870: l_user_guid fnd_user.user_guid%type;
871:
872: begin
873: l_module_source := G_MODULE_SOURCE || 'event_error: ';
866:
867: l_module_source varchar2(256);
868: l_event_id wf_entity_changes.entity_id%type;
869: l_user_name fnd_user.user_name%type;
870: l_user_guid fnd_user.user_guid%type;
871:
872: begin
873: l_module_source := G_MODULE_SOURCE || 'event_error: ';
874:
921: return varchar2 is
922:
923: l_module_source varchar2(256);
924: l_event_id wf_entity_changes.entity_id%type;
925: l_user_name fnd_user.user_name%type;
926: l_user_guid fnd_user.user_guid%type;
927:
928: begin
929: l_module_source := G_MODULE_SOURCE || 'event_resend: ';
922:
923: l_module_source varchar2(256);
924: l_event_id wf_entity_changes.entity_id%type;
925: l_user_name fnd_user.user_name%type;
926: l_user_guid fnd_user.user_guid%type;
927:
928: begin
929: l_module_source := G_MODULE_SOURCE || 'event_resend: ';
930:
1204: then
1205: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1206: then
1207: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source,
1208: 'Person Party exists in FND_USER');
1209: end if;
1210: fnd_oid_users.hz_update(
1211: p_ldap_message => l_ldap_message
1212: , x_return_status => p_return_status);
1212: , x_return_status => p_return_status);
1213: else
1214: l_event_key := p_wf_event.GetEventKey;
1215: select count(*) into l_count
1216: from fnd_user
1217: where user_name = l_event_key
1218: and user_guid is not null;
1219:
1220: if (l_count > 0) then
1220: if (l_count > 0) then
1221: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1222: then
1223: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source,
1224: 'Person Party does NOT exist in FND_USER, creating a new TCA entry');
1225: end if;
1226: fnd_oid_users.hz_create(
1227: p_ldap_message => l_ldap_message
1228: , x_return_status => p_return_status);
1229: else
1230: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1231: then
1232: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source,
1233: 'FND User is not linked to OID user, therefore not creating TCA party');
1234: end if;
1235: end if;
1236:
1237: end if;
1317: then
1318: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source, 'Begin');
1319: end if;
1320:
1321: l_apps_user_key := fnd_oid_util.get_fnd_user(p_user_name => p_user_name);
1322:
1323: l_resp_key := 'PREFERENCES';
1324: get_resp_app_id(p_resp_key => l_resp_key
1325: , x_responsibility_id=>l_responsibility_id
1325: , x_responsibility_id=>l_responsibility_id
1326: , x_application_id=>l_application_id
1327: );
1328:
1329: l_found := fnd_user_resp_groups_api.assignment_exists(
1330: user_id => l_apps_user_key.user_id
1331: , responsibility_id => l_responsibility_id
1332: , responsibility_application_id => l_application_id
1333: , security_group_id => null);
1333: , security_group_id => null);
1334:
1335: if (not l_found)
1336: then
1337: fnd_user_resp_groups_api.insert_assignment(
1338: user_id => l_apps_user_key.user_id
1339: , responsibility_id => l_responsibility_id
1340: , responsibility_application_id => l_application_id
1341: , security_group_id => null
1398: ', l_event_name = ' || l_event_name ||
1399: ', l_change_source = ' || l_change_source);
1400: end if;
1401:
1402: l_apps_user_key := fnd_oid_util.get_fnd_user(p_user_name => l_event_key);
1403:
1404: l_resp_key := 'PREFERENCES';
1405: get_resp_app_id(p_resp_key => l_resp_key
1406: , x_responsibility_id=>l_responsibility_id
1410:
1411: /* check whether the user is already assigned the responsibility */
1412:
1413:
1414: l_found := fnd_user_resp_groups_api.assignment_exists(
1415: user_id => l_apps_user_key.user_id
1416: , responsibility_id => l_responsibility_id
1417: , responsibility_application_id => l_application_id
1418: , security_group_id => null);
1420: /* If user is not assigned the responsibility,assign the default responsibility */
1421:
1422: if (not l_found)
1423: then
1424: fnd_user_resp_groups_api.insert_assignment(
1425: user_id => l_apps_user_key.user_id
1426: , responsibility_id => l_responsibility_id
1427: , responsibility_application_id => l_application_id
1428: , security_group_id => null