Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bugfix scan project add change . #1257

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions dongtai_web/views/project_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,7 @@ def post(self, request):
mode = "插桩模式"
scan_id = int(request.data.get("scan_id", 0))
# auth_users = self.get_auth_users(request.user)
departments = request.user.get_relative_department()
if scan_id == 5:
scan = IastStrategyUser.objects.filter(id=scan_id).first()
else:
scan = IastStrategyUser.objects.filter(
id=scan_id, department__in=departments).first()
scan = IastStrategyUser.objects.filter(id=scan_id).first()
base_url = request.data.get('base_url', None)
test_req_header_key = request.data.get('test_req_header_key',
None)
Expand Down Expand Up @@ -175,7 +170,7 @@ def post(self, request):
if test_req_header_value:
project.test_req_header_value = test_req_header_value
project.save(update_fields=[
'name', 'scan_id', 'mode', 'latest_time', 'vul_validation',
'name', 'scan', 'mode', 'latest_time', 'vul_validation',
'base_url', 'test_req_header_key', 'test_req_header_value'
])
return R.success(msg='操作成功')
Expand Down
5 changes: 1 addition & 4 deletions dongtai_web/views/scan_strategys.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ def get(self, request, pk):
size = ser.validated_data['size']
except ValidationError as e:
return R.failure(data=e.detail)
user = self.get_auth_users(request.user)
scan_strategy = IastStrategyUser.objects.filter(pk=pk,
user__in=user).first()
scan_strategy = IastStrategyUser.objects.filter(pk=pk).first()
projects = IastProject.objects.filter(
scan=scan_strategy).order_by('-latest_time')[::size]
return R.success(data=_ProjectSerializer(projects, many=True).data)
Expand Down Expand Up @@ -124,7 +122,6 @@ def list(self, request):
page_size = ser.validated_data['page_size']
except ValidationError as e:
return R.failure(data=e.detail)
users = self.get_auth_users(request.user)
q = ~Q(status=-1)
if name:
q = Q(name__icontains=name) & q
Expand Down