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

« back to all changes in this revision

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

Implement an authorization system in the new framework. This breaks the REST
views, but the rest have authorization information now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
class UserSettingsView(XHTMLView):
71
71
    template = 'user-settings.html'
72
72
    appname = 'settings'
 
73
    permission = 'edit'
73
74
 
74
75
    def __init__(self, req, login):
75
76
        self.context = ivle.database.User.get_by_login(req.store, login)
76
77
        if self.context is None:
77
78
            raise NotFound()
78
79
 
79
 
        if req.user is None or (req.user is not self.context and
80
 
                                req.user.rolenm != 'admin'):
81
 
            raise Unauthorized()
82
 
 
83
80
    def populate(self, req, ctx):
84
81
        self.plugin_scripts[Plugin] = ['settings.js']
85
82
        req.scripts_init = ['revert_settings']