Exemplo n.º 1
0
 def refresh(self):
     logger.info("Refresh gradebook")
     self.gradebook.refresh()
     if not self.attempt_state:
         self.attempt_state = {}
     self.groups = fetch_groups(self.session)
     self.autosave()
Exemplo n.º 2
0
def fetch_groups_and_emails(session):
    emails = fetch_users(session)
    groups = fetch_groups(session)
    if emails.keys() != groups.keys():
        print("In Users but not Groups: %r" % (set(emails.keys()) - set(groups.keys())))
        print("In Groups but not Users: %r" % (set(groups.keys()) - set(emails.keys())))
        raise Exception("Different username sets")
    for username in emails.keys():
        groups[username].update(emails[username])
    return groups
Exemplo n.º 3
0
 def refresh_groups(self):
     logger.info("Fetching student group memberships")
     self.groups = fetch_groups(self.session)
     if any(k.startswith('Access the profile') for k in self.groups.keys()):
         raise Exception("fetch_groups returned bad usernames")
Exemplo n.º 4
0
def print_groups(session):
    users = fetch_groups(session)
    for user in users:
        print("%s %s (%s, %s) is in %s" %
              (user['first_name'], user['last_name'],
               user['username'], user['role'], user['groups']))