Merge pull request #2957 from jumpserver/dev

Dev
pull/3007/head
老广 2019-07-16 10:12:14 +08:00 committed by GitHub
commit 341b654078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 4 deletions

View File

@ -85,7 +85,7 @@ class AssetViewSet(LabelFilter, OrgBulkModelViewSet):
queryset = queryset.filter( queryset = queryset.filter(
nodes__key__regex='^{}(:[0-9]+)*$'.format(node.key), nodes__key__regex='^{}(:[0-9]+)*$'.format(node.key),
) )
return queryset return queryset.distinct()
def filter_admin_user_id(self, queryset): def filter_admin_user_id(self, queryset):
admin_user_id = self.request.query_params.get('admin_user_id') admin_user_id = self.request.query_params.get('admin_user_id')

View File

@ -2,6 +2,7 @@
# #
from django import forms from django import forms
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
import re import re
from orgs.mixins import OrgModelForm from orgs.mixins import OrgModelForm

View File

@ -2,6 +2,7 @@
# #
import re import re
from rest_framework import serializers from rest_framework import serializers
from django.utils.translation import ugettext_lazy as _
from common.fields import ChoiceDisplayField from common.fields import ChoiceDisplayField
from common.serializers import AdaptedBulkListSerializer from common.serializers import AdaptedBulkListSerializer
@ -35,6 +36,9 @@ class CommandFilterRuleSerializer(BulkOrgResourceModelSerializer):
list_serializer_class = AdaptedBulkListSerializer list_serializer_class = AdaptedBulkListSerializer
def validate_content(self, content): def validate_content(self, content):
tp = self.initial_data.get("type")
if tp == CommandFilterRule.TYPE_REGEX:
return content
if self.invalid_pattern.search(content): if self.invalid_pattern.search(content):
invalid_char = self.invalid_pattern.pattern.replace('\\', '') invalid_char = self.invalid_pattern.pattern.replace('\\', '')
msg = _("Content should not be contain: {}").format(invalid_char) msg = _("Content should not be contain: {}").format(invalid_char)

View File

@ -115,7 +115,7 @@ function initTable() {
}}], }}],
ajax_url: '{% url "api-assets:admin-user-list" %}', ajax_url: '{% url "api-assets:admin-user-list" %}',
columns: [ columns: [
{data: function(){return ""}}, {data: "name"}, {data: "username" }, {data: "assets_amount" }, {data: function(){return ""}}, {data: "name"}, {data: "username" }, {data: "assets_amount", orderable: false},
{#{data: "connectivity_amount"}, {data: "connectivity_amount"}, {data: "connectivity_amount"},#} {#{data: "connectivity_amount"}, {data: "connectivity_amount"}, {data: "connectivity_amount"},#}
{data: "comment"}, {data: "id"} {data: "comment"}, {data: "id"}
] ]

View File

@ -344,6 +344,12 @@ class GetUserAssetPermissionActionsApi(UserPermissionCacheMixin, RetrieveAPIView
user_id = self.request.query_params.get('user_id', '') user_id = self.request.query_params.get('user_id', '')
asset_id = self.request.query_params.get('asset_id', '') asset_id = self.request.query_params.get('asset_id', '')
system_id = self.request.query_params.get('system_user_id', '') system_id = self.request.query_params.get('system_user_id', '')
try:
user_id = uuid.UUID(user_id)
asset_id = uuid.UUID(asset_id)
system_id = uuid.UUID(system_id)
except ValueError:
return Response({'msg': False}, status=403)
user = get_object_or_404(User, id=user_id) user = get_object_or_404(User, id=user_id)

View File

@ -42,8 +42,7 @@
</div> </div>
<div > <div >
<div class="verify">{% trans 'Security token validation' %}&nbsp;&nbsp;{% trans 'Account' %}&nbsp;<span>{{ user.username }}</span>&nbsp;&nbsp;{% trans 'Follow these steps to complete the binding operation' %}</div> <div class="verify">{% trans 'Security token validation' %}&nbsp;&nbsp;{% trans 'Account' %}&nbsp;<span>{{ user.username }}</span>&nbsp;&nbsp;{% trans 'Follow these steps to complete the binding operation' %}</div>
<div class="line"></div> <hr style="width: 500px; margin: auto; margin-top: 10px;">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>