2 # Functions for interacting with the roles table in the database
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2006 The Trustees of Princeton University
10 from PLC.Parameter import Parameter
14 Representation of the roles table in the database.
18 'role_id': Parameter(int, "Role identifier"),
19 'name': Parameter(str, "Role name"),
22 # Role IDs equal to or lower than this number are for use by real
23 # accounts. Other role IDs are used internally.
26 def __init__(self, api):
27 sql = "SELECT * FROM roles" \
28 " WHERE role_id <= %d" % self.role_max
30 for row in api.db.selectall(sql):
31 self[row['role_id']] = row['name']
32 self[row['name']] = row['role_id']