mirror of https://github.com/jumpserver/jumpserver
fix: 修复组织管理员查看操作日志可以看到 system 组织下的操作问题, 只有系统管理员可以查看任务监控
parent
21352a2ab7
commit
6bbe602ebb
|
@ -149,7 +149,7 @@ class OperateLogViewSet(OrgReadonlyModelViewSet):
|
|||
return super().get_serializer_class()
|
||||
|
||||
def get_queryset(self):
|
||||
org_q = Q(org_id=Organization.SYSTEM_ID) | Q(org_id=current_org.id)
|
||||
org_q = Q(org_id=current_org.id)
|
||||
with tmp_to_root_org():
|
||||
qs = OperateLog.objects.filter(org_q)
|
||||
es_config = settings.OPERATE_LOG_ELASTICSEARCH_CONFIG
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from rest_framework import serializers
|
||||
|
||||
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
||||
from audits.backends.db import OperateLogStore
|
||||
from common.serializers.fields import LabeledChoiceField
|
||||
from common.utils import reverse, i18n_trans
|
||||
|
@ -78,7 +78,7 @@ class OperateLogActionDetailSerializer(serializers.ModelSerializer):
|
|||
return data
|
||||
|
||||
|
||||
class OperateLogSerializer(serializers.ModelSerializer):
|
||||
class OperateLogSerializer(BulkOrgResourceModelSerializer):
|
||||
action = LabeledChoiceField(choices=ActionChoices.choices, label=_("Action"))
|
||||
resource = serializers.SerializerMethodField(label=_("Resource"))
|
||||
resource_type = serializers.SerializerMethodField(label=_('Resource Type'))
|
||||
|
|
|
@ -135,7 +135,7 @@ only_system_permissions = (
|
|||
('xpack', 'license', '*', '*'),
|
||||
('settings', 'setting', '*', '*'),
|
||||
('tickets', '*', '*', '*'),
|
||||
('ops', 'task', 'view', 'taskmonitor'),
|
||||
('ops', 'celerytask', 'view', 'taskmonitor'),
|
||||
('terminal', 'terminal', '*', '*'),
|
||||
('terminal', 'commandstorage', '*', '*'),
|
||||
('terminal', 'replaystorage', '*', '*'),
|
||||
|
|
Loading…
Reference in New Issue