Jun 27 MT-6

This commit is contained in:
2026-06-27 20:21:33 -04:00
parent b46c1a7dd5
commit ee7b0286b2
7 changed files with 21 additions and 0 deletions
+2
View File
@@ -7,6 +7,7 @@ from app.utils.forms import LoginForm, UserForm, ProfileForm, ForgotPasswordForm
from app.utils.decorators import admin_required, supervisor_required, safe_redirect_url
import logging
from app.utils.audit import log_action, ACTION_CREATE, ACTION_UPDATE, ACTION_DELETE, ACTION_LOGIN, ACTION_LOGOUT
from app.tenancy.gates import quota_soft_check
logger = logging.getLogger(__name__)
@@ -144,6 +145,7 @@ def list_users():
@bp.route('/users/new', methods=['GET', 'POST'])
@login_required
@admin_required
@quota_soft_check('users')
def create_user():
form = UserForm()
+5
View File
@@ -8,6 +8,8 @@ from app.utils.forms import FacilityForm, AreaForm
from app.utils.decorators import supervisor_required, admin_required
from app.utils.audit import log_action, ACTION_CREATE, ACTION_UPDATE, ACTION_DELETE
from app.utils.scope import get_customer_scope, get_inspector_scope
from app.tenancy.gates import quota_soft_check
from app.tenancy.gates import feature_required
bp = Blueprint('facilities', __name__, url_prefix='/facilities')
@@ -15,6 +17,8 @@ logger = logging.getLogger(__name__)
@bp.route('/')
@login_required
@supervisor_required
@feature_required('scheduled_reports')
def list_facilities():
if current_user.role == 'customer':
cids = get_customer_scope(current_user) or []
@@ -54,6 +58,7 @@ def list_facilities():
@bp.route('/new', methods=['GET', 'POST'])
@login_required
@supervisor_required
@quota_soft_check('facilities')
def create_facility():
form = FacilityForm()
projects = Project.query.filter_by(active=True).order_by(Project.name).all()
+2
View File
@@ -23,6 +23,7 @@ from app.models.notification import (
EVENT_CUSTOMER_INSPECTION_DONE, EVENT_CUSTOMER_ISSUE_UPDATED,
)
from app.utils.audit import log_action, ACTION_CREATE, ACTION_UPDATE, ACTION_DELETE, ACTION_EXPORT
from app.tenancy.gates import quota_soft_check
from app.utils.scope import get_customer_scope, get_inspector_scope
from sqlalchemy.orm import joinedload
@@ -345,6 +346,7 @@ def index():
@bp.route('/start', methods=['GET', 'POST'])
@login_required
@quota_soft_check('inspections')
def start():
form = StartInspectionForm()
+2
View File
@@ -18,6 +18,7 @@ from app.utils.forms import IssueForm, IssueUpdateForm
from app.utils.decorators import supervisor_required
from app.utils.notifications import notify, notify_customers_for_facility, notify_by_matrix
from app.utils.audit import log_action, ACTION_CREATE, ACTION_UPDATE, ACTION_DELETE, ACTION_EXPORT
from app.tenancy.gates import quota_soft_check
from app.utils.pdf_export import generate_issues_list_pdf
from app.utils.scope import get_customer_scope, get_inspector_scope
from app.utils.sla import sla_status
@@ -665,6 +666,7 @@ def unfollow(issue_id):
@bp.route('/new', methods=['GET', 'POST'])
@login_required
@quota_soft_check('issues')
def create():
if current_user.role not in ('admin', 'director', 'customer'):
abort(403)
+4
View File
@@ -42,6 +42,8 @@ from app.utils.decorators import supervisor_required, admin_required
from app.utils.audit import log_action, ACTION_CREATE, ACTION_UPDATE, ACTION_DELETE
from app.utils.time_utils import now_eastern
from app.utils.sla import sla_status
from app.tenancy.gates import feature_required
logger = logging.getLogger(__name__)
@@ -297,6 +299,7 @@ def _send_report(report: ScheduledReport):
@bp.route('/')
@login_required
@admin_required
@feature_required('scheduled_reports')
def index():
reports = ScheduledReport.query.order_by(ScheduledReport.name).all()
return render_template('scheduled_reports/index.html', reports=reports)
@@ -305,6 +308,7 @@ def index():
@bp.route('/new', methods=['GET', 'POST'])
@login_required
@admin_required
@feature_required('scheduled_reports')
def create():
facilities = Facility.query.filter_by(active=True).order_by(Facility.name).all()