def requireSuperJSON(func, *args, **kwargs): 'Give error message if the user is not a superuser' # If the user is not a superuser, if not h.isPersonSuper(): return dict(isOk=0, message='Access denied') # Execute return func(*args, **kwargs)
def requireSuper(func, *args, **kwargs): 'Redirect to homepage if the user is not a superuser' # If the user is not a superuser, if not h.isPersonSuper(): return redirect(url('person_login', url='/')) # Execute return func(*args, **kwargs)