1

Im writing a program for my school in which users have to enter a code given to them by a teacher to access the internet.

My Question is how can i from delphi check if the current user is part of the teacher security group in active directory or not before it runs my code generating program.

Thanks Erik

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
Erik
  • 15
  • 1
  • 6
  • dup of http://stackoverflow.com/questions/337300/how-do-integrate-delphi-with-active-directory –  Jan 07 '10 at 22:53

2 Answers2

3

Using winapi functions.

But have a look at Jedi JWSCL, that is an underdivision of Jedi APIlib that are building a security related library for Delphi.

http://blog.delphi-jedi.net/category/downloads/jwscl-downloads/

Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89
  • 1
    Sorry, User and Groups Management is currently not supported by JWSCL. However, there are plans and a unit skeleton for this feature. Only missing thing is time or volunteer(s). – ChristianWimmer Jan 08 '10 at 19:36
  • 1
    Just finished this article for you: http://blog.delphi-jedi.net/2010/02/22/jwscl-features-overview/ – ChristianWimmer Feb 22 '10 at 12:47
0

See the answers in this post

Community
  • 1
  • 1
  • Ive had a look at this but i am struggling on working out how to use the unit there. If i can papulate a stringgrid or listbox with a users groups i can easily work it out from there. Or can i only search for a predefined groupname? – Erik Jan 08 '10 at 02:16
  • Using the code example I posed in that thread, just call TADSI.GetUser and inspect the returned Groups value. Or call TADSI.Authenticate(Domain, UserName, Group: string) and pass the name of the Group for "teacher security". –  Jan 10 '10 at 22:03
  • Thanks for your help. ive manageds to whittle through some of the errors i was getting and im now stuck with undeclaired identifer group & domain. Adsi & ActiveDs_TLB & adshlp have been added to the units. label1.Caption := TADSI.Authenticate(Domain, UserName, Group: string) ; also how do i pass it the group name? do i replace string? Thanks – Erik Jan 11 '10 at 22:45
  • Firstly, TASDI.Authenticate returns a boolean so assigning that to a Caption property wont work. Secondly, you need to CREATE the TADSI object, assign it to a variable and then call the methods, e.g. var ActiveDir: TADSI; Authenticated: boolean; begin ActiveDir:=TADSI.Create(Self); Authenticated:=ActiveDir.Authenticate('DomainName','UserName','GroupName); ActiveDir.Free; –  Jan 12 '10 at 00:08
  • Hi gerard. thanks for your patiance. And thank you verry much. the program is now working perfectally. i had to take out activedir.free as it was spitting out read errors, but now it works perfectally fine. Once again thanks :-) – Erik Jan 12 '10 at 13:03
  • How about tagging this post as Answered? –  Jan 12 '10 at 22:09