Пример #1
0
 def inner(*args, **kwargs):
     if self.auth.autogc:
         with self.auth.db:
             if  self.auth.check:
                 user = self.auth.get_logged_in_user()
     
                 if not user:
                     login_url = url_for('auth.login', next=get_next())
                     return redirect(login_url)
     
                 if not self.check_user_permission(user, perm_key):
                     return abort(403)
     
                 return func(*args, **kwargs)
             else:
                 return func(*args, **kwargs)
     else:
         if  self.auth.check:
             user = self.auth.get_logged_in_user()
 
             if not user:
                 login_url = url_for('auth.login', next=get_next())
                 return redirect(login_url)
 
             if not self.check_user_permission(user, perm_key):
                 return abort(403)
 
             return func(*args, **kwargs)
         else:
             return func(*args, **kwargs)
Пример #2
0
 def inner(*args, **kwargs):
     user = self.get_logged_in_user()
     
     if not user or not test_fn(user):
         login_url = url_for('%s.login' % self.blueprint.name, next=get_next())
         return redirect(login_url)
     return fn(*args, **kwargs)
Пример #3
0
        def inner(*args, **kwargs):
            user = self.auth.get_logged_in_user()

            if not user:
                login_url = url_for('auth.login', next=get_next())
                return redirect(login_url)

            if not self.check_user_permission(user):
                abort(403)

            return func(*args, **kwargs)