正在显示
8 个修改的文件
包含
36 行增加
和
14 行删除
| 1 | from functools import wraps | 1 | from functools import wraps |
| 2 | -from re import I | ||
| 3 | from authlib.integrations.flask_oauth2 import current_token | 2 | from authlib.integrations.flask_oauth2 import current_token |
| 4 | from flask import abort | 3 | from flask import abort |
| 5 | -from sqlalchemy.sql.elements import Null | ||
| 6 | -from sqlalchemy.sql.functions import mode | ||
| 7 | -from app.util.component.ParameterUtil import ParameterUtil | ||
| 8 | -from app.models import db | ||
| 9 | from app.modules.auth.oauth2 import require_oauth | 4 | from app.modules.auth.oauth2 import require_oauth |
| 10 | 5 | ||
| 11 | # 认证装饰器 | 6 | # 认证装饰器 |
| @@ -16,6 +16,7 @@ from . import service_info | @@ -16,6 +16,7 @@ from . import service_info | ||
| 16 | from . import service_edit | 16 | from . import service_edit |
| 17 | import os | 17 | import os |
| 18 | from flask import send_from_directory | 18 | from flask import send_from_directory |
| 19 | +from app.modules.auth.oauth2 import require_oauth | ||
| 19 | 20 | ||
| 20 | 21 | ||
| 21 | class DataManager(BlueprintApi): | 22 | class DataManager(BlueprintApi): |
| @@ -27,6 +28,7 @@ class DataManager(BlueprintApi): | @@ -27,6 +28,7 @@ class DataManager(BlueprintApi): | ||
| 27 | @staticmethod | 28 | @staticmethod |
| 28 | @bp.route('/Register', methods=['POST']) | 29 | @bp.route('/Register', methods=['POST']) |
| 29 | @swag_from(service_register.Api.api_doc) | 30 | @swag_from(service_register.Api.api_doc) |
| 31 | + @require_oauth("profile") | ||
| 30 | def api_service_register(): | 32 | def api_service_register(): |
| 31 | """ | 33 | """ |
| 32 | 服务注册 | 34 | 服务注册 |
| @@ -45,6 +47,7 @@ class DataManager(BlueprintApi): | @@ -45,6 +47,7 @@ class DataManager(BlueprintApi): | ||
| 45 | @staticmethod | 47 | @staticmethod |
| 46 | @bp.route('/State', methods=['POST']) | 48 | @bp.route('/State', methods=['POST']) |
| 47 | @swag_from(service_state.Api.api_doc) | 49 | @swag_from(service_state.Api.api_doc) |
| 50 | + @require_oauth("profile") | ||
| 48 | def api_service_state(): | 51 | def api_service_state(): |
| 49 | """ | 52 | """ |
| 50 | 修改服务状态 | 53 | 修改服务状态 |
| @@ -82,6 +85,7 @@ class DataManager(BlueprintApi): | @@ -82,6 +85,7 @@ class DataManager(BlueprintApi): | ||
| 82 | @staticmethod | 85 | @staticmethod |
| 83 | @bp.route('/Edit', methods=['POST']) | 86 | @bp.route('/Edit', methods=['POST']) |
| 84 | @swag_from(service_edit.Api.api_doc) | 87 | @swag_from(service_edit.Api.api_doc) |
| 88 | + @require_oauth("profile") | ||
| 85 | def api_service_edit(): | 89 | def api_service_edit(): |
| 86 | """ | 90 | """ |
| 87 | 服务Edit | 91 | 服务Edit |
| @@ -93,6 +97,7 @@ class DataManager(BlueprintApi): | @@ -93,6 +97,7 @@ class DataManager(BlueprintApi): | ||
| 93 | @staticmethod | 97 | @staticmethod |
| 94 | @bp.route('/Delete', methods=['POST']) | 98 | @bp.route('/Delete', methods=['POST']) |
| 95 | @swag_from(service_delete.Api.api_doc) | 99 | @swag_from(service_delete.Api.api_doc) |
| 100 | + @require_oauth("profile") | ||
| 96 | def api_service_delete(): | 101 | def api_service_delete(): |
| 97 | """ | 102 | """ |
| 98 | 服务删除 | 103 | 服务删除 |
| @@ -12,6 +12,8 @@ from . import service_engine_delete | @@ -12,6 +12,8 @@ from . import service_engine_delete | ||
| 12 | from . import service_engine_edit | 12 | from . import service_engine_edit |
| 13 | from . import service_engine_list | 13 | from . import service_engine_list |
| 14 | from . import service_engine_info | 14 | from . import service_engine_info |
| 15 | +import configure | ||
| 16 | +from app.decorators.auth_decorator import auth_decorator | ||
| 15 | 17 | ||
| 16 | class EngineManager(BlueprintApi): | 18 | class EngineManager(BlueprintApi): |
| 17 | 19 | ||
| @@ -19,6 +21,7 @@ class EngineManager(BlueprintApi): | @@ -19,6 +21,7 @@ class EngineManager(BlueprintApi): | ||
| 19 | 21 | ||
| 20 | @staticmethod | 22 | @staticmethod |
| 21 | @bp.route('/Register', methods=['POST']) | 23 | @bp.route('/Register', methods=['POST']) |
| 24 | + @auth_decorator(configure.MonitorPermission) | ||
| 22 | @swag_from(service_engine_register.Api.api_doc) | 25 | @swag_from(service_engine_register.Api.api_doc) |
| 23 | def service_engine_register(): | 26 | def service_engine_register(): |
| 24 | """ | 27 | """ |
| @@ -46,6 +49,7 @@ class EngineManager(BlueprintApi): | @@ -46,6 +49,7 @@ class EngineManager(BlueprintApi): | ||
| 46 | 49 | ||
| 47 | @staticmethod | 50 | @staticmethod |
| 48 | @bp.route('/Edit', methods=['POST']) | 51 | @bp.route('/Edit', methods=['POST']) |
| 52 | + @auth_decorator(configure.MonitorPermission) | ||
| 49 | @swag_from(service_engine_edit.Api.api_doc) | 53 | @swag_from(service_engine_edit.Api.api_doc) |
| 50 | def service_engine_edit(): | 54 | def service_engine_edit(): |
| 51 | """ | 55 | """ |
| @@ -57,6 +61,7 @@ class EngineManager(BlueprintApi): | @@ -57,6 +61,7 @@ class EngineManager(BlueprintApi): | ||
| 57 | @staticmethod | 61 | @staticmethod |
| 58 | @bp.route('/Delete', methods=['POST']) | 62 | @bp.route('/Delete', methods=['POST']) |
| 59 | @swag_from(service_engine_delete.Api.api_doc) | 63 | @swag_from(service_engine_delete.Api.api_doc) |
| 64 | + @auth_decorator(configure.MonitorPermission) | ||
| 60 | def service_engine_delete(): | 65 | def service_engine_delete(): |
| 61 | """ | 66 | """ |
| 62 | Engine Delete | 67 | Engine Delete |
| @@ -7,6 +7,7 @@ from flasgger import swag_from | @@ -7,6 +7,7 @@ from flasgger import swag_from | ||
| 7 | from flask import Blueprint | 7 | from flask import Blueprint |
| 8 | from app.util import BlueprintApi | 8 | from app.util import BlueprintApi |
| 9 | from . import image_service_delete,image_service_register,image_service_edit,image_build_pyramid | 9 | from . import image_service_delete,image_service_register,image_service_edit,image_build_pyramid |
| 10 | +from app.modules.auth.oauth2 import require_oauth | ||
| 10 | 11 | ||
| 11 | class DataManager(BlueprintApi): | 12 | class DataManager(BlueprintApi): |
| 12 | 13 | ||
| @@ -17,6 +18,7 @@ class DataManager(BlueprintApi): | @@ -17,6 +18,7 @@ class DataManager(BlueprintApi): | ||
| 17 | @staticmethod | 18 | @staticmethod |
| 18 | @bp.route('/BuildPyramid', methods=['POST']) | 19 | @bp.route('/BuildPyramid', methods=['POST']) |
| 19 | @swag_from(image_build_pyramid.Api.api_doc) | 20 | @swag_from(image_build_pyramid.Api.api_doc) |
| 21 | + @require_oauth("profile") | ||
| 20 | def api_image_build_pyramid(): | 22 | def api_image_build_pyramid(): |
| 21 | """ | 23 | """ |
| 22 | 创建影像金字塔 | 24 | 创建影像金字塔 |
| @@ -26,6 +28,7 @@ class DataManager(BlueprintApi): | @@ -26,6 +28,7 @@ class DataManager(BlueprintApi): | ||
| 26 | @staticmethod | 28 | @staticmethod |
| 27 | @bp.route('/Register', methods=['POST']) | 29 | @bp.route('/Register', methods=['POST']) |
| 28 | @swag_from(image_service_register.Api.api_doc) | 30 | @swag_from(image_service_register.Api.api_doc) |
| 31 | + @require_oauth("profile") | ||
| 29 | def api_image_service_register(): | 32 | def api_image_service_register(): |
| 30 | """ | 33 | """ |
| 31 | 注册ImageService | 34 | 注册ImageService |
| @@ -35,6 +38,7 @@ class DataManager(BlueprintApi): | @@ -35,6 +38,7 @@ class DataManager(BlueprintApi): | ||
| 35 | @staticmethod | 38 | @staticmethod |
| 36 | @bp.route('/Edit', methods=['POST']) | 39 | @bp.route('/Edit', methods=['POST']) |
| 37 | @swag_from(image_service_edit.Api.api_doc) | 40 | @swag_from(image_service_edit.Api.api_doc) |
| 41 | + @require_oauth("profile") | ||
| 38 | def api_image_service_edit(): | 42 | def api_image_service_edit(): |
| 39 | """ | 43 | """ |
| 40 | 修改ImageService | 44 | 修改ImageService |
| @@ -44,8 +48,9 @@ class DataManager(BlueprintApi): | @@ -44,8 +48,9 @@ class DataManager(BlueprintApi): | ||
| 44 | @staticmethod | 48 | @staticmethod |
| 45 | @bp.route('/Delete', methods=['POST']) | 49 | @bp.route('/Delete', methods=['POST']) |
| 46 | @swag_from(image_service_delete.Api.api_doc) | 50 | @swag_from(image_service_delete.Api.api_doc) |
| 51 | + @require_oauth("profile") | ||
| 47 | def api_image_service_delete(): | 52 | def api_image_service_delete(): |
| 48 | """ | 53 | """ |
| 49 | ImageService Delete | 54 | ImageService Delete |
| 50 | """ | 55 | """ |
| 51 | - return image_service_delete.Api().result | 56 | + return image_service_delete.Api().result |
| 1 | # coding=utf-8 | 1 | # coding=utf-8 |
| 2 | -#author: 4N | 2 | +# author: 4N |
| 3 | #createtime: 2021/9/14 | 3 | #createtime: 2021/9/14 |
| 4 | #email: nheweijun@sina.com | 4 | #email: nheweijun@sina.com |
| 5 | 5 | ||
| 6 | from flasgger import swag_from | 6 | from flasgger import swag_from |
| 7 | from flask import Blueprint | 7 | from flask import Blueprint |
| 8 | from app.util import BlueprintApi | 8 | from app.util import BlueprintApi |
| 9 | -from . import map_service_register,map_service_edit | 9 | +from . import map_service_register, map_service_edit |
| 10 | +from app.modules.auth.oauth2 import require_oauth | ||
| 11 | + | ||
| 10 | 12 | ||
| 11 | class DataManager(BlueprintApi): | 13 | class DataManager(BlueprintApi): |
| 12 | 14 | ||
| 13 | - bp = Blueprint("MapService", __name__, url_prefix="/API/Service/MapService") | 15 | + bp = Blueprint("MapService", __name__, |
| 16 | + url_prefix="/API/Service/MapService") | ||
| 14 | service_type = ["地图服务"] | 17 | service_type = ["地图服务"] |
| 15 | 18 | ||
| 16 | @staticmethod | 19 | @staticmethod |
| 17 | @bp.route('/Register', methods=['POST']) | 20 | @bp.route('/Register', methods=['POST']) |
| 18 | @swag_from(map_service_register.Api.api_doc) | 21 | @swag_from(map_service_register.Api.api_doc) |
| 22 | + @require_oauth("profile") | ||
| 19 | def api_wms_register(): | 23 | def api_wms_register(): |
| 20 | """ | 24 | """ |
| 21 | 注册MapService | 25 | 注册MapService |
| 22 | """ | 26 | """ |
| 23 | return map_service_register.Api().result | 27 | return map_service_register.Api().result |
| 24 | 28 | ||
| 25 | - | ||
| 26 | @staticmethod | 29 | @staticmethod |
| 27 | @bp.route('/Edit', methods=['POST']) | 30 | @bp.route('/Edit', methods=['POST']) |
| 28 | @swag_from(map_service_edit.Api.api_doc) | 31 | @swag_from(map_service_edit.Api.api_doc) |
| 32 | + @require_oauth("profile") | ||
| 29 | def api_wms_edit(): | 33 | def api_wms_edit(): |
| 30 | """ | 34 | """ |
| 31 | 修改MapService | 35 | 修改MapService |
| 32 | """ | 36 | """ |
| 33 | - return map_service_edit.Api().result | ||
| 37 | + return map_service_edit.Api().result |
| @@ -14,6 +14,8 @@ from . import scheme_edit | @@ -14,6 +14,8 @@ from . import scheme_edit | ||
| 14 | from . import scheme_list | 14 | from . import scheme_list |
| 15 | from . import scheme_resolve | 15 | from . import scheme_resolve |
| 16 | from . import scheme_info | 16 | from . import scheme_info |
| 17 | +from app.modules.auth.oauth2 import require_oauth | ||
| 18 | + | ||
| 17 | 19 | ||
| 18 | class SchemeManager(BlueprintApi): | 20 | class SchemeManager(BlueprintApi): |
| 19 | 21 | ||
| @@ -23,6 +25,7 @@ class SchemeManager(BlueprintApi): | @@ -23,6 +25,7 @@ class SchemeManager(BlueprintApi): | ||
| 23 | @staticmethod | 25 | @staticmethod |
| 24 | @bp.route('/Create', methods=['POST']) | 26 | @bp.route('/Create', methods=['POST']) |
| 25 | @swag_from(scheme_create.Api.api_doc) | 27 | @swag_from(scheme_create.Api.api_doc) |
| 28 | + @require_oauth("profile") | ||
| 26 | def api_scheme_create(): | 29 | def api_scheme_create(): |
| 27 | """ | 30 | """ |
| 28 | 创建切片方案 | 31 | 创建切片方案 |
| @@ -33,6 +36,7 @@ class SchemeManager(BlueprintApi): | @@ -33,6 +36,7 @@ class SchemeManager(BlueprintApi): | ||
| 33 | @staticmethod | 36 | @staticmethod |
| 34 | @bp.route('/Delete', methods=['POST']) | 37 | @bp.route('/Delete', methods=['POST']) |
| 35 | @swag_from(scheme_delete.Api.api_doc) | 38 | @swag_from(scheme_delete.Api.api_doc) |
| 39 | + @require_oauth("profile") | ||
| 36 | def api_scheme_delete(): | 40 | def api_scheme_delete(): |
| 37 | """ | 41 | """ |
| 38 | 删除切片方案 | 42 | 删除切片方案 |
| @@ -42,6 +46,7 @@ class SchemeManager(BlueprintApi): | @@ -42,6 +46,7 @@ class SchemeManager(BlueprintApi): | ||
| 42 | @staticmethod | 46 | @staticmethod |
| 43 | @bp.route('/Edit', methods=['POST']) | 47 | @bp.route('/Edit', methods=['POST']) |
| 44 | @swag_from(scheme_edit.Api.api_doc) | 48 | @swag_from(scheme_edit.Api.api_doc) |
| 49 | + @require_oauth("profile") | ||
| 45 | def api_scheme_edit(): | 50 | def api_scheme_edit(): |
| 46 | """ | 51 | """ |
| 47 | 修改切片方案 | 52 | 修改切片方案 |
| @@ -8,7 +8,7 @@ from flasgger import swag_from | @@ -8,7 +8,7 @@ from flasgger import swag_from | ||
| 8 | from flask import Blueprint | 8 | from flask import Blueprint |
| 9 | from app.util import BlueprintApi | 9 | from app.util import BlueprintApi |
| 10 | from . import upload_oview,tile_service_register,tile_service_edit,tile_service_reload | 10 | from . import upload_oview,tile_service_register,tile_service_edit,tile_service_reload |
| 11 | - | 11 | +from app.modules.auth.oauth2 import require_oauth |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | class DataManager(BlueprintApi): | 14 | class DataManager(BlueprintApi): |
| @@ -30,6 +30,7 @@ class DataManager(BlueprintApi): | @@ -30,6 +30,7 @@ class DataManager(BlueprintApi): | ||
| 30 | @staticmethod | 30 | @staticmethod |
| 31 | @bp.route('/Register', methods=['POST']) | 31 | @bp.route('/Register', methods=['POST']) |
| 32 | @swag_from(tile_service_register.Api.api_doc) | 32 | @swag_from(tile_service_register.Api.api_doc) |
| 33 | + @require_oauth("profile") | ||
| 33 | def api_wmts_register(): | 34 | def api_wmts_register(): |
| 34 | """ | 35 | """ |
| 35 | 注册TileService | 36 | 注册TileService |
| @@ -39,6 +40,7 @@ class DataManager(BlueprintApi): | @@ -39,6 +40,7 @@ class DataManager(BlueprintApi): | ||
| 39 | @staticmethod | 40 | @staticmethod |
| 40 | @bp.route('/Edit', methods=['POST']) | 41 | @bp.route('/Edit', methods=['POST']) |
| 41 | @swag_from(tile_service_edit.Api.api_doc) | 42 | @swag_from(tile_service_edit.Api.api_doc) |
| 43 | + @require_oauth("profile") | ||
| 42 | def api_wmts_edit(): | 44 | def api_wmts_edit(): |
| 43 | """ | 45 | """ |
| 44 | 修改TileService | 46 | 修改TileService |
| @@ -13,7 +13,7 @@ VACUATE_DB_URI = SQLALCHEMY_DATABASE_URI | @@ -13,7 +13,7 @@ VACUATE_DB_URI = SQLALCHEMY_DATABASE_URI | ||
| 13 | 13 | ||
| 14 | zookeeper = "172.26.99.168:2181" | 14 | zookeeper = "172.26.99.168:2181" |
| 15 | 15 | ||
| 16 | -#WMTS服务器 | 16 | +# WMTS服务器 |
| 17 | wmts_url = "http://172.26.99.160:6060" | 17 | wmts_url = "http://172.26.99.160:6060" |
| 18 | wms_url = "" | 18 | wms_url = "" |
| 19 | 19 | ||
| @@ -22,10 +22,11 @@ swagger_configure = {"title": "DMapManager"} | @@ -22,10 +22,11 @@ swagger_configure = {"title": "DMapManager"} | ||
| 22 | entry_data_thread = 3 | 22 | entry_data_thread = 3 |
| 23 | scan_module = ["app.modules"] # API所在的模块 | 23 | scan_module = ["app.modules"] # API所在的模块 |
| 24 | SECRET_KEY = b'_5#y2L"F4Q8z\n\xec]/' | 24 | SECRET_KEY = b'_5#y2L"F4Q8z\n\xec]/' |
| 25 | +# 权限 | ||
| 25 | UserPermission = ['admin'] | 26 | UserPermission = ['admin'] |
| 26 | MonitorPermission = ['admin'] | 27 | MonitorPermission = ['admin'] |
| 27 | DataPermission = ['admin', 'dataman'] | 28 | DataPermission = ['admin', 'dataman'] |
| 28 | PublishPermission = ['admin', 'dataman', 'publisher'] | 29 | PublishPermission = ['admin', 'dataman', 'publisher'] |
| 30 | +ServicePermission = ['admin', 'dataman', 'publisher'] | ||
| 29 | 31 | ||
| 30 | log_level = logging.INFO | 32 | log_level = logging.INFO |
| 31 | - |
请
注册
或
登录
后发表评论