1. David Peace (Powersoft)
  2. PowerBuilder
  3. Tuesday, 17 January 2023 09:04 AM UTC

Hi Everyone

Has anyone used TopWiz LDAP (or other) to access Groups that the Current User is a member of? I'm struggelng to find a suitable reference to construct the relevant query.

Any assistance woudl be welcome.

Thanks

David

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
  1. Thursday, 19 January 2023 06:38 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Kevin,

You can find a lot of such in Chris Pollachs "STD Foundation Classes".

 

 

Here a (shortened) example:

// Connect to ADSI
lole_sysinfo = CREATE oleobject
li_rc = lole_sysinfo.ConnectToNewObject ("ADSystemInfo")		

// Username in LDAP-Format
ls_username = lole_sysinfo.username	
		
// Connect to Active Directory
lole_user = CREATE oleobject
li_rc = lole_user.ConnectToObject ("LDAP://" + ls_username)	

// Group memberships
la_temp = lole_user.memberof
IF NOT IsNull (la_temp) THEN
	// check if it is an array or string
	ll_count = UpperBound (la_temp)
	IF ll_count <> -1 THEN
		// memberof is Array
		ls_groups[] = lole_user.memberof
	ELSE
		// memberof is no Array, (check twice this is a string)
		ls_classname = ClassName (la_temp)
		IF NOT IsNull (ls_classname) THEN
			IF ls_classname = "string" THEN
				ls_groups[1] = lole_user.memberof
			END IF
		END IF
	END IF
END IF
		
Comment
  1. David Peace (Powersoft)
  2. Thursday, 19 January 2023 11:21 AM UTC
Yes, I have a peice of code that can do the query. My problem was more the relevant query syntax. I think I have found something that miht work. If it does I'll share it here.



Thanks
  1. Helpful 1
  1. David Peace (Powersoft)
  2. Friday, 20 January 2023 14:18 PM UTC
Should have looked more closley thisis a great help, thanks. Performance might be an issue so I'll still persue the select option too.

It was slow even on our small domain. although somehow I'm a member of 48 groups!
  1. Helpful
  1. René Ullrich
  2. Monday, 23 January 2023 06:18 AM UTC
I am member of 159 groups! It lasts only 46 ms to get the groups and filter out that one I need for the application!
  1. Helpful
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Wednesday, 18 January 2023 22:39 PM UTC
  2. PowerBuilder
  3. # 1

Hi David.  I've done this years ago.  Let me see if I can find my old code.

Comment
  1. David Peace (Powersoft)
  2. Thursday, 19 January 2023 11:22 AM UTC
I did this years ago too, but that code has long been lost for GDPR reasons. If you do find it I'd be grateful.



Thanks
  1. Helpful
  1. Kevin Ridley
  2. Thursday, 19 January 2023 15:30 PM UTC
Send me your contact info on LinkedIn. I found some test code that I think will help. I just have to clean up all of the client domain info.
  1. Helpful 1
  1. David Peace (Powersoft)
  2. Friday, 20 January 2023 14:06 PM UTC
Details Sent... Thanks
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.