mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-03 05:11:49 -05:00
prototype for new copy GET details
This commit is contained in:
@@ -2906,12 +2906,16 @@ class WorkflowJobTemplateCopy(WorkflowsEnforcementMixin, GenericAPIView):
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
obj = self.get_object()
|
||||
data = {}
|
||||
copy_TF, messages = request.user.can_access_with_errors(self.model, 'copy', obj)
|
||||
data['can_copy'] = copy_TF
|
||||
data['warnings'] = messages
|
||||
if not copy_TF:
|
||||
data['warnings'] = _('You do not have permission to make a copy.')
|
||||
can_copy, messages = request.user.can_access_with_errors(self.model, 'copy', obj)
|
||||
data = {
|
||||
'can_copy': can_copy, 'can_copy_without_user_input': can_copy,
|
||||
'templates_unable_to_copy': [] if can_copy else ['all'],
|
||||
'credentials_unable_to_copy': [] if can_copy else ['all'],
|
||||
'inventories_unable_to_copy': [] if can_copy else ['all']
|
||||
}
|
||||
if messages and can_copy:
|
||||
data['can_copy_without_user_input'] = False
|
||||
data.update(messages)
|
||||
return Response(data)
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user