Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add group.members method #5

Open
ericfranz opened this issue Aug 30, 2018 · 1 comment
Open

Add group.members method #5

ericfranz opened this issue Aug 30, 2018 · 1 comment

Comments

@ericfranz
Copy link
Contributor

The members method would return an array of OodSupport::User objects

This is the wrapper around doing something like:

Etc.getgrnam('wiagdev').mem.map { |u| { u => Etc.getpwnam(u).gecos } }
=> [{"mrodgers"=>"Morgan Rodgers"}, {"efranz"=>"Eric Franz"}, {"an0047"=>"Eric Franz"}, {"osu10424"=>"Eric Franz"}]

If I want to get usernames and associated gecos names I could instead do this:

OodSupport::Group.new('wiagdev').members
# => [#<OodSupport::User:  username=mrodgers  gecos="Morgan Rodgers">, #<OodSupport::User:  username=efranz  gecos="Eric Franz">, #<OodSupport::User:  username=an0047  gecos="Eric Franz"> 
@ericfranz
Copy link
Contributor Author

For OSC we will need to use ldapsearch for the group names instead of getgrnam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant