mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 01:17:35 -02:30
Merge pull request #5534 from jangsutsr/3551_restore_original_behavior_of_group_children_unattach
Restore original behavior of group children unattach
This commit is contained in:
@@ -1868,6 +1868,16 @@ class GroupChildrenList(EnforceParentRelationshipMixin, SubListCreateAttachDetac
|
|||||||
relationship = 'children'
|
relationship = 'children'
|
||||||
enforce_parent_relationship = 'inventory'
|
enforce_parent_relationship = 'inventory'
|
||||||
|
|
||||||
|
def unattach(self, request, *args, **kwargs):
|
||||||
|
sub_id = request.data.get('id', None)
|
||||||
|
if sub_id is not None:
|
||||||
|
return super(GroupChildrenList, self).unattach(request, *args, **kwargs)
|
||||||
|
parent = self.get_parent_object()
|
||||||
|
if not request.user.can_access(self.model, 'delete', parent):
|
||||||
|
raise PermissionDenied()
|
||||||
|
parent.delete()
|
||||||
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
class GroupPotentialChildrenList(SubListAPIView):
|
class GroupPotentialChildrenList(SubListAPIView):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user