feat: 全模块公司隔离 + crossDomain权限码动态跨域控制
- get_current_company_filter: 新增_has_cross_domain_permission, 权限码替代硬编码 - 补全11个Service的get_current_company_filter调用(semi/product/service/outbound/bom/trans/scrap/summary) - base/search修复: search_material此前无隔离, 已补全 - get_current_company_filter兜底: JWT缺company_name时返回__NO_COMPANY__防止放行 - permission.py: _get_operator_company补全返回值, 修复权限页保存逻辑 - 新增crossDomain迁移脚本, element_type=element挂system_mgmt下
This commit is contained in:
@ -8,11 +8,12 @@ permission_bp = Blueprint('permission', __name__)
|
||||
|
||||
|
||||
def _get_operator_company():
|
||||
"""从 JWT 获取当前操作者公司(None=超管)"""
|
||||
"""从 JWT 获取当前操作者公司(None=超管,具体值=该角色所属公司)"""
|
||||
claims = get_jwt()
|
||||
role = claims.get('role', '')
|
||||
if role and role.upper() == 'SUPER_ADMIN':
|
||||
return None # 超管不限制公司
|
||||
return claims.get('company_name', '')
|
||||
|
||||
|
||||
def _has_system_permission(role_code):
|
||||
@ -24,7 +25,6 @@ def _has_system_permission(role_code):
|
||||
return 'system_permission' in all_perms
|
||||
except Exception:
|
||||
return False
|
||||
return claims.get('company_name', '')
|
||||
|
||||
|
||||
@permission_bp.route('/tree', methods=['GET'])
|
||||
|
||||
Reference in New Issue
Block a user