Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use the MEMBER_OF2 function in Oracle Apex using the APEX_LDAP package

User_QSBJ6Aug 13 2021

Since I linked our Microsoft Active Directory with my Apex application using LDAP, I am trying to retrieve the groups for the user currently logged in from the Active Directory.
Here's the documentation: https://docs.oracle.com/cd/E59726_01/doc.50/e39149/apex_ldap.htm#AEAPI242
Here's my code of my dynamic action on page load, I am trying to retrieve a VARCHAR2 of all the groups the current user is part of, and to put it in a display-only field :

BEGIN
    :P1_NEW := APEX_LDAP.MEMBER_OF2(
        p_username => v('APP_USER'),
        p_pass => 'mypassword',
        p_auth_base => 'DOMAIN\',
        p_host => 'XX.X.XXX.XX',
        p_port => 389);
END;

But when I load my page, this error occurs
Ajax call returned server error ORA-31202: DBMS_LDAP : Erreur client/serveur LDAP : Invalid credentials. 80090308: LdapErr: DSID-0C090439, comment: AcceptSecurityContext error, data 52e, v4563 for Execute PL/SQL Code.
What's wrong in my code ? Thank you in advance for your help.
Thomas

Comments

dmcghan
Answer
990870,

Please set up a demo of your problem on apex.oracle.com. Provide us with developer credentials and steps to reproduce.

Regards,
Dan

blog: http://DanielMcghan.us/
work: http://SkillBuilders.com/APEX/
Marked as Answer by Srinivash · Sep 27 2020
Howard (... in Training)
Hi 990870,

A few preliminaries. Could we get you to change your handle from a number to a name? (I'm Howard.) Also, If you haven't read the useful advice in https://forums.oracle.com/forums/ann.jspa?annID=1324 , take a look.

A demo is a great idea.

A few thoughts. [I'm only a newbie.] In what I've done, APEX seemingly constructs/makes a page (or region) visible and then updates it. So, one sees the current value and it changes to the the new value before our very eyes. A feature? It could be a useful one. But what we want is to have the page cleared before it's made visible so we don't see the former image. Right?

So, is there a way to change the page before it displays? Can we do this: Hide the region, update the region, show the updated region? Not sure.

But if it were, say, a single button -- maybe that can be done with some javascript. You already have a DA.

One could add a new action "Execute Javascript Code" and in Settings have the following Code:
[This was someone's example to show or hide a button based on a count in P9_COUNT.]
var my_cnt = $v('P9_COUNT');
if( my_cnt > 0 )
{
   $('#MY_SUB_BTN').show();
}
else
{
   $('#MY_SUB_BTN').hide();
};
So one would have three actions on the same DA. The first would hide the region, the second would hide the button and the third would show the update region without the button. Maybe it could work.

I'll see if there's any time to experiment with this today.

Regards,
Howard
Srinivash
Hi Dan,
I have made a demo app at apex.oracle.com with the following credentials
workspace-srinivash
user-srinivashvarma@yahoo.com
password-twilight


you can go to the only app present there named as 'practice dynamic action jan'.When you run the page you will get an select list item which you when change displays the report according to the empno selected.But before it shows the report it also shows no data found for few second which I dont required.Also when you select a empno and then NULL then again any other empno it will show the previous report first.
And my restriction is I cant submit page.It has to be done through dynamic action

Thanks in advance
Srinivash
Srinivash
Hi Howard,
Thanks for the suggestion I did change my handle and I think the idea you are giving will require me to page reload which I cant do in my page as it will completely change other things because of the other on load process.Please go through the demo I provided and help me.

Thanks in advance
Srinivash
HarryF
My approach is to have a conditional on the region:

:SELECT_LIST is not null

If the page action when value changed for the select list is submit page it will refresh the page and show the region.
Tom Petrus
Srinivash,

First of all, the built-in refresh has been made so that no screen-flicker-effect would occur: the refreshed region is a bit of html requested from the server, dumped in a container, and then replaces the original html (a report in this case).
What you want, from what I understand, is to hide the region when it is refreshed.

Looking at your app, you probably want to keep the region hidden during the PLSQL code and the refresh action. I just put the "Hide" effect you had under the "False" actions as first action in the "True" actions.
Doesn't that achieve what you want? I'm not sure why you put a false action under a change event. A change will always be a true action, it will only fire when there is an actual change.
dmcghan
Srinivash,

I looks like the refresh action was move to asynchronous Ajax (kinda funny, I know) and that was the problem. However, if you leverage the apexafterrefresh event that is triggered on the region after the refresh is complete, then it's an easy workaround.

I updated your demo to do this via a new dynamic action. Is that working as you wanted it to?

Regards,
Dan

blog: http://DanielMcghan.us/
work: http://SkillBuilders.com/APEX/
Srinivash
Hi Dan,
Thanks a lot Its working as required I wanted when the select list is chosen as NULL then the region should hide and I added that as a false condition and now its totally as required.So after refresh action which I was missing .Once again thanks for the help Dan.

Thanks
Srinivash
Srinivash
Hi Harry,
Actually i had the limitation of not making the page reload so i cant make the report region as conditional and also the refresh action only works on the report query it doesn't refresh or check the condition there again so I was not able to apply this approach.Thanks for your help.

Thanks
Srinivash
Srinivash
Hi Tom,
I needed that false action to hide the region when the select list is changed to NULL and when not NULL to refresh and show the region.Thanks for your suggestion that hide thing is the correct approach you are correct.

Thanks
Srinivash
1 - 10

Post Details

Added on Aug 13 2021
0 comments
260 views