Show More
@@ -28,7 +28,7 b' from pylons_app.lib.base import BaseCont' | |||
|
28 | 28 | from pylons_app.model import meta |
|
29 | 29 | from pylons_app.model.db import UserLog |
|
30 | 30 | from webhelpers.paginate import Page |
|
31 | from pylons_app.lib.auth import LoginRequired | |
|
31 | from pylons_app.lib.auth import LoginRequired, HasPermissionAllDecorator | |
|
32 | 32 | |
|
33 | 33 | log = logging.getLogger(__name__) |
|
34 | 34 | |
@@ -36,11 +36,9 b' class AdminController(BaseController):' | |||
|
36 | 36 | |
|
37 | 37 | @LoginRequired() |
|
38 | 38 | def __before__(self): |
|
39 | user = session['hg_app_user'] | |
|
40 | c.admin_user = user.is_admin | |
|
41 | c.admin_username = user.username | |
|
42 | 39 | super(AdminController, self).__before__() |
|
43 |
|
|
|
40 | ||
|
41 | @HasPermissionAllDecorator('hg.admin') | |
|
44 | 42 | def index(self): |
|
45 | 43 | sa = meta.Session |
|
46 | 44 |
@@ -22,13 +22,19 b' Created on April 27, 2010' | |||
|
22 | 22 | permissions controller for pylons |
|
23 | 23 | @author: marcink |
|
24 | 24 | """ |
|
25 | from formencode import htmlfill | |
|
26 | from pylons import request, session, tmpl_context as c, url | |
|
27 | from pylons.controllers.util import abort, redirect | |
|
28 | from pylons.i18n.translation import _ | |
|
29 | from pylons_app.lib import helpers as h | |
|
30 | from pylons_app.lib.auth import LoginRequired, HasPermissionAllDecorator | |
|
31 | from pylons_app.lib.base import BaseController, render | |
|
32 | from pylons_app.model.db import User, UserLog | |
|
33 | from pylons_app.model.forms import UserForm | |
|
34 | from pylons_app.model.user_model import UserModel | |
|
35 | import formencode | |
|
25 | 36 | import logging |
|
26 | 37 | |
|
27 | from pylons import request, response, session, tmpl_context as c, url | |
|
28 | from pylons.controllers.util import abort, redirect | |
|
29 | ||
|
30 | from pylons_app.lib.base import BaseController, render | |
|
31 | ||
|
32 | 38 | log = logging.getLogger(__name__) |
|
33 | 39 | |
|
34 | 40 | class PermissionsController(BaseController): |
@@ -36,7 +42,14 b' class PermissionsController(BaseControll' | |||
|
36 | 42 | # To properly map this controller, ensure your config/routing.py |
|
37 | 43 | # file has a resource setup: |
|
38 | 44 | # map.resource('permission', 'permissions') |
|
39 | ||
|
45 | ||
|
46 | @LoginRequired() | |
|
47 | @HasPermissionAllDecorator('hg.admin') | |
|
48 | def __before__(self): | |
|
49 | c.admin_user = session.get('admin_user') | |
|
50 | c.admin_username = session.get('admin_username') | |
|
51 | super(PermissionsController, self).__before__() | |
|
52 | ||
|
40 | 53 | def index(self, format='html'): |
|
41 | 54 | """GET /permissions: All items in the collection""" |
|
42 | 55 | # url('permissions') |
@@ -22,18 +22,18 b' Created on April 4, 2010' | |||
|
22 | 22 | users controller for pylons |
|
23 | 23 | @author: marcink |
|
24 | 24 | """ |
|
25 | import logging | |
|
25 | from formencode import htmlfill | |
|
26 | 26 | from pylons import request, session, tmpl_context as c, url |
|
27 | 27 | from pylons.controllers.util import abort, redirect |
|
28 | 28 | from pylons.i18n.translation import _ |
|
29 | 29 | from pylons_app.lib import helpers as h |
|
30 | from pylons_app.lib.auth import LoginRequired | |
|
30 | from pylons_app.lib.auth import LoginRequired, HasPermissionAllDecorator | |
|
31 | 31 | from pylons_app.lib.base import BaseController, render |
|
32 | 32 | from pylons_app.model.db import User, UserLog |
|
33 | 33 | from pylons_app.model.forms import UserForm |
|
34 | 34 | from pylons_app.model.user_model import UserModel |
|
35 | 35 | import formencode |
|
36 | from formencode import htmlfill | |
|
36 | import logging | |
|
37 | 37 | |
|
38 | 38 | log = logging.getLogger(__name__) |
|
39 | 39 | |
@@ -42,7 +42,9 b' class UsersController(BaseController):' | |||
|
42 | 42 | # To properly map this controller, ensure your config/routing.py |
|
43 | 43 | # file has a resource setup: |
|
44 | 44 | # map.resource('user', 'users') |
|
45 | ||
|
45 | 46 | @LoginRequired() |
|
47 | @HasPermissionAllDecorator('hg.admin') | |
|
46 | 48 | def __before__(self): |
|
47 | 49 | c.admin_user = session.get('admin_user') |
|
48 | 50 | c.admin_username = session.get('admin_username') |
@@ -110,7 +112,7 b' class UsersController(BaseController):' | |||
|
110 | 112 | % form_result['username'], category='error') |
|
111 | 113 | |
|
112 | 114 | return redirect(url('users')) |
|
113 | ||
|
115 | ||
|
114 | 116 | def delete(self, id): |
|
115 | 117 | """DELETE /users/id: Delete an existing item""" |
|
116 | 118 | # Forms posted to this method should contain a hidden field: |
General Comments 0
You need to be logged in to leave comments.
Login now