DBA Data[Home] [Help]

APPS.WF_LDAP dependencies on WF_LDAP

Line 1: package body WF_LDAP as

1: package body WF_LDAP as
2: /* $Header: WFLDAPB.pls 120.1 2005/07/02 03:15:36 appldev ship $ */
3: ------------------------------------------------------------------------------
4: WF_LDAP_LOCAL_CHARSET varchar2(100) := null;
5: WF_LDAP_CHANGELOG_SUB varchar2(256) := 'cn=WF_SYNCH_'||

Line 4: WF_LDAP_LOCAL_CHARSET varchar2(100) := null;

1: package body WF_LDAP as
2: /* $Header: WFLDAPB.pls 120.1 2005/07/02 03:15:36 appldev ship $ */
3: ------------------------------------------------------------------------------
4: WF_LDAP_LOCAL_CHARSET varchar2(100) := null;
5: WF_LDAP_CHANGELOG_SUB varchar2(256) := 'cn=WF_SYNCH_'||
6: fnd_web_config.database_id()||
7: ',cn=Subscriber Profile,cn=ChangeLog Subscriber,cn=Oracle Internet Directory';
8: ------------------------------------------------------------------------------

Line 5: WF_LDAP_CHANGELOG_SUB varchar2(256) := 'cn=WF_SYNCH_'||

1: package body WF_LDAP as
2: /* $Header: WFLDAPB.pls 120.1 2005/07/02 03:15:36 appldev ship $ */
3: ------------------------------------------------------------------------------
4: WF_LDAP_LOCAL_CHARSET varchar2(100) := null;
5: WF_LDAP_CHANGELOG_SUB varchar2(256) := 'cn=WF_SYNCH_'||
6: fnd_web_config.database_id()||
7: ',cn=Subscriber Profile,cn=ChangeLog Subscriber,cn=Oracle Internet Directory';
8: ------------------------------------------------------------------------------
9: usernameAttr varchar2(256) := 'ORCLCOMMONNICKNAMEATTRIBUTE';

Line 20: if (wf_ldap.WF_LDAP_LOCAL_CHARSET is null) then

16: FUNCTION cs_convert(p_value in varchar2) return varchar2 is
17: new_val varchar2(4000);
18: ulang varchar2(256);
19: begin
20: if (wf_ldap.WF_LDAP_LOCAL_CHARSET is null) then
21: ulang := userenv('LANGUAGE');
22: wf_ldap.WF_LDAP_LOCAL_CHARSET := substr(ulang, instr(ulang,'.')+1,
23: length(ulang));
24: end if;

Line 22: wf_ldap.WF_LDAP_LOCAL_CHARSET := substr(ulang, instr(ulang,'.')+1,

18: ulang varchar2(256);
19: begin
20: if (wf_ldap.WF_LDAP_LOCAL_CHARSET is null) then
21: ulang := userenv('LANGUAGE');
22: wf_ldap.WF_LDAP_LOCAL_CHARSET := substr(ulang, instr(ulang,'.')+1,
23: length(ulang));
24: end if;
25:
26: if (wf_ldap.WF_LDAP_LOCAL_CHARSET = 'UTF8') then

Line 26: if (wf_ldap.WF_LDAP_LOCAL_CHARSET = 'UTF8') then

22: wf_ldap.WF_LDAP_LOCAL_CHARSET := substr(ulang, instr(ulang,'.')+1,
23: length(ulang));
24: end if;
25:
26: if (wf_ldap.WF_LDAP_LOCAL_CHARSET = 'UTF8') then
27: new_val := p_value;
28: else
29: new_val := convert(p_value, wf_ldap.WF_LDAP_LOCAL_CHARSET, 'UTF8');
30: end if;

Line 29: new_val := convert(p_value, wf_ldap.WF_LDAP_LOCAL_CHARSET, 'UTF8');

25:
26: if (wf_ldap.WF_LDAP_LOCAL_CHARSET = 'UTF8') then
27: new_val := p_value;
28: else
29: new_val := convert(p_value, wf_ldap.WF_LDAP_LOCAL_CHARSET, 'UTF8');
30: end if;
31:
32: return new_val;
33: exception

Line 35: wf_core.context('wf_ldap', 'cs_convert', p_value);

31:
32: return new_val;
33: exception
34: when others then
35: wf_core.context('wf_ldap', 'cs_convert', p_value);
36: raise;
37: end cs_convert;
38: ------------------------------------------------------------------------------
39: /*

Line 97: wf_core.context('wf_ldap', 'setsizelimit',

93: retval := DBMS_LDAP.modify_s(p_session, ' ', mod_array);
94: dbms_ldap.free_mod_array(mod_array);
95: exception
96: when others then
97: wf_core.context('wf_ldap', 'setsizelimit',
98: 'Error code: '||to_char(sqlcode),
99: 'Error Message: '||substr(sqlerrm, 1, 238));
100: raise;
101: end setsizelimit;

Line 118: retval := DBMS_LDAP.modify_s(p_session, WF_LDAP_CHANGELOG_SUB, mod_array);

114: mod_array := DBMS_LDAP.create_mod_array(1);
115:
116: DBMS_LDAP.populate_mod_array(mod_array, DBMS_LDAP.MOD_REPLACE,
117: 'orclLastAppliedChangeNumber', mod_vals);
118: retval := DBMS_LDAP.modify_s(p_session, WF_LDAP_CHANGELOG_SUB, mod_array);
119: dbms_ldap.free_mod_array(mod_array);
120: exception
121: when others then
122: wf_core.context('wf_ldap', 'setLastChangeNumber',

Line 122: wf_core.context('wf_ldap', 'setLastChangeNumber',

118: retval := DBMS_LDAP.modify_s(p_session, WF_LDAP_CHANGELOG_SUB, mod_array);
119: dbms_ldap.free_mod_array(mod_array);
120: exception
121: when others then
122: wf_core.context('wf_ldap', 'setLastChangeNumber',
123: 'Error code: '||to_char(sqlcode),
124: 'Error Message: '||substr(sqlerrm, 1, 238));
125: raise;
126: end setLastChangeNumber;

Line 152: wf_core.context('wf_ldap', 'search',

148: 0, -- retrieve both types AND values
149: p_results);
150: exception
151: when others then
152: wf_core.context('wf_ldap', 'search',
153: 'Error code: '||to_char(sqlcode),
154: 'Error Message: '||substr(sqlerrm, 1, 238));
155: raise;
156: end search;

Line 169: retval := WF_LDAP.search(p_session, ' ', results, DBMS_LDAP.SCOPE_BASE,

165: my_entry DBMS_LDAP.message;
166: my_vals DBMS_LDAP.STRING_COLLECTION;
167: retval pls_integer;
168: begin
169: retval := WF_LDAP.search(p_session, ' ', results, DBMS_LDAP.SCOPE_BASE,
170: 'objectclass=*', p_name);
171: my_entry := dbms_ldap.first_entry(p_session, results);
172:
173: if (my_entry is not null) then

Line 196: retval := wf_ldap.search(p_session, WF_LDAP_CHANGELOG_SUB, results,

192: my_entry DBMS_LDAP.message;
193: my_vals DBMS_LDAP.STRING_COLLECTION;
194: retval pls_integer;
195: begin
196: retval := wf_ldap.search(p_session, WF_LDAP_CHANGELOG_SUB, results,
197: DBMS_LDAP.SCOPE_SUBTREE, 'objectclass=*',
198: 'orcllastappliedchangenumber');
199: my_entry := dbms_ldap.first_entry(p_session, results);
200:

Line 224: lastclog := wf_ldap.get_cfg_val(p_session, 'lastchangenumber');

220: mod_array DBMS_LDAP.MOD_ARRAY;
221: mod_vals DBMS_LDAP.STRING_COLLECTION;
222: retval pls_integer;
223: begin
224: lastclog := wf_ldap.get_cfg_val(p_session, 'lastchangenumber');
225: if (lastclog is null) then
226: lastclog := '0';
227: end if;
228:

Line 247: retval := DBMS_LDAP.add_s(p_session, WF_LDAP_CHANGELOG_SUB, mod_array);

243: mod_vals(1) := 'top';
244: DBMS_LDAP.populate_mod_array(mod_array, DBMS_LDAP.MOD_ADD,
245: 'objectclass', mod_vals);
246: dbms_ldap.use_exception := FALSE;
247: retval := DBMS_LDAP.add_s(p_session, WF_LDAP_CHANGELOG_SUB, mod_array);
248: dbms_ldap.use_exception := TRUE;
249:
250: --
251: -- Update changenumber. Doesn't affect anything if subscription is new

Line 254: wf_ldap.setLastChangeNumber(p_session, lastclog);

250: --
251: -- Update changenumber. Doesn't affect anything if subscription is new
252: -- but desirable if old subscription with an outdated value already exists.
253: --
254: wf_ldap.setLastChangeNumber(p_session, lastclog);
255:
256: --
257: -- grant access to the OID Change Log Object Container
258: --

Line 262: mod_vals(1) := WF_LDAP_CHANGELOG_SUB;

258: --
259: dbms_ldap.free_mod_array(mod_array);
260: mod_array := DBMS_LDAP.create_mod_array(1);
261:
262: mod_vals(1) := WF_LDAP_CHANGELOG_SUB;
263: DBMS_LDAP.populate_mod_array(mod_array, DBMS_LDAP.MOD_ADD,
264: 'uniqueMember', mod_vals);
265:
266: dbms_ldap.use_exception := FALSE; -- hide possible dup entry exception --

Line 274: wf_core.context('WF_LDAP', 'createSubscription',

270:
271: dbms_ldap.free_mod_array(mod_array);
272: exception
273: when others then
274: wf_core.context('WF_LDAP', 'createSubscription',
275: 'Error code: '||to_char(sqlcode),
276: 'Error Message: '||substr(sqlerrm, 1, 238));
277: raise;
278: end createSubscription;

Line 314: new_val := wf_ldap.cs_convert(substr(my_vals(my_vals.FIRST),1,4000));

310: while my_attrname IS NOT NULL loop
311:
312: my_vals := dbms_ldap.get_values(p_session, my_entry, my_attrname);
313: if (my_vals.COUNT > 0) then
314: new_val := wf_ldap.cs_convert(substr(my_vals(my_vals.FIRST),1,4000));
315: else
316: new_val := null;
317: end if;
318:

Line 370: wf_core.context('WF_LDAP', 'get_ldap_session',

366: p_session := DBMS_LDAP.init(my_host, my_port);
367: retval := dbms_ldap.simple_bind_s(p_session, my_user, my_pwd);
368: exception
369: when others then
370: wf_core.context('WF_LDAP', 'get_ldap_session',
371: 'Error code: '||to_char(sqlcode),
372: 'Error Message: '||substr(sqlerrm, 1, 238));
373: raise;
374: end get_ldap_session;

Line 404: retval := WF_LDAP.search(p_session, usernameAttrBase, results,

400: new_val varchar2(256);
401: l_AttrFound number := 0;
402: begin
403:
404: retval := WF_LDAP.search(p_session, usernameAttrBase, results,
405: DBMS_LDAP.SCOPE_SUBTREE);
406:
407: my_entry := dbms_ldap.first_entry(p_session, results);
408: while (my_entry IS NOT NULL) loop

Line 463: wf_ldap.get_ldap_session(my_session);

459: my_vals DBMS_LDAP.STRING_COLLECTION;
460: found boolean := FALSE;
461: fullbucket boolean := TRUE;
462: begin
463: wf_ldap.get_ldap_session(my_session);
464: my_host := fnd_preference.get('#INTERNAL','LDAP_SYNCH','HOST');
465: my_user_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','USER_DIR');
466: my_log_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','CHANGELOG_DIR');
467:

Line 469: wf_core.context('wf_ldap', 'synch_changes');

465: my_user_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','USER_DIR');
466: my_log_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','CHANGELOG_DIR');
467:
468: if (my_log_base is null OR my_user_base is null) then
469: wf_core.context('wf_ldap', 'synch_changes');
470: wf_core.raise('WF_LDAP_INVALID_PREFS');
471: end if;
472:
473: comp_user_base := lower(replace(my_user_base, ' '));

Line 470: wf_core.raise('WF_LDAP_INVALID_PREFS');

466: my_log_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','CHANGELOG_DIR');
467:
468: if (my_log_base is null OR my_user_base is null) then
469: wf_core.context('wf_ldap', 'synch_changes');
470: wf_core.raise('WF_LDAP_INVALID_PREFS');
471: end if;
472:
473: comp_user_base := lower(replace(my_user_base, ' '));
474:

Line 476: my_change_num := wf_ldap.getlastappliedchangenum(my_session);

472:
473: comp_user_base := lower(replace(my_user_base, ' '));
474:
475: -- Get the last processed changelog# --
476: my_change_num := wf_ldap.getlastappliedchangenum(my_session);
477:
478: dbms_ldap.use_exception := FALSE; -- to survive possible sizelimit excp --
479: while (fullbucket) loop
480: -- fetch any new changelog entries since the last synch --

Line 481: retval := WF_LDAP.search(

477:
478: dbms_ldap.use_exception := FALSE; -- to survive possible sizelimit excp --
479: while (fullbucket) loop
480: -- fetch any new changelog entries since the last synch --
481: retval := WF_LDAP.search(
482: my_session, my_log_base, my_changelogs, DBMS_LDAP.SCOPE_ONELEVEL,
483: '(&(objectclass=changelogentry)(changenumber>='||
484: to_char(to_number(my_change_num)+1)||'))');
485:

Line 489: wf_core.context('wf_ldap', 'synch_changes');

485:
486: if (retval <> dbms_ldap.success AND
487: retval <> dbms_ldap.sizelimit_exceeded)
488: then
489: wf_core.context('wf_ldap', 'synch_changes');
490: wf_core.raise('WF_LDAP_SEARCH_FAIL');
491: elsif (retval = dbms_ldap.sizelimit_exceeded) then
492: fullbucket := TRUE;
493: else

Line 490: wf_core.raise('WF_LDAP_SEARCH_FAIL');

486: if (retval <> dbms_ldap.success AND
487: retval <> dbms_ldap.sizelimit_exceeded)
488: then
489: wf_core.context('wf_ldap', 'synch_changes');
490: wf_core.raise('WF_LDAP_SEARCH_FAIL');
491: elsif (retval = dbms_ldap.sizelimit_exceeded) then
492: fullbucket := TRUE;
493: else
494: fullbucket := FALSE;

Line 532: retval := WF_LDAP.search(my_session, my_user_base, my_user_data,

528:
529: -- dbms_output.put_line('Found potential User: '||my_uname);
530: found := TRUE;
531:
532: retval := WF_LDAP.search(my_session, my_user_base, my_user_data,
533: DBMS_LDAP.SCOPE_SUBTREE,
534: '(&(objectclass=person)(cn='||my_uname||'))');
535:
536: --start bug 3101137

Line 544: wf_ldap.walk_and_load(my_session, my_user_data, my_mode, my_key_att,

540: end if;
541: -- my_key_att := get_name_attr(my_session);
542: --end bug 3101137
543:
544: wf_ldap.walk_and_load(my_session, my_user_data, my_mode, my_key_att,
545: 'USER', my_uname);
546: end if;
547:
548: my_entry := DBMS_LDAP.next_entry(my_session, my_entry);

Line 550: wf_ldap.setLastChangeNumber(my_session, my_change_num);

546: end if;
547:
548: my_entry := DBMS_LDAP.next_entry(my_session, my_entry);
549: end loop; /* entries */
550: wf_ldap.setLastChangeNumber(my_session, my_change_num);
551: end loop; /* changelogs */
552: dbms_ldap.use_exception := TRUE;
553:
554: WF_LDAP.unbind(my_session);

Line 554: WF_LDAP.unbind(my_session);

550: wf_ldap.setLastChangeNumber(my_session, my_change_num);
551: end loop; /* changelogs */
552: dbms_ldap.use_exception := TRUE;
553:
554: WF_LDAP.unbind(my_session);
555: commit;
556: return TRUE;
557: exception
558: when others then

Line 559: wf_core.context('wf_ldap', 'synch_changes',

555: commit;
556: return TRUE;
557: exception
558: when others then
559: wf_core.context('wf_ldap', 'synch_changes',
560: 'Error code: '||to_char(sqlcode),
561: 'Error Message: '||substr(sqlerrm, 1, 238));
562: raise;
563: end synch_changes;

Line 577: wf_ldap.get_ldap_session(my_session);

573: my_key_att varchar2(256);
574: lastclog varchar2(10);
575: origsizelimit varchar2(10) := 'DUNNO';
576: begin
577: wf_ldap.get_ldap_session(my_session);
578:
579: my_user_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','USER_DIR');
580: if (my_user_base is null) then
581: wf_core.context('wf_ldap', 'synch_all');

Line 581: wf_core.context('wf_ldap', 'synch_all');

577: wf_ldap.get_ldap_session(my_session);
578:
579: my_user_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','USER_DIR');
580: if (my_user_base is null) then
581: wf_core.context('wf_ldap', 'synch_all');
582: wf_core.raise('WF_LDAP_INVALID_PREFS');
583: end if;
584:
585: --

Line 582: wf_core.raise('WF_LDAP_INVALID_PREFS');

578:
579: my_user_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','USER_DIR');
580: if (my_user_base is null) then
581: wf_core.context('wf_ldap', 'synch_all');
582: wf_core.raise('WF_LDAP_INVALID_PREFS');
583: end if;
584:
585: --
586: -- Fetch and resize the orclsizelimit. This will allow us to query all

Line 589: origsizelimit := wf_ldap.get_cfg_val(my_session, 'orclsizelimit');

585: --
586: -- Fetch and resize the orclsizelimit. This will allow us to query all
587: -- of the users in one shot. We will reset the value when we're done.
588: --
589: origsizelimit := wf_ldap.get_cfg_val(my_session, 'orclsizelimit');
590: wf_ldap.setsizelimit(my_session, '10000000');
591:
592: --
593: -- set up our OID Change Subscription Object. This guarantees

Line 590: wf_ldap.setsizelimit(my_session, '10000000');

586: -- Fetch and resize the orclsizelimit. This will allow us to query all
587: -- of the users in one shot. We will reset the value when we're done.
588: --
589: origsizelimit := wf_ldap.get_cfg_val(my_session, 'orclsizelimit');
590: wf_ldap.setsizelimit(my_session, '10000000');
591:
592: --
593: -- set up our OID Change Subscription Object. This guarantees
594: -- availability of subsequent changelogs

Line 596: wf_ldap.createSubscription(my_session);

592: --
593: -- set up our OID Change Subscription Object. This guarantees
594: -- availability of subsequent changelogs
595: --
596: wf_ldap.createSubscription(my_session);
597:
598: --
599: -- fetch and process all of the users
600: --

Line 601: retval := WF_LDAP.search(my_session, my_user_base, results,

597:
598: --
599: -- fetch and process all of the users
600: --
601: retval := WF_LDAP.search(my_session, my_user_base, results,
602: DBMS_LDAP.SCOPE_SUBTREE, 'objectclass=person');
603: wf_entity_mgr.flush_cache('*ALL*', null);
604:
605: --start bug 3101137

Line 613: wf_ldap.walk_and_load(my_session, results, 'LOAD', my_key_att, 'USER');

609: end if;
610: -- my_key_att := get_name_attr(my_session);
611: --end bug 3101137
612:
613: wf_ldap.walk_and_load(my_session, results, 'LOAD', my_key_att, 'USER');
614: wf_ldap.setsizelimit(my_session, origsizelimit);
615: wf_ldap.unbind(my_session);
616: return TRUE;
617: exception

Line 614: wf_ldap.setsizelimit(my_session, origsizelimit);

610: -- my_key_att := get_name_attr(my_session);
611: --end bug 3101137
612:
613: wf_ldap.walk_and_load(my_session, results, 'LOAD', my_key_att, 'USER');
614: wf_ldap.setsizelimit(my_session, origsizelimit);
615: wf_ldap.unbind(my_session);
616: return TRUE;
617: exception
618: when others then

Line 615: wf_ldap.unbind(my_session);

611: --end bug 3101137
612:
613: wf_ldap.walk_and_load(my_session, results, 'LOAD', my_key_att, 'USER');
614: wf_ldap.setsizelimit(my_session, origsizelimit);
615: wf_ldap.unbind(my_session);
616: return TRUE;
617: exception
618: when others then
619: wf_core.context('WF_LDAP', 'synch_all',

Line 619: wf_core.context('WF_LDAP', 'synch_all',

615: wf_ldap.unbind(my_session);
616: return TRUE;
617: exception
618: when others then
619: wf_core.context('WF_LDAP', 'synch_all',
620: 'Error code: '||to_char(sqlcode),
621: 'Error Message: '||substr(sqlerrm, 1, 238),
622: substr(sqlerrm, 239, 490));
623: if (origsizelimit <> 'DUNNO') then

Line 624: wf_ldap.setsizelimit(my_session, origsizelimit);

620: 'Error code: '||to_char(sqlcode),
621: 'Error Message: '||substr(sqlerrm, 1, 238),
622: substr(sqlerrm, 239, 490));
623: if (origsizelimit <> 'DUNNO') then
624: wf_ldap.setsizelimit(my_session, origsizelimit);
625: end if;
626: raise;
627: end synch_all;
628: ------------------------------------------------------------------------------

Line 657: dbms_output.put_line('wf_ldap.app_user_change called for <'||

653: if (p_change_source = 'LDAP') then
654: return;
655: end if;
656: /*********************** NOT IMPLEMENTED *****************
657: dbms_output.put_line('wf_ldap.app_user_change called for <'||
658: p_entity_type||':'||p_entity_key_value||'>');
659:
660: wf_ldap.get_ldap_session(my_session);
661:

Line 660: wf_ldap.get_ldap_session(my_session);

656: /*********************** NOT IMPLEMENTED *****************
657: dbms_output.put_line('wf_ldap.app_user_change called for <'||
658: p_entity_type||':'||p_entity_key_value||'>');
659:
660: wf_ldap.get_ldap_session(my_session);
661:
662: -- update LDAP --
663: -- for atts in attribute_data loop need to join with list of
664: -- null; LDAP supported attributes

Line 700: if (wf_ldap.synch_changes() = TRUE) then

696: errstack varchar2(4000);
697: val boolean := FALSE;
698: begin
699: if (p_mode = 'CHANGES') then
700: if (wf_ldap.synch_changes() = TRUE) then
701: -- Return 0 for successful completion --
702: errbuf := '';
703: retcode := '0';
704: else

Line 709: if (wf_ldap.synch_all() = TRUE) then

705: errbuf := 'FAILED';
706: retcode := '2';
707: end if;
708: elsif (p_mode = 'ALL') then
709: if (wf_ldap.synch_all() = TRUE) then
710: -- Return 0 for successful completion --
711: errbuf := '';
712: retcode := '0';
713: else

Line 751: what=>'declare err boolean; begin err := WF_LDAP.synch_changes; end;',

747: l_rundate := to_date(null);
748:
749: DBMS_JOB.Submit(
750: job=>l_job,
751: what=>'declare err boolean; begin err := WF_LDAP.synch_changes; end;',
752: next_date=>nvl(l_rundate, sysdate),
753: interval=>to_date(null)
754: );
755:

Line 782: wf_core.context('WF_LDAP', 'schedule_changes',

778: commit;
779:
780: exception
781: when others then
782: wf_core.context('WF_LDAP', 'schedule_changes',
783: 'Error code: '||to_char(sqlcode),
784: 'Error Message: '||substr(sqlerrm, 1, 238));
785: raise;
786: end schedule_changes;

Line 788: end WF_LDAP;

784: 'Error Message: '||substr(sqlerrm, 1, 238));
785: raise;
786: end schedule_changes;
787: ------------------------------------------------------------------------------
788: end WF_LDAP;