feat: add RBAC controls for outbound selection module

Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
dxc
2026-02-27 13:45:49 +08:00
parent f79fb53b17
commit af41eb1803
2 changed files with 20 additions and 11 deletions

View File

@ -1,6 +1,7 @@
from flask import Blueprint, request, jsonify
from app.services.outbound_service import OutboundService
from flask_jwt_extended import jwt_required, get_jwt_identity
from app.utils.decorators import permission_required
import traceback
outbound_bp = Blueprint('outbound', __name__, url_prefix='/outbound')
@ -12,6 +13,7 @@ outbound_bp = Blueprint('outbound', __name__, url_prefix='/outbound')
# --------------------------------------------------------
@outbound_bp.route('/scan', methods=['GET'])
@jwt_required()
@permission_required('outbound_selection')
def scan_barcode():
barcode = request.args.get('barcode')
if not barcode:
@ -44,6 +46,7 @@ def scan_barcode():
# --------------------------------------------------------
@outbound_bp.route('', methods=['POST'])
@jwt_required()
@permission_required('outbound_selection:operation')
def create_outbound():
data = request.get_json()
if not data:
@ -89,6 +92,7 @@ def create_outbound():
# --------------------------------------------------------
@outbound_bp.route('', methods=['GET'])
@jwt_required()
@permission_required('outbound_selection')
def get_outbound_list():
try:
page = int(request.args.get('page', 1))
@ -106,4 +110,4 @@ def get_outbound_list():
})
except Exception as e:
traceback.print_exc()
return jsonify({'code': 500, 'msg': str(e)}), 500
return jsonify({'code': 500, 'msg': str(e)}), 500