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

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/user.py

  • Committer: William Grant
  • Date: 2009-12-08 11:02:18 UTC
  • Revision ID: grantw@unimelb.edu.au-20091208110218-0i51gsmtl11gkxm1
Add a user list -- as yet unlinked.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import formencode.validators
22
22
from genshi.filters import HTMLFormFiller
23
23
 
 
24
from ivle.webapp import ApplicationRoot
24
25
from ivle.webapp.base.rest import JSONRESTView, require_permission
25
26
from ivle.webapp.base.xhtml import XHTMLView
26
27
from ivle.webapp.base.plugins import ViewPlugin, MediaPlugin
27
28
from ivle.webapp.admin.publishing import root_to_user, user_url
 
29
from ivle.database import User
28
30
import ivle.database
29
31
import ivle.date
30
32
import ivle.util
31
33
 
 
34
 
 
35
class UsersView(XHTMLView):
 
36
    """A list of all IVLE users."""
 
37
    template = 'templates/users.html'
 
38
 
 
39
    def authorize(self, req):
 
40
        return req.user.admin
 
41
 
 
42
    def populate(self, req, ctx):
 
43
        ctx['req'] = req
 
44
        ctx['users'] = req.store.find(User).order_by(User.login)
 
45
 
 
46
 
32
47
# List of fields returned as part of the user JSON dictionary
33
48
# (as returned by the get_user action)
34
49
user_fields_list = (
208
223
 
209
224
    forward_routes = (root_to_user,)
210
225
    reverse_routes = (user_url,)
211
 
    views = [(ivle.database.User, '+index', UserEditView),
 
226
    views = [(ApplicationRoot, 'users', UsersView),
 
227
             (ivle.database.User, '+index', UserEditView),
212
228
             (ivle.database.User, '+admin', UserAdminView),
213
229
             (ivle.database.User, '+changepassword', PasswordChangeView),
214
230
             (ivle.database.User, '+resetpassword', PasswordResetView),