Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby Windows user information and Active Directory querying

Reply
Thread Tools

Ruby Windows user information and Active Directory querying

 
 
fu
Guest
Posts: n/a
 
      07-10-2007
Hi,

Does someone have a few guidelines for the following:
- Get the information about the user currently logged in (at least
username would be good),
- Use the above information to query the Active Directory (can net/
ldap or ruby/ldap be used for this successfully?) for other info,
specifically group membership?

I am on WinXP, but any guidelines might help (e.g. getting username on
*nix or querying LDAP on Mac). An important thing is that, from the
examples I have seen (e.g. a good one with Rails on top -
http://wiki.rubyonrails.org/rails/pa...nticateViaLdap), you
need a few things to query AD - the login name, the password (a no-no
for storing within the script), base dn and other stuff.

All of these can change if you change the access place, so a good way
would be to fetch everything at runtime. I know that all of these can
be found in the information Windows can provide for the current user,
because various vbs scripts can do this (e.g.
http://www.computerperformance.co.uk/ezine/ezine138.htm). Can
something similar be done in Ruby easily (as tons of other stuff can)?

 
Reply With Quote
 
 
 
 
documan@xaop.com
Guest
Posts: n/a
 
      07-10-2007
On 10 jul, 16:45, fu <freeu...@yahoo.com> wrote:
> Hi,
>
> Does someone have a few guidelines for the following:
> - Get the information about the user currently logged in (at least
> username would be good),
> - Use the above information to query the Active Directory (can net/
> ldap or ruby/ldap be used for this successfully?) for other info,
> specifically group membership?
>
> I am on WinXP, but any guidelines might help (e.g. getting username on
> *nix or querying LDAP on Mac). An important thing is that, from the
> examples I have seen (e.g. a good one with Rails on top -http://wiki.rubyonrails.org/rails/pages/HowtoAuthenticateViaLdap), you
> need a few things to query AD - the login name, the password (a no-no
> for storing within the script), base dn and other stuff.
>
> All of these can change if you change the access place, so a good way
> would be to fetch everything at runtime. I know that all of these can
> be found in the information Windows can provide for the current user,
> because various vbs scripts can do this (e.g.http://www.computerperformance.co.uk/ezine/ezine138.htm). Can
> something similar be done in Ruby easily (as tons of other stuff can)?

Hi,

With Apache(and a proxy directive) you will be able to retrieve the
remote user from the client.
(normally the format is like this DOMAIN/USERNAME).

The following section

'Reading REMOTE_USER from mongrel through proxy' on
http://mongrel.rubyforge.org/docs/apache.html explains this.

Regards,
Stijn Van Vreckem

 
Reply With Quote
 
 
 
 
fu
Guest
Posts: n/a
 
      07-11-2007
Stijn, thanks for the info. However, I am not talking about Web
applications here (although I am not excluding them also - if there is
a solution in a Web-application-form which solves what I need, I'd be
glad to look at it). The thing I need is a console-like application
that queries AD and gets the groups for the current user. The
problems: how to get the current user (i.e. not having the user to
type his username), how to authenticate to AD (i.e. without the user
needing to enter his password) and how to access the info from AD.
It's not the login (authentication) that I need, just a query.
Basically, a Ruby version of *nix 'groups' program, just for Windows.

 
Reply With Quote
 
David Mullet
Guest
Posts: n/a
 
      07-11-2007
fu wrote:

> Does someone have a few guidelines for the following:
> - Get the information about the user currently logged in (at least
> username would be good),


Perhaps the ENV object might help here:

ENV['USERNAME']

returns the Windows user's name or Windows login

http://rubyonwindows.blogspot.com/20...nv-object.html

David

http://rubyonwindows.blogspot.com

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.Net querying Active Directory works on one page and not anothe =?Utf-8?B?VHJleSBNaXRjaGVsbA==?= ASP .Net 0 07-19-2005 05:57 PM
Re: Querying Active Directory from ASP.NET Gerry Hickman ASP .Net 6 09-23-2004 10:42 PM
Re: Querying Active Directory from ASP.NET Gerry Hickman ASP .Net 0 09-23-2004 07:57 PM
Problem querying LDAP and/or Active Directory Andrew ASP .Net 1 06-24-2004 02:17 PM
Problem querying LDAP and/or Active Directory Andrew ASP .Net Security 1 06-24-2004 01:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57