Skip to content

Commit

Permalink
修复普通用户网站监测日志查看权限
Browse files Browse the repository at this point in the history
  • Loading branch information
mouday committed Nov 2, 2024
1 parent b2b08d0 commit 4ca6d0f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions domain_admin/api/log_monitor_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from domain_admin.service import auth_service


@auth_service.permission(role=RoleEnum.ADMIN)
@auth_service.permission(role=RoleEnum.USER)
def get_log_monitor_list():
"""
:return:
Expand Down Expand Up @@ -52,7 +52,7 @@ def get_log_monitor_list():
}


@auth_service.permission(role=RoleEnum.ADMIN)
@auth_service.permission(role=RoleEnum.USER)
def clear_log_monitor():
"""
:return:
Expand All @@ -64,7 +64,7 @@ def clear_log_monitor():
).execute()


@auth_service.permission(role=RoleEnum.ADMIN)
@auth_service.permission(role=RoleEnum.USER)
def clear_all_log_monitor():
"""
:return:
Expand Down
12 changes: 12 additions & 0 deletions domain_admin/api/monitor_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from peewee import SQL, fn
from playhouse.shortcuts import model_to_dict

from domain_admin.enums.monitor_type_enum import MonitorTypeEnum
from domain_admin.enums.operation_enum import OperationEnum
from domain_admin.enums.role_enum import RoleEnum
from domain_admin.enums.time_unit_enum import TimeUnitEnum
Expand Down Expand Up @@ -140,6 +141,11 @@ def remove_monitor_by_id():

MonitorModel.delete_by_id(monitor_row.id)

# remote log
LogMonitorModel.delete().where(
LogMonitorModel.monitor_id == monitor_row.id,
LogMonitorModel.monitor_type == MonitorTypeEnum.HTTP
).execute()

@auth_service.permission(role=RoleEnum.USER)
@operation_service.operation_log_decorator(
Expand All @@ -162,6 +168,12 @@ def delete_monitor_by_ids():
MonitorModel.user_id == current_user_id
).execute()

# remote log
LogMonitorModel.delete().where(
LogMonitorModel.monitor_id.in_(monitor_ids),
LogMonitorModel.monitor_type == MonitorTypeEnum.HTTP
).execute()


@auth_service.permission(role=RoleEnum.USER)
def get_monitor_by_id():
Expand Down

0 comments on commit 4ca6d0f

Please sign in to comment.