X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=blobdiff_plain;f=ipsilon%2Futil%2Fpage.py;fp=ipsilon%2Futil%2Fpage.py;h=aa075dec6c1fa9fe77558df8a20747f878a0fefc;hp=10f10aafcb3414a15b2f91bf83498669cd215b70;hb=73eeae98716c0e25f31cdb2c347c1939525d6ef7;hpb=086bb2e420fbf4f0fe7fd0ec4667737c063f2e0e 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: