diff options
author | Simo Sorce <simo@redhat.com> | 2014-10-03 13:24:37 -0400 |
---|---|---|
committer | Patrick Uiterwijk <puiterwijk@redhat.com> | 2014-10-06 20:55:19 +0200 |
commit | 73eeae98716c0e25f31cdb2c347c1939525d6ef7 (patch) | |
tree | 30b781a4c03dc5f2819256fd0ec7f37ac08e3833 /ipsilon/util | |
parent | 086bb2e420fbf4f0fe7fd0ec4667737c063f2e0e (diff) | |
download | ipsilon-73eeae98716c0e25f31cdb2c347c1939525d6ef7.tar.gz ipsilon-73eeae98716c0e25f31cdb2c347c1939525d6ef7.tar.xz ipsilon-73eeae98716c0e25f31cdb2c347c1939525d6ef7.zip |
Redirect anonymous users away
It makes no sense to let anonymous users interact with the admin
pages so tighten up access and redirect away users that have no
rights.
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Diffstat (limited to 'ipsilon/util')
-rwxr-xr-x | ipsilon/util/page.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ipsilon/util/page.py b/ipsilon/util/page.py index 10f10aa..aa075de 100755 --- a/ipsilon/util/page.py +++ b/ipsilon/util/page.py @@ -34,6 +34,16 @@ def admin_protect(fn): return check +def auth_protect(fn): + def check(self, *args, **kwargs): + if UserSession().get_user().is_anonymous: + raise cherrypy.HTTPRedirect(self.basepath) + else: + return fn(self, *args, **kwargs) + + return check + + class Page(Log): def __init__(self, site, form=False): if 'template_env' not in site: |