diff options
author | Simo Sorce <simo@redhat.com> | 2014-03-24 17:06:05 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2014-03-24 17:07:38 -0400 |
commit | 667901638f082e05b4ac61a14f4ddc07ec987742 (patch) | |
tree | 569b303a3ba0c2fcd8ceb32265c335b5aec808b0 /ipsilon/util/page.py | |
parent | 1e137be617dba1d0f3f85d594f5625926d3f46e9 (diff) | |
download | ipsilon-667901638f082e05b4ac61a14f4ddc07ec987742.tar.gz ipsilon-667901638f082e05b4ac61a14f4ddc07ec987742.tar.xz ipsilon-667901638f082e05b4ac61a14f4ddc07ec987742.zip |
Move admin_protect to a more generic module
Signed-off-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'ipsilon/util/page.py')
-rwxr-xr-x | ipsilon/util/page.py | 11 |
1 files changed, 11 insertions, 0 deletions
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() |