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
7 # $Id: Roles.py,v 1.1 2006/09/06 15:36:07 mlhuang Exp $
12 Representation of the roles table in the database.
15 # Role IDs equal to or lower than this number are for use by real
16 # accounts. Other role IDs are used internally.
19 def __init__(self, api):
20 sql = "SELECT * FROM roles" \
21 " WHERE role_id <= %d" % self.role_max
23 for row in api.db.selectall(sql):
24 self[row['role_id']] = row['name']
25 self[row['name']] = row['role_id']