fix: 批量上传文件关闭作业中心配置后上传会报错 (#12814)

* fix: 批量上传文件关闭作业中心配置后上传会报错

* fix: format

---------

Co-authored-by: wangruidong <940853815@qq.com>
Co-authored-by: Bai <baijiangjie@gmail.com>
pull/12832/head
fit2bot 2024-03-18 15:49:13 +08:00 committed by GitHub
parent 0671e56d65
commit bb27ff7f8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -63,6 +63,10 @@ class JobViewSet(OrgBulkModelViewSet):
model = Job
def check_permissions(self, request):
# job: upload_file
if self.action == 'upload' or request.data.get('type') == Types.upload_file:
return super().check_permissions(request)
# job: adhoc, playbook
if not settings.SECURITY_COMMAND_EXECUTION:
return self.permission_denied(request, "Command execution disabled")
return super().check_permissions(request)