mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-02 18:17:11 +09:00
Many per-app API route files lost their plan-29 gating (the `# Bucket:` header + require_app_member/admin_required decorators). Restored so the authz structural sweep + hardening matrix pass again, using the recovered rbac primitives (app_access_tier / require_app_member). - env_vars: can_access_app (read) / can_edit_app (write) across handlers - apps sleep/scale policy, container_status, snapshots, git deployments/webhooks (visibility-scoped), databases raw-docker routes (admin), status-page checks - wordpress: sealed reads + P0 destructive sealed-write + convergence reads + standalone host-ops admin-gated - bucket headers on the already-gated app_volumes/deploy/domains/private_urls/ python/security/templates test_authz_structural_sweep 2, test_api_authz_hardening 27, test_git_webhook_authz 5 — green; 430+ route regression tests still green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
# Bucket: PER-APP read (plan 29 #9). The single-app status read gates on app
|
|
# visibility via require_app_member (viewer+); the all-apps roll-up is a
|
|
# panel-wide authed read.
|
|
"""REST surface for the centralized container status aggregator.
|
|
|
|
Mounted at /api/v1/status (registered in app/__init__.py).
|
|
"""
|
|
|
|
from flask import Blueprint, jsonify
|
|
from flask_jwt_extended import jwt_required
|
|
|
|
from app.middleware.rbac import require_app_member
|
|
from app.services import container_status_service as css
|
|
|
|
container_status_bp = Blueprint('container_status', __name__)
|
|
|
|
|
|
@container_status_bp.route('/app/<int:app_id>', methods=['GET'])
|
|
@require_app_member()
|
|
def app_status(app_id):
|
|
"""Aggregated container status for a single application."""
|
|
return jsonify(css.get_app_status(app_id))
|
|
|
|
|
|
@container_status_bp.route('/apps', methods=['GET'])
|
|
@jwt_required()
|
|
def apps_status():
|
|
"""Lightweight aggregated status for every application.
|
|
|
|
Returns {'statuses': [{app_id, status, total, healthy}, ...]}.
|
|
"""
|
|
return jsonify({'statuses': css.list_app_statuses()})
|