-
Notifications
You must be signed in to change notification settings - Fork 15
Reference
Roger Chen edited this page Jan 15, 2016
·
10 revisions
Generate a list of class logins
import string
import itertools
def generate_login_list(num, minimum_length=2):
"""
Generates a list of class logins, starting with 2-letter logins. Does not include logins that
start with 't' or 'r'.
>>> generate_login_list(3)
['aa', 'ab', 'ac']
"""
accounts = []
alph = string.lowercase
non_reserved = lambda account: account[0] not in ('t', 'r')
for length in itertools.count(minimum_length):
accounts.extend(map(''.join, filter(non_reserved, itertools.product(alph, repeat=length))))
if len(accounts) >= num:
return accounts[:num]There is a super column in the users table, to allow you to distinguish staff accounts from student accounts. A non-zero value of super has the following effects:
- Shows "(Staff)" next to the user's name in the TA interface
- Excludes grades from statistics (ranking, histogram, etc)
Student accounts should have a super value of 0.
Here is an example query that could be used to create a staff account:
INSERT INTO users (id, name, sid, login, github, email, super, grouplimit, photo) VALUES (16200000, "Peter Perfect", "16200000", "tb", "peterperfect162", "cs162@eecs.berkeley.edu", 1, 0, NULL);