Merge remote-tracking branch 'origin/v3' into v3

pull/9008/head
Aaron3S 2022-10-31 19:29:50 +08:00
commit 41ee6a64bd
5 changed files with 8 additions and 5 deletions

View File

@ -64,7 +64,7 @@ class LoginAssetACL(BaseACL, OrgModelMixin):
Q(assets__hostname_group__contains=asset.name) |
Q(assets__hostname_group__contains='*')
)
ids = [q.id for q in queryset if contains_ip(asset.ip, q.assets.get('ip_group', []))]
ids = [q.id for q in queryset if contains_ip(asset.address, q.assets.get('ip_group', []))]
queryset = cls.objects.filter(id__in=ids)
return queryset

View File

@ -26,7 +26,7 @@ class AccountViewSet(OrgBulkModelViewSet):
}
rbac_perms = {
'verify': 'assets.test_account',
'partial_update': 'assets.change_assetaccountsecret',
'partial_update': 'assets.change_accountsecret',
}
@action(methods=['post'], detail=True, url_path='verify')

View File

@ -39,8 +39,11 @@ class GatherAccountsFilter:
@staticmethod
def windows_filter(info):
# TODO
info = info[4:-2]
result = {}
for i in info:
for username in i.split():
result[username] = {}
return result
def run(self, method_id_meta_mapper, info):

View File

@ -142,7 +142,7 @@ class IpInFilterBackend(filters.BaseFilterBackend):
if not ips:
return queryset
ip_list = [i.strip() for i in ips.split(',')]
queryset = queryset.filter(ip__in=ip_list)
queryset = queryset.filter(address__in=ip_list)
return queryset
def get_schema_fields(self, view):

View File

@ -113,7 +113,7 @@ class ConnectionTokenAssetSerializer(serializers.ModelSerializer):
""" Asset """
class Meta:
model = Asset
fields = ['id', 'name', 'ip', 'protocols', 'org_id']
fields = ['id', 'name', 'address', 'protocols', 'org_id']
class ConnectionTokenAccountSerializer(serializers.ModelSerializer):