Skip to content
This repository has been archived by the owner on Apr 14, 2018. It is now read-only.

Commit

Permalink
Implemented member listing for orgunits
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Thebo committed Dec 22, 2011
1 parent ad37365 commit b4285fb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/gtool/provision/orgunit.rb
Expand Up @@ -42,6 +42,25 @@ def get(orgunit_name)
end
end

desc "members ORGUNIT", "Get the members of an orgunit"
def members(orgunit_name)
connection = Gtool::Auth.connection(options)
orgunit = GData::Provision::OrgUnit.get(connection, orgunit_name)
fields = GData::Provision::OrgMember.attribute_names
field_names = GData::Provision::OrgMember.attribute_titles

members = orgunit.list_members

rows = members.map do |member|
fields.map {|f| member.send f}
end

rows.unshift field_names
print_table rows
say "#{rows.length - 1} entries.", :cyan
end


def self.banner(task, namespace = true, subcommand = false)
"#{basename} #{task.formatted_usage(self, true, subcommand)}"
end
Expand Down

0 comments on commit b4285fb

Please sign in to comment.