15: registration pls_integer := G_NO_REGISTRATION;
16: function trim_attribute(p_attr in varchar2) return varchar2;
17:
18: -------------------------------------------------------------------------------
19: function get_ldap_user_name(p_user_name in fnd_user.user_name%type) return varchar2 is
20:
21: l_module_source varchar2(256);
22: l_result varchar2(4000);
23: l_user_guid fnd_user.user_guid%type;
19: function get_ldap_user_name(p_user_name in fnd_user.user_name%type) return varchar2 is
20:
21: l_module_source varchar2(256);
22: l_result varchar2(4000);
23: l_user_guid fnd_user.user_guid%type;
24: l_found boolean;
25:
26: l_apps_sso varchar2(50);
27: l_profile_defined boolean;
31: sso_registration_failure exception;
32: l_sso_version varchar2(10);
33: l_allow_sync varchar2(1);
34:
35: cursor cur_fnd_users is
36: select user_guid
37: from fnd_user
38: where user_name = upper(p_user_name);
39: begin
33: l_allow_sync varchar2(1);
34:
35: cursor cur_fnd_users is
36: select user_guid
37: from fnd_user
38: where user_name = upper(p_user_name);
39: begin
40: l_module_source := G_MODULE_SOURCE || 'get_ldap_user_name ';
41: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
80: end if;
81:
82: if (registered) then
83: l_found := false;
84: open cur_fnd_users;
85: fetch cur_fnd_users into l_user_guid;
86: l_found := cur_fnd_users%found;
87:
88: if (fnd_log.LEVEL_EXCEPTION >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
81:
82: if (registered) then
83: l_found := false;
84: open cur_fnd_users;
85: fetch cur_fnd_users into l_user_guid;
86: l_found := cur_fnd_users%found;
87:
88: if (fnd_log.LEVEL_EXCEPTION >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
89: then
82: if (registered) then
83: l_found := false;
84: open cur_fnd_users;
85: fetch cur_fnd_users into l_user_guid;
86: l_found := cur_fnd_users%found;
87:
88: if (fnd_log.LEVEL_EXCEPTION >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
89: then
90: fnd_log.string(fnd_log.LEVEL_EXCEPTION, l_module_source,
99: else
100: if (fnd_log.LEVEL_EXCEPTION >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
101: then
102: fnd_log.string(fnd_log.LEVEL_EXCEPTION, l_module_source,
103: 'no such user in FND_USER: '||p_user_name);
104: end if;
105: l_result := null;
106: end if;
107: close cur_fnd_users;
103: 'no such user in FND_USER: '||p_user_name);
104: end if;
105: l_result := null;
106: end if;
107: close cur_fnd_users;
108:
109: else -- if (!registered)
110: if (fnd_log.LEVEL_EXCEPTION >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
111: then
139: end if;
140: return l_result;
141: exception
142: when sso_registration_failure then
143: if (cur_fnd_users%isopen)
144: then
145: close cur_fnd_users;
146: end if;
147: if (fnd_log.LEVEL_ERROR >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
141: exception
142: when sso_registration_failure then
143: if (cur_fnd_users%isopen)
144: then
145: close cur_fnd_users;
146: end if;
147: if (fnd_log.LEVEL_ERROR >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
148: then
149: fnd_log.string(fnd_log.LEVEL_ERROR, l_module_source, sqlerrm);
151: l_result := null;
152: fnd_message.set_name ('FND', 'FND_SSO_OID_REG_ERROR');
153: return l_result;
154: when others then
155: if (cur_fnd_users%isopen)
156: then
157: close cur_fnd_users;
158: end if;
159: if (fnd_log.LEVEL_ERROR >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
153: return l_result;
154: when others then
155: if (cur_fnd_users%isopen)
156: then
157: close cur_fnd_users;
158: end if;
159: if (fnd_log.LEVEL_ERROR >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
160: then
161: fnd_log.string(fnd_log.LEVEL_ERROR, l_module_source, sqlerrm);
171: x_result out nocopy pls_integer) is
172:
173: l_module_source varchar2(256);
174: plsql_block varchar2(500);
175: l_fnd_user pls_integer;
176: l_oid pls_integer;
177: l_attribute varchar2(4000);
178: l_realm varchar2(4000);
179:
190: is_operation_allowed(p_realm=> l_realm, p_direction => G_EBIZ_TO_OID,
191: p_entity => G_IDENTITY,
192: p_operation => G_MODIFY,
193: x_attribute => l_attribute,
194: x_fnd_user => l_fnd_user,
195: x_oid => l_oid);
196:
197: if (l_oid = G_SUCCESS) then
198:
205: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
206: then
207: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'l_oid is false');
208: end if;
209: x_result := l_fnd_user;
210:
211: end if;
212:
213: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
229:
230: end change_user_name;
231: --
232: -------------------------------------------------------------------------------
233: procedure synch_user_from_LDAP(p_user_name in fnd_user.user_name%type
234: , p_result out nocopy pls_integer) is
235: l_module_source varchar2(256);
236: l_apps_sso varchar2(50);
237: l_profile_defined boolean;
336: x_result out nocopy pls_integer) is
337:
338: l_module_source varchar2(256);
339: plsql_block varchar2(500);
340: l_fnd_user pls_integer;
341: l_oid pls_integer;
342: l_attribute varchar2(4000);
343: l_allowed boolean;
344: l_password varchar2(400);
364: is_operation_allowed(p_realm=>l_realm,p_direction => G_EBIZ_TO_OID,
365: p_entity => G_IDENTITY,
366: p_operation => G_ADD,
367: x_attribute => l_attribute,
368: x_fnd_user => l_fnd_user,
369: x_oid => l_oid);
370:
371: if (l_oid = G_SUCCESS) then
372:
423: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
424: then
425: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'l_oid is false');
426: end if;
427: x_result := l_fnd_user;
428:
429: end if; -- l_oid
430:
431: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
477: x_result out nocopy pls_integer) is
478:
479: l_module_source varchar2(256);
480: plsql_block varchar2(500);
481: l_fnd_user pls_integer;
482: l_oid pls_integer;
483: l_attribute varchar2(4000);
484: l_realm varchar2(4000);
485:
497: is_operation_allowed(p_realm=>l_realm,p_direction => G_EBIZ_TO_OID,
498: p_entity => G_IDENTITY,
499: p_operation => G_MODIFY,
500: x_attribute => l_attribute,
501: x_fnd_user => l_fnd_user,
502: x_oid => l_oid);
503:
504: if (l_oid = G_SUCCESS) then
505:
512: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
513: then
514: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'Password Sync Not Allowed');
515: end if;
516: x_result := l_fnd_user;
517:
518: end if; -- l_oid
519:
520: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
536:
537: end change_password;
538: --
539: -------------------------------------------------------------------------------
540: procedure delete_user(p_user_guid in fnd_user.user_guid%type,
541: x_result out nocopy pls_integer) is
542:
543: l_module_source varchar2(256);
544: plsql_block varchar2(500);
541: x_result out nocopy pls_integer) is
542:
543: l_module_source varchar2(256);
544: plsql_block varchar2(500);
545: l_fnd_user pls_integer;
546: l_oid pls_integer;
547: l_attribute varchar2(4000);
548: l_realm varchar2(4000);
549:
559: is_operation_allowed(p_realm=>l_realm,p_direction => G_EBIZ_TO_OID,
560: p_entity => G_IDENTITY,
561: p_operation => G_DELETE,
562: x_attribute => l_attribute,
563: x_fnd_user => l_fnd_user,
564: x_oid => l_oid);
565:
566: if (l_oid = G_SUCCESS) then
567:
574: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
575: then
576: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'l_oid is false');
577: end if;
578: x_result := l_fnd_user;
579:
580: end if; -- l_oid
581:
582: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
604: x_result out nocopy pls_integer) is
605:
606: l_module_source varchar2(256);
607: plsql_block varchar2(500);
608: l_fnd_user pls_integer;
609: l_oid pls_integer;
610: l_attribute varchar2(4000);
611: l_realm varchar2(4000);
612:
623: is_operation_allowed(p_realm=>l_realm,p_direction => G_EBIZ_TO_OID,
624: p_entity => G_SUBSCRIPTION,
625: p_operation => G_ADD,
626: x_attribute => l_attribute,
627: x_fnd_user => l_fnd_user,
628: x_oid => l_oid);
629:
630: if (l_oid = G_SUCCESS) then
631:
639: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
640: then
641: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'l_oid id false');
642: end if;
643: x_result := l_fnd_user;
644:
645: end if; -- l_oid
646:
647: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
663:
664: end link_user;
665: --
666: -------------------------------------------------------------------------------
667: procedure unlink_user(p_user_guid in fnd_user.user_guid%type,
668: p_user_name in varchar2,
669: x_result out nocopy pls_integer) is
670:
671: l_module_source varchar2(256);
669: x_result out nocopy pls_integer) is
670:
671: l_module_source varchar2(256);
672: plsql_block varchar2(500);
673: l_fnd_user pls_integer;
674: l_oid pls_integer;
675: l_attribute varchar2(4000);
676: l_realm varchar2(4000);
677:
688: is_operation_allowed(p_realm=>l_realm,p_direction => G_EBIZ_TO_OID,
689: p_entity => G_SUBSCRIPTION,
690: p_operation => G_DELETE,
691: x_attribute => l_attribute,
692: x_fnd_user => l_fnd_user,
693: x_oid => l_oid);
694:
695: if (l_oid = G_SUCCESS) then
696:
704: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
705: then
706: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'l_oid is false');
707: end if;
708: x_result := l_fnd_user;
709:
710: end if; -- l_oid
711:
712: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
859: x_result out nocopy pls_integer) is
860:
861: l_module_source varchar2(256);
862: plsql_block varchar2(500);
863: l_fnd_user pls_integer;
864: l_oid pls_integer;
865: l_attribute varchar2(4000);
866: l_allowed boolean;
867: l_password varchar2(400);
887: is_operation_allowed(p_realm=>l_realm,p_direction => G_EBIZ_TO_OID,
888: p_entity => G_IDENTITY,
889: p_operation => G_MODIFY,
890: x_attribute => l_attribute,
891: x_fnd_user => l_fnd_user,
892: x_oid => l_oid);
893:
894: if (l_oid = G_SUCCESS) then
895:
944: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
945: then
946: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'l_oid is false');
947: end if;
948: x_result := l_fnd_user;
949:
950: end if; -- l_oid
951:
952: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1131: procedure is_operation_allowed(p_realm in varchar2,p_direction in pls_integer default G_EBIZ_TO_OID,
1132: p_entity in pls_integer,
1133: p_operation in pls_integer,
1134: x_attribute in out nocopy varchar2,
1135: x_fnd_user out nocopy pls_integer,
1136: x_oid out nocopy pls_integer) is
1137:
1138: l_module_source varchar2(256);
1139: l_apps_sso varchar2(50);
1153: then
1154: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source, 'Begin');
1155: end if;
1156:
1157: x_fnd_user := G_SUCCESS;
1158: x_oid := G_FAILURE;
1159:
1160: fnd_profile.get_specific(name_z => 'APPS_SSO_LDAP_SYNC',
1161: USER_ID_Z => -1,
1183: ,'Valid registration');
1184: end if;
1185: plsql_block :=
1186: 'begin fnd_sso_registration.is_operation_allowed(:1, :2, :3, :4, :5, :6,null,:7); end;';
1187: execute immediate plsql_block using p_direction, p_entity, p_operation, in out x_attribute, out x_fnd_user, out x_oid,in p_realm;
1188:
1189: elsif(l_registration = FND_LDAP_WRAPPER.G_INVALID_REGISTRATION) then
1190: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL) then
1191: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source
1196: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL) then
1197: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source
1198: ,'No registration');
1199: end if;
1200: x_fnd_user := G_SUCCESS;
1201: x_oid := G_FAILURE;
1202: end if;
1203:
1204: else -- APPS_SSO_LDAP_SYNC not enabled.
1211:
1212: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1213: then
1214: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source,
1215: 'out values x_fnd_user: '||x_fnd_user||' x_oid: '||x_oid);
1216: end if;
1217:
1218:
1219: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1223:
1224: exception
1225: when registration_failure_exception then
1226: fnd_message.set_name ('FND', 'FND_SSO_OID_REG_ERROR');
1227: x_fnd_user := G_FAILURE;
1228: x_oid := G_FAILURE;
1229: raise registration_failure_exception;
1230: when no_data_found then
1231: fnd_message.set_name ('FND', 'FND_SSO_OID_REG_ERROR');
1228: x_oid := G_FAILURE;
1229: raise registration_failure_exception;
1230: when no_data_found then
1231: fnd_message.set_name ('FND', 'FND_SSO_OID_REG_ERROR');
1232: x_fnd_user := G_FAILURE;
1233: x_oid := G_FAILURE;
1234: raise registration_failure_exception;
1235: when others then
1236: fnd_message.set_name ('FND', 'FND_SSO_UNEXP_ERROR');
1242: end is_operation_allowed;
1243: --
1244: -------------------------------------------------------------------------------
1245: procedure is_operation_allowed(p_realm in varchar2,p_operation in pls_integer,
1246: x_fnd_user out nocopy pls_integer,
1247: x_oid out nocopy pls_integer) is
1248:
1249: l_module_source varchar2(256);
1250: l_apps_sso varchar2(50);
1261: then
1262: fnd_log.string(fnd_log.LEVEL_PROCEDURE, l_module_source, 'Begin');
1263: end if;
1264:
1265: x_fnd_user := G_SUCCESS;
1266: x_oid := G_FAILURE;
1267:
1268: fnd_profile.get_specific(
1269: name_z => 'APPS_SSO',
1290:
1291: if (registered) then
1292: plsql_block :=
1293: 'begin fnd_sso_registration.is_operation_allowed(:1, :2, :3,null,:4); end;';
1294: execute immediate plsql_block using p_operation, out x_fnd_user, out x_oid,in p_realm;
1295: else
1296: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1297: then
1298: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'SSO profile enabled but improper regitration');
1306: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1307: then
1308: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source, 'SSO not enabled, returning false');
1309: end if;
1310: x_fnd_user := G_SUCCESS;
1311: x_oid := G_FAILURE;
1312: fnd_message.set_name ('FND', 'FND_SSO_NOT_ENABLED');
1313: end if;
1314:
1314:
1315: if (fnd_log.LEVEL_STATEMENT >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1316: then
1317: fnd_log.string(fnd_log.LEVEL_STATEMENT, l_module_source,
1318: 'out values x_fnd_user: '||x_fnd_user||' x_oid: '||x_oid);
1319: end if;
1320:
1321: if (fnd_log.LEVEL_PROCEDURE >= fnd_log.G_CURRENT_RUNTIME_LEVEL)
1322: then
1325:
1326: exception
1327: when sso_registration_failure then
1328: fnd_message.set_name ('FND', 'FND_SSO_OID_REG_ERROR');
1329: x_fnd_user := G_SUCCESS;
1330: x_oid := G_SUCCESS;
1331: when no_data_found then
1332: fnd_message.set_name ('FND', 'FND_SSO_OID_REG_ERROR');
1333: x_fnd_user := G_SUCCESS;
1329: x_fnd_user := G_SUCCESS;
1330: x_oid := G_SUCCESS;
1331: when no_data_found then
1332: fnd_message.set_name ('FND', 'FND_SSO_OID_REG_ERROR');
1333: x_fnd_user := G_SUCCESS;
1334: x_oid := G_SUCCESS;
1335: when others then
1336: fnd_message.set_name ('FND', 'FND_SSO_UNEXP_ERROR');
1337: if (fnd_log.LEVEL_ERROR >= fnd_log.G_CURRENT_RUNTIME_LEVEL)