Commit 699c4520 authored by Janis Streib's avatar Janis Streib 🦉

FIX: use api_login_required

parent a84deeb4
Pipeline #130116 passed with stages
in 6 minutes and 13 seconds
from flask import jsonify, g, current_app, request, abort
from net_suite.views import login_required, get_db_conn
from net_suite.views import api_login_required, get_db_conn
from . import dhcp_leases
from . import dhcp_leases_model
from net_suite import db
......@@ -22,7 +22,7 @@ def close_db(error):
@dhcp_leases.route("/bcds")
@login_required
@api_login_required
def usr_bcds():
dhcpDB = get_dhcpleaseDB()
user = request.environ['beaker.session']['login']
......@@ -32,7 +32,7 @@ def usr_bcds():
@dhcp_leases.route("/bcds/<bcd_name>/active")
@login_required
@api_login_required
def active_leases(bcd_name):
dhcpDB = get_dhcpleaseDB()
user = request.environ['beaker.session']['login']
......
from . import macfinder
from net_suite.model import *
from net_suite import app
from net_suite.views import login_required, get_db_conn, db
from net_suite.views import api_login_required, get_db_conn, db
import requests
from flask import render_template, request, flash, jsonify, redirect, url_for
import datetime
......@@ -35,7 +35,7 @@ class MacFinderJob(DBObject):
@macfinder.route('/create_job', methods=['post'])
@login_required
@api_login_required
def create_job():
if not len(format_mac(request.json['mac'])) == 17:
return jsonify({'success': False, 'error': 'invalid_mac'}), 400
......@@ -70,7 +70,7 @@ def create_job():
@macfinder.route('/jobs')
@login_required
@api_login_required
def jobs():
s = request.environ['beaker.session']
session = requests.Session()
......@@ -80,7 +80,7 @@ def jobs():
key=lambda x: x[1].started))})
@macfinder.route('/poll/<job_id>')
@login_required
@api_login_required
def poll(job_id):
s = request.environ['beaker.session']
session = requests.session()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment