'List histories shared with current user by others'

@web.expose
@web.json
@web.require_login('work    with    shared    histories')
def list_shared(self, trans, **kwargs):

    status = message = None
    if ('operation' in kwargs):
        ids = galaxy.util.listify(kwargs.get('id', []))
        operation = kwargs['operation'].lower()
        if (operation == 'unshare'):
            if (not ids):
                message = 'Select    a    history    to    unshare'
                status = 'error'
            for id in ids:
                history = self.history_manager.by_id(self.decode_id(id))
                association = trans.sa_session.query(trans.app.model.HistoryUserShareAssociation).filter_by(user=trans.user, history=history).one()
                trans.sa_session.delete(association)
                trans.sa_session.flush()
            message = ('Unshared    %d    shared    histories' % len(ids))
            status = 'done'
    kwargs['dict_format'] = True
    return self.shared_list_grid(trans, status=status, message=message, **kwargs)
