正在显示
19 个修改的文件
包含
36 行增加
和
36 行删除
@@ -23,7 +23,7 @@ class Api(ApiTemplate): | @@ -23,7 +23,7 @@ class Api(ApiTemplate): | ||
23 | 23 | ||
24 | database = db.session.query(Database).filter_by(guid=self.para.get("guid")).one_or_none() | 24 | database = db.session.query(Database).filter_by(guid=self.para.get("guid")).one_or_none() |
25 | #验证权限 | 25 | #验证权限 |
26 | - UserCheck.verify(database.creator,current_token.user.username) | 26 | + UserCheck.verify(database.creator) |
27 | if configure.VACUATE_DB_URI: | 27 | if configure.VACUATE_DB_URI: |
28 | va_ds: DataSource = PGUtil.open_pg_data_source(1, configure.VACUATE_DB_URI) | 28 | va_ds: DataSource = PGUtil.open_pg_data_source(1, configure.VACUATE_DB_URI) |
29 | else: | 29 | else: |
@@ -27,7 +27,7 @@ class Api(ApiTemplate): | @@ -27,7 +27,7 @@ class Api(ApiTemplate): | ||
27 | dbase:Database = database.one_or_none() | 27 | dbase:Database = database.one_or_none() |
28 | 28 | ||
29 | #验证权限 | 29 | #验证权限 |
30 | - UserCheck.verify(dbase.creator,current_token.user.username) | 30 | + UserCheck.verify(dbase.creator) |
31 | 31 | ||
32 | update_dict={} | 32 | update_dict={} |
33 | 33 |
@@ -28,7 +28,6 @@ class EntryDataVacuate: | @@ -28,7 +28,6 @@ class EntryDataVacuate: | ||
28 | try: | 28 | try: |
29 | metas: list = parameter.get("meta") | 29 | metas: list = parameter.get("meta") |
30 | 30 | ||
31 | - vacuate = int(parameter.get("vacuate",1)) | ||
32 | 31 | ||
33 | # 总的入库是否成功 | 32 | # 总的入库是否成功 |
34 | is_success=True | 33 | is_success=True |
@@ -165,7 +164,7 @@ class EntryDataVacuate: | @@ -165,7 +164,7 @@ class EntryDataVacuate: | ||
165 | 164 | ||
166 | new_layer_name = None | 165 | new_layer_name = None |
167 | vacuate_process= None | 166 | vacuate_process= None |
168 | - vacuate = int(this_task.parameter.get("vacuate", 1)) | 167 | + vacuate = int(this_task.parameter.get("vacuate", 0)) |
169 | success = True | 168 | success = True |
170 | table_guid = uuid.uuid1().__str__() | 169 | table_guid = uuid.uuid1().__str__() |
171 | try: | 170 | try: |
@@ -244,7 +243,10 @@ class EntryDataVacuate: | @@ -244,7 +243,10 @@ class EntryDataVacuate: | ||
244 | 243 | ||
245 | # 注册图层信息 | 244 | # 注册图层信息 |
246 | # 是否抽吸过 | 245 | # 是否抽吸过 |
247 | - is_vacuate = 1 if vacuate_process.max_level>0 else 0 | 246 | + if vacuate: |
247 | + is_vacuate = 1 if vacuate_process.max_level>0 else 0 | ||
248 | + else: | ||
249 | + is_vacuate = 0 | ||
248 | 250 | ||
249 | this_task.register_table(pg_layer,new_layer_name,overwrite,parameter.get("creator"),is_vacuate,table_guid) | 251 | this_task.register_table(pg_layer,new_layer_name,overwrite,parameter.get("creator"),is_vacuate,table_guid) |
250 | 252 |
@@ -24,7 +24,7 @@ class Api(ApiTemplate): | @@ -24,7 +24,7 @@ class Api(ApiTemplate): | ||
24 | raise Exception("数据不存在!") | 24 | raise Exception("数据不存在!") |
25 | 25 | ||
26 | #验证权限 | 26 | #验证权限 |
27 | - UserCheck.verify(column.relate_table.relate_database.creator,current_token.user.username) | 27 | + UserCheck.verify(column.relate_table.relate_database.creator) |
28 | 28 | ||
29 | try: | 29 | try: |
30 | if self.para.get("column_alias"): | 30 | if self.para.get("column_alias"): |
@@ -36,17 +36,13 @@ class Api(ApiTemplate): | @@ -36,17 +36,13 @@ class Api(ApiTemplate): | ||
36 | database = Database.query.filter_by(guid=table.database_guid).one_or_none() | 36 | database = Database.query.filter_by(guid=table.database_guid).one_or_none() |
37 | 37 | ||
38 | #验证权限 | 38 | #验证权限 |
39 | - UserCheck.verify(database.creator,current_token.user.username) | 39 | + UserCheck.verify(database.creator) |
40 | 40 | ||
41 | if not database: | 41 | if not database: |
42 | res["result"]=False | 42 | res["result"]=False |
43 | res["msg"]= "数据库不存在!" | 43 | res["msg"]= "数据库不存在!" |
44 | return res | 44 | return res |
45 | 45 | ||
46 | - if database.creator != "": | ||
47 | - raise Exception("缺乏权限!") | ||
48 | - | ||
49 | - | ||
50 | pg_ds: DataSource = PGUtil.open_pg_data_source(1, DES.decode(database.sqlalchemy_uri)) | 46 | pg_ds: DataSource = PGUtil.open_pg_data_source(1, DES.decode(database.sqlalchemy_uri)) |
51 | 47 | ||
52 | if configure.VACUATE_DB_URI: | 48 | if configure.VACUATE_DB_URI: |
@@ -33,7 +33,7 @@ class Api(ApiTemplate): | @@ -33,7 +33,7 @@ class Api(ApiTemplate): | ||
33 | return res | 33 | return res |
34 | 34 | ||
35 | #验证权限 | 35 | #验证权限 |
36 | - UserCheck.verify(table.relate_database.creator,current_token.user.username) | 36 | + UserCheck.verify(table.one_or_none().relate_database.creator) |
37 | 37 | ||
38 | if self.para.__contains__("catalog_guid"): | 38 | if self.para.__contains__("catalog_guid"): |
39 | if catalog_guid is None: | 39 | if catalog_guid is None: |
@@ -29,10 +29,7 @@ class Api(ApiTemplate): | @@ -29,10 +29,7 @@ class Api(ApiTemplate): | ||
29 | database = Database.query.filter_by(guid=database_guid).one_or_none() | 29 | database = Database.query.filter_by(guid=database_guid).one_or_none() |
30 | 30 | ||
31 | #验证权限 | 31 | #验证权限 |
32 | - UserCheck.verify(database.creator,current_token.user.username) | ||
33 | - | ||
34 | - if database.creator != "": | ||
35 | - raise Exception("缺乏权限!") | 32 | + UserCheck.verify(database.creator) |
36 | 33 | ||
37 | if not database: | 34 | if not database: |
38 | raise Exception("数据库不存在!") | 35 | raise Exception("数据库不存在!") |
@@ -43,7 +43,7 @@ class Api(ApiTemplate): | @@ -43,7 +43,7 @@ class Api(ApiTemplate): | ||
43 | raise Exception("数据不存在!") | 43 | raise Exception("数据不存在!") |
44 | 44 | ||
45 | #验证权限 | 45 | #验证权限 |
46 | - UserCheck.verify(table.relate_database.creator,current_token.user.username) | 46 | + UserCheck.verify(table.relate_database.creator) |
47 | 47 | ||
48 | pg_ds :DataSource= PGUtil.open_pg_data_source(0,DES.decode(table.relate_database.sqlalchemy_uri)) | 48 | pg_ds :DataSource= PGUtil.open_pg_data_source(0,DES.decode(table.relate_database.sqlalchemy_uri)) |
49 | layer = pg_ds.GetLayerByName(table.name) | 49 | layer = pg_ds.GetLayerByName(table.name) |
@@ -42,7 +42,7 @@ class Api(ApiTemplate): | @@ -42,7 +42,7 @@ class Api(ApiTemplate): | ||
42 | raise Exception("数据不存在!") | 42 | raise Exception("数据不存在!") |
43 | 43 | ||
44 | #验证权限 | 44 | #验证权限 |
45 | - UserCheck.verify(table.relate_database.creator,current_token.user.username) | 45 | + UserCheck.verify(table.relate_database.creator) |
46 | 46 | ||
47 | # 判断图层是否存在 | 47 | # 判断图层是否存在 |
48 | 48 |
@@ -9,6 +9,7 @@ from sqlalchemy.engine import ResultProxy | @@ -9,6 +9,7 @@ from sqlalchemy.engine import ResultProxy | ||
9 | from app.util.component.ApiTemplate import ApiTemplate | 9 | from app.util.component.ApiTemplate import ApiTemplate |
10 | from app.util.component.PGUtil import PGUtil | 10 | from app.util.component.PGUtil import PGUtil |
11 | import json | 11 | import json |
12 | +import decimal | ||
12 | class Api(ApiTemplate): | 13 | class Api(ApiTemplate): |
13 | api_name = "数据浏览" | 14 | api_name = "数据浏览" |
14 | def process(self): | 15 | def process(self): |
@@ -53,6 +54,8 @@ class Api(ApiTemplate): | @@ -53,6 +54,8 @@ class Api(ApiTemplate): | ||
53 | #格式化时间列 | 54 | #格式化时间列 |
54 | if isinstance(value, datetime.datetime): | 55 | if isinstance(value, datetime.datetime): |
55 | d[column] = value.strftime('%Y-%m-%d %H:%M:%S') | 56 | d[column] = value.strftime('%Y-%m-%d %H:%M:%S') |
57 | + elif isinstance(value, decimal.Decimal): | ||
58 | + d[column] = float(value) | ||
56 | else: | 59 | else: |
57 | d[column]=value | 60 | d[column]=value |
58 | pkey_dict.update(d) | 61 | pkey_dict.update(d) |
@@ -23,7 +23,7 @@ class Api(ApiTemplate): | @@ -23,7 +23,7 @@ class Api(ApiTemplate): | ||
23 | raise Exception("任务不存在!") | 23 | raise Exception("任务不存在!") |
24 | 24 | ||
25 | #验证权限 | 25 | #验证权限 |
26 | - UserCheck.verify(task.creator,current_token.user.username) | 26 | + UserCheck.verify(task.creator) |
27 | 27 | ||
28 | db.session.delete(task) | 28 | db.session.delete(task) |
29 | db.session.commit() | 29 | db.session.commit() |
@@ -29,7 +29,7 @@ class Api(ApiTemplate): | @@ -29,7 +29,7 @@ class Api(ApiTemplate): | ||
29 | raise Exception("任务不存在!") | 29 | raise Exception("任务不存在!") |
30 | 30 | ||
31 | #验证权限 | 31 | #验证权限 |
32 | - UserCheck.verify(task.creator,current_token.user.username) | 32 | + UserCheck.verify(task.creator) |
33 | 33 | ||
34 | pid = task.task_pid | 34 | pid = task.task_pid |
35 | try: | 35 | try: |
@@ -23,7 +23,7 @@ class Api(ApiTemplate): | @@ -23,7 +23,7 @@ class Api(ApiTemplate): | ||
23 | if not user_req.json().get("result"): | 23 | if not user_req.json().get("result"): |
24 | raise Exception("服务不存在!") | 24 | raise Exception("服务不存在!") |
25 | # 验证权限 | 25 | # 验证权限 |
26 | - UserCheck.verify(user_req.json().get("data").get("service").get("creator"), current_token.user.username) | 26 | + UserCheck.verify(user_req.json().get("data").get("service").get("creator")) |
27 | 27 | ||
28 | url = "{}/API/Service/Delete".format(self.para.get("url")) | 28 | url = "{}/API/Service/Delete".format(self.para.get("url")) |
29 | response:requests.Response = requests.post(url,data=self.para) | 29 | response:requests.Response = requests.post(url,data=self.para) |
@@ -23,7 +23,7 @@ class Api(ApiTemplate): | @@ -23,7 +23,7 @@ class Api(ApiTemplate): | ||
23 | if not user_req.json().get("result"): | 23 | if not user_req.json().get("result"): |
24 | raise Exception("服务不存在!") | 24 | raise Exception("服务不存在!") |
25 | # 验证权限 | 25 | # 验证权限 |
26 | - UserCheck.verify(user_req.json().get("data").get("service").get("creator"), current_token.user.username) | 26 | + UserCheck.verify(user_req.json().get("data").get("service").get("creator")) |
27 | 27 | ||
28 | url = "{}/API/Service/Edit".format(self.para.get("url")) | 28 | url = "{}/API/Service/Edit".format(self.para.get("url")) |
29 | response:requests.Response = requests.post(url,data=self.para) | 29 | response:requests.Response = requests.post(url,data=self.para) |
@@ -26,14 +26,14 @@ class Api(ApiTemplate): | @@ -26,14 +26,14 @@ class Api(ApiTemplate): | ||
26 | try: | 26 | try: |
27 | guid = self.para.get("guid") | 27 | guid = self.para.get("guid") |
28 | functions = self.para.get("functions") | 28 | functions = self.para.get("functions") |
29 | - service :Service = Service.query.filter_by(guid=guid) | 29 | + service :Service = Service.query.filter_by(guid=guid).one_or_none() |
30 | this_time = datetime.datetime.now() | 30 | this_time = datetime.datetime.now() |
31 | 31 | ||
32 | if not service: | 32 | if not service: |
33 | raise Exception("服务不存在!") | 33 | raise Exception("服务不存在!") |
34 | 34 | ||
35 | #验证权限 | 35 | #验证权限 |
36 | - UserCheck.verify(service.creator,current_token.user.username) | 36 | + UserCheck.verify(service.creator) |
37 | 37 | ||
38 | service_update = {"update_time":this_time} | 38 | service_update = {"update_time":this_time} |
39 | map_service_update = {} | 39 | map_service_update = {} |
@@ -59,6 +59,8 @@ class Api(ApiTemplate): | @@ -59,6 +59,8 @@ class Api(ApiTemplate): | ||
59 | if not resp_json["status"]=="1": | 59 | if not resp_json["status"]=="1": |
60 | raise Exception("调用矢量服务的修改服务接口失败!") | 60 | raise Exception("调用矢量服务的修改服务接口失败!") |
61 | 61 | ||
62 | + service_update["overview"] = resp_json["url"] | ||
63 | + | ||
62 | # 修改功能 | 64 | # 修改功能 |
63 | if functions: | 65 | if functions: |
64 | new_types = functions.split(",") | 66 | new_types = functions.split(",") |
@@ -75,7 +77,7 @@ class Api(ApiTemplate): | @@ -75,7 +77,7 @@ class Api(ApiTemplate): | ||
75 | map_service = MapService.query.filter_by(service_guid=guid) | 77 | map_service = MapService.query.filter_by(service_guid=guid) |
76 | 78 | ||
77 | if service_update: | 79 | if service_update: |
78 | - service.update(service_update) | 80 | + Service.query.filter_by(guid=guid).update(service_update) |
79 | if map_service_update: | 81 | if map_service_update: |
80 | map_service.update(map_service_update) | 82 | map_service.update(map_service_update) |
81 | 83 |
@@ -30,7 +30,7 @@ class Api(ApiTemplate): | @@ -30,7 +30,7 @@ class Api(ApiTemplate): | ||
30 | if service: | 30 | if service: |
31 | 31 | ||
32 | # 验证权限 | 32 | # 验证权限 |
33 | - UserCheck.verify(service.creator, current_token.user.username) | 33 | + UserCheck.verify(service.creator) |
34 | 34 | ||
35 | try: | 35 | try: |
36 | if service.type.__eq__("切片服务"): | 36 | if service.type.__eq__("切片服务"): |
@@ -29,7 +29,7 @@ class Api(ApiTemplate): | @@ -29,7 +29,7 @@ class Api(ApiTemplate): | ||
29 | if not service: | 29 | if not service: |
30 | raise Exception("服务不存在!") | 30 | raise Exception("服务不存在!") |
31 | #验证权限 | 31 | #验证权限 |
32 | - UserCheck.verify(service.creator,current_token.user.username) | 32 | + UserCheck.verify(service.creator) |
33 | 33 | ||
34 | this_time = datetime.datetime.now() | 34 | this_time = datetime.datetime.now() |
35 | 35 |
@@ -2,12 +2,13 @@ | @@ -2,12 +2,13 @@ | ||
2 | #author: 4N | 2 | #author: 4N |
3 | #createtime: 2022/1/14 | 3 | #createtime: 2022/1/14 |
4 | #email: nheweijun@sina.com | 4 | #email: nheweijun@sina.com |
5 | - | 5 | +from authlib.integrations.flask_oauth2 import current_token |
6 | import configure | 6 | import configure |
7 | class UserCheck: | 7 | class UserCheck: |
8 | 8 | ||
9 | @classmethod | 9 | @classmethod |
10 | - def verify(cls,owner,operator): | 10 | + def verify(cls,owner): |
11 | if configure.PermissionActive: | 11 | if configure.PermissionActive: |
12 | + operator = current_token.user.username | ||
12 | if configure.PermissionActive and operator != "admin" and owner !=operator: | 13 | if configure.PermissionActive and operator != "admin" and owner !=operator: |
13 | raise Exception("缺乏权限!") | 14 | raise Exception("缺乏权限!") |
1 | -<VirtualHost *:80> | ||
2 | - ServerName 172.26.60.101 | 1 | +Listen 81 |
2 | +<VirtualHost *:81> | ||
3 | + ServerName 172.26.60.100 | ||
3 | WSGIDaemonProcess yourapplication processes=4 threads=16 | 4 | WSGIDaemonProcess yourapplication processes=4 threads=16 |
4 | WSGIScriptAlias / /usr/src/app/run.wsgi | 5 | WSGIScriptAlias / /usr/src/app/run.wsgi |
5 | WSGIPassAuthorization On | 6 | WSGIPassAuthorization On |
@@ -11,11 +12,9 @@ | @@ -11,11 +12,9 @@ | ||
11 | Require all granted | 12 | Require all granted |
12 | </Directory> | 13 | </Directory> |
13 | </VirtualHost> | 14 | </VirtualHost> |
14 | - | ||
15 | -Listen 81 | ||
16 | - | ||
17 | -<VirtualHost *:81> | ||
18 | - ServerName 172.26.60.101 | 15 | +Listen 82 |
16 | +<VirtualHost *:82> | ||
17 | + ServerName 172.26.60.100 | ||
19 | WSGIDaemonProcess monitormanager processes=1 threads=8 | 18 | WSGIDaemonProcess monitormanager processes=1 threads=8 |
20 | WSGIScriptAlias / /usr/src/app/monitor.wsgi | 19 | WSGIScriptAlias / /usr/src/app/monitor.wsgi |
21 | WSGIPassAuthorization On | 20 | WSGIPassAuthorization On |
请
注册
或
登录
后发表评论