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