Example #1
0
def index():
    if current_user.is_authenticated:
        if current_user.allowed(2):
            return redirect(url_for('devices.home'))
        elif current_user.allowed(1):
            return redirect(url_for('users.pay'))
    else:
        return render_template(
            'index.html',
            page_title="CardiacBook - The Ultimate ICD Assistant")
Example #2
0
 def decorated_function(*args, **kwargs):
     if permission and not current_user.allowed(permission):
         if redirect:
             abort(403)
         else:
             return jsonify(False)
     return f(*args, **kwargs)
Example #3
0
 def decorated_function(*args, **kwargs):
     if not current_user.allowed(access_level):
         return redirect(
             url_for(
                 'main_menu',
                 message="You do not have access to that page. Sorry!"))
     return f(*args, **kwargs)
Example #4
0
 def decorated_function(*args, **kwargs):
     if current_user.is_anonymous:
         return redirect(url_for('users.login'))
     if not current_user.allowed(access_level):
         return redirect(
             url_for(
                 'core.index',
                 message="You do not have access to that page. Sorry!"))
     return f(*args, **kwargs)
Example #5
0
        def decorated_function(*args, **kwargs):
            if not current_user.is_authenticated:  #the user is not logged in
                return redirect(url_for('login'))

            #user = User.query.filter_by(id=current_user.id).first()

            if not current_user.allowed(access_level):
                flash('You do not have access to this resource.', 'danger')
                return redirect(url_for('index'))
            return f(*args, **kwargs)
Example #6
0
        def decorated_function(*args, **kwargs):
            if not current_user.is_authenticated:
                flash('Please login to view this site', 'danger')
                return redirect(url_for('users.login'))

            elif not current_user.allowed(access_level):
                flash(
                    'You do not have the right priviledges to access this page.',
                    'danger')
                return redirect(url_for('main.about'))
            return f(*args, **kwargs)
Example #7
0
def pay():
    if current_user.allowed(2):
        return redirect(url_for('devices.home'))
    else:
        now = datetime.datetime.now()
        week_now = now + datetime.timedelta(days=7)
        plan = current_user.plan
        if plan == 'Pro':
            amount = 2499
        elif plan == 'Platinum':
            amount = 9999
        else:
            amount = 999
        return render_template('Users/pay.html',
                               key=stripe_keys['publishable_key'],
                               plan=plan,
                               amount=amount,
                               trial=week_now.strftime("%Y-%m-%d"))
Example #8
0
 def is_accessible(self):
     return current_user.is_authenticated and current_user.allowed('Building Director')
 def decorated_function(*args, **kwargs):
     if not current_user.is_authenticated:
         return redirect(url_for('login'))
     if not current_user.allowed(access_level):
         return redirect(url_for('index'))
     return f(*args, **kwargs)
Example #10
0
 def decorated_function(*args, **kwargs):
     if not current_user.allowed(access_level):
         return render_template('errors/403.html')
     return f(*args, **kwargs)
Example #11
0
 def decorated_function(*args, **kwargs):
     if not current_user.is_authenticated:
         return redirect(url_for('users.login'))
     if not current_user.allowed(roles):
         abort(403)
     return f(*args, **kwargs)