How many members are in a FAS group?
Inside the Fedora Ambassadors Project a long time the approved members were tracked by hand. This solution is no longer feasible. The Fedora Infrastructure Team provide a tool named python-fedora to get access to some parts of the Fedora Infrastructure easy. This is a small script to query a FAS group. It's the prototype for your need.
#!/usr/bin/python
import sys, os, getpass
from fedora.accounts.fas2 import AccountSystem
def main():
username = raw_input('Username: ').strip()
password = getpass.getpass('Password: ')
group_name = raw_input('Please enter the FAS group to query: ').strip()
fas = AccountSystem(username=username, password=password)
people = fas.group_by_name(group_name)
long_name = people[u'display_name']
short_name = people[u'name']
people = people[u'approved_roles']
# Display
print "\n----------------------------------------------------"
print "Group: " + long_name + " (" + short_name + ")\n"
print "\nNumber of members: ",len(people)
print "Human Name \t\tUser ID"
print "----------------------------------------------------"
for human in people:
person = fas.person_by_id(human['person_id'])
human_name = person[u'human_name']
user_name = person[u'username']
print human_name + "\t\t" + user_name
if __name__ == "__main__":
sys.exit(main())
At the moment is the target to generate the wiki code for the Ambassadors Membership Verification page. Maybe it will end-up in a complete integration....who knows...



1 Kommentar:
You know, it would be trivial to include a count in the fas itself. Let me know how badly you need it ;)
Kommentar veröffentlichen