'Update an Organization
Update various attributes and configurable settings for the given
organization.
:pparam string organization_slug: the slug of the organization the
team should be created for.
:param string name: an optional new name for the organization.
:param string slug: an optional new slug for the organization.  Needs
to be available and unique.
:auth: required'

@attach_scenarios([update_organization_scenario])
def put(self, request, organization):

    if request.access.has_scope('org:admin'):
        serializer_cls = OwnerOrganizationSerializer
    else:
        serializer_cls = OrganizationSerializer
    serializer = serializer_cls(data=request.DATA, partial=True, context={'organization': organization})
    if serializer.is_valid():
        organization = serializer.save()
        self.create_audit_entry(request=request, organization=organization, target_object=organization.id, event=AuditLogEntryEvent.ORG_EDIT, data=organization.get_audit_log_data())
        return Response(serialize(organization, request.user, DetailedOrganizationSerializer()))
    return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
