diff options
-rwxr-xr-x | ipsilon/admin/common.py | 13 | ||||
-rwxr-xr-x | ipsilon/util/page.py | 11 |
2 files changed, 12 insertions, 12 deletions
diff --git a/ipsilon/admin/common.py b/ipsilon/admin/common.py index 10171dc..2897237 100755 --- a/ipsilon/admin/common.py +++ b/ipsilon/admin/common.py @@ -19,23 +19,12 @@ from ipsilon.util.data import Store from ipsilon.util.page import Page -from ipsilon.util.user import UserSession +from ipsilon.util.page import admin_protect from ipsilon.util.plugin import PluginObject import cherrypy from ipsilon.login.common import FACILITY as LOGIN_FACILITY -def admin_protect(fn): - - def check(*args, **kwargs): - if UserSession().get_user().is_admin: - return fn(*args, **kwargs) - - raise cherrypy.HTTPError(403) - - return check - - class LoginPluginPage(Page): def __init__(self, obj, site, baseurl): diff --git a/ipsilon/util/page.py b/ipsilon/util/page.py index 56a6463..7dda1d7 100755 --- a/ipsilon/util/page.py +++ b/ipsilon/util/page.py @@ -21,6 +21,17 @@ from ipsilon.util.user import UserSession import cherrypy +def admin_protect(fn): + + def check(*args, **kwargs): + if UserSession().get_user().is_admin: + return fn(*args, **kwargs) + + raise cherrypy.HTTPError(403) + + return check + + def protect(): UserSession().remote_login() |