~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to lib/common/caps.py

  • Committer: mattgiuca
  • Date: 2008-02-19 00:54:28 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:500
db: get_user and get_users now return User objects instead of dictionaries.
    This is the major part of replacing dicts with User objects, as it
    propagates upwards.

Propagated User objects up through the following modules:
    listusers.py, dispatch.login, authenticate, userservice, forumutil
All of these now treat users as an object rather than a dict.

To save on the size of the changes so far, login still individually copies
fields over to the session (so the session does not yet store a user object;
that is the second part of this refactor).

WOO!! Revision 500 :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    def __repr__(self):
66
66
        return "Role.%s" % Role._roles[self._role].upper()
67
67
    def __cmp__(self, other):
68
 
        return self._role - other._role
 
68
        return cmp(self._role, other._role)
69
69
    def __hash__(self):
70
70
        return hash(self._role)
71
71
 
91
91
    type.__setattr__(Role, Role._roles[i].upper(), Role(i))
92
92
    Role._roles_to_int[Role._roles[i]] = i
93
93
 
 
94
### CAPABILITIES LISTING ###
 
95
 
94
96
# Set of capabilities, which maps global variables onto Roles.
95
97
# This provides the minimum role level required in order to perform the given
96
98
# capability.
97
99
# (So any role above the role specified can perform this cap).
98
100
 
 
101
# Create users (the users are able to log in and accept)
99
102
CAP_CREATEUSER = Role.ADMIN
 
103
# Get details about users
 
104
CAP_GETUSER = Role.LECTURER
 
105
# Change all details of a user
 
106
CAP_UPDATEUSER = Role.ADMIN
 
107
 
 
108
# Posting to subject blog for subjects you are teaching
 
109
CAP_BLOGPOST = Role.TUTOR
 
110
 
 
111
# Reading submissions (both tutorial and assignment) of student for whom you
 
112
# are a marker
 
113
CAP_READ_MY_STUDENTS_SUBMISSION = Role.TUTOR
 
114
# Reading all students' submissions (in subjects you have this cap for)
 
115
CAP_READ_SUBMISSION = Role.LECTURER
 
116
 
 
117
# Reading marks for your own students
 
118
CAP_READ_MY_STUDENTS_MARKS = Role.TUTOR
 
119
# Adding marks info for your own students (can't delete or edit, only add)
 
120
# (You can overwrite marks but old ones will be logged).
 
121
CAP_WRITE_MY_STUDENTS_MARKS = Role.TUTOR
 
122
# Reading marks for all students
 
123
CAP_READ_MARKS = Role.LECTURER
 
124
# Adding marks info for all students
 
125
CAP_WRITE_MARKS = Role.LECTURER
 
126
 
 
127
# Reading any student's svn (in subjects you have this cap for)
 
128
CAP_READ_SVN = Role.LECTURER
 
129
# Writing to any student's svn
 
130
CAP_WRITE_SVN = Role.LECTURER
 
131
 
 
132
# "SuperUser" role - certain users are granted "sudo" powers on the Unix
 
133
# system, giving them abilities beyond what is granted here in IVLE.