'Replaces the members of the image with those specified in the
body.  The body is a dict with the following format::
{\'memberships\': [
{\'member_id\': <MEMBER_ID>,
[\'can_share\': [True|False]]}, ...'

@utils.mutating
def update_all(self, req, image_id, body):

    self._check_can_access_image_members(req.context)
    try:
        image = self.db_api.image_get(req.context, image_id, v1_mode=True)
    except exception.NotFound:
        msg = (_('Image    %(id)s    not    found') % {'id': image_id})
        LOG.warn(msg)
        raise webob.exc.HTTPNotFound(msg)
    except exception.Forbidden:
        msg = (_LW("Access    denied    to    image    %(id)s    but    returning    'not    found'") % {'id': image_id})
        LOG.warn(msg)
        raise webob.exc.HTTPNotFound()
    if (not self.is_image_sharable(req.context, image)):
        msg = (_LW('User    lacks    permission    to    share    image    %(id)s') % {'id': image_id})
        LOG.warn(msg)
        msg = _('No    permission    to    share    that    image')
        raise webob.exc.HTTPForbidden(msg)
    try:
        memb_list = body['memberships']
    except Exception as e:
        msg = (_LW('Invalid    membership    association    specified    for    image    %(id)s') % {'id': image_id})
        LOG.warn(msg)
        msg = (_('Invalid    membership    association:    %s') % encodeutils.exception_to_unicode(e))
        raise webob.exc.HTTPBadRequest(explanation=msg)
    add = []
    existing = {}
    for memb in memb_list:
        try:
            datum = dict(image_id=image['id'], member=memb['member_id'], can_share=None)
        except Exception as e:
            msg = (_LW('Invalid    membership    association    specified    for    image    %(id)s') % {'id': image_id})
            LOG.warn(msg)
            msg = (_('Invalid    membership    association:    %s') % encodeutils.exception_to_unicode(e))
            raise webob.exc.HTTPBadRequest(explanation=msg)
        if ('can_share' in memb):
            datum['can_share'] = bool(memb['can_share'])
        members = self.db_api.image_member_find(req.context, image_id=datum['image_id'], member=datum['member'], include_deleted=True)
        try:
            member = members[0]
        except IndexError:
            datum['can_share'] = bool(datum['can_share'])
            add.append(datum)
        else:
            if (datum['can_share'] is None):
                datum['can_share'] = members[0]['can_share']
            existing[member['id']] = {'values': datum, 'membership': member}
    existing_members = self.db_api.image_member_find(req.context, image_id=image['id'], include_deleted=True)
    for member in existing_members:
        if (member['id'] in existing):
            update = existing[member['id']]['values']
            self.db_api.image_member_update(req.context, member['id'], update)
        elif (not member['deleted']):
            self.db_api.image_member_delete(req.context, member['id'])
    for memb in add:
        self.db_api.image_member_create(req.context, memb)
    LOG.info(_LI('Successfully    updated    memberships    for    image    %(id)s'), {'id': image_id})
    return webob.exc.HTTPNoContent()
