perf: 修改权限

pull/8873/head
ibuler 2 years ago
parent 88d4bf932c
commit 8dfb8eeb75

@ -2,6 +2,7 @@ from django.db import models
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from simple_history.models import HistoricalRecords from simple_history.models import HistoricalRecords
from common.db.models import JMSBaseModel
from .protocol import ProtocolMixin from .protocol import ProtocolMixin
from .base import BaseUser, AbsConnectivity from .base import BaseUser, AbsConnectivity
@ -35,3 +36,7 @@ class Account(BaseUser, AbsConnectivity, ProtocolMixin):
def __str__(self): def __str__(self):
return '{}://{}@{}'.format(self.protocol, self.username, self.asset.hostname) return '{}://{}@{}'.format(self.protocol, self.username, self.asset.hostname)
class AccountTemplate(JMSBaseModel):
pass

@ -213,9 +213,9 @@ class DatesLoginMetricMixin:
class IndexApi(DatesLoginMetricMixin, APIView): class IndexApi(DatesLoginMetricMixin, APIView):
http_method_names = ['get'] http_method_names = ['get']
rbac_perms = {
'GET': 'rbac.view_audit | rbac.view_console' def check_permissions(self, request):
} return request.user.has_perm(['rbac.view_audit', 'rbac.view_console'])
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
data = {} data = {}

Loading…
Cancel
Save