synapse/visibility.py
def filter_events_for_client(store, user_id, events, is_peeking=False,
                             always_include_ids=frozenset()):
    """
    Check which events a user is allowed to see

    Args:
        user_id(str): user id to be checked
        events([synapse.events.EventBase]): list of events to be checked
        is_peeking(bool): should be True if:
          * the user is not currently a member of the room, and:
          * the user has not been a member of the room since the given
            events

    Returns:
        [synapse.events.EventBase]
    """
    types = (
        (EventTypes.RoomHistoryVisibility, ""),
        (EventTypes.Member, user_id),
    )
    event_id_to_state = yield store.get_state_for_events(
        frozenset(e.event_id for e in events),
        types=types
    )
    res = yield filter_events_for_clients(
        store, [(user_id, is_peeking)], events, event_id_to_state,
        always_include_ids=always_include_ids,
    )
    defer.returnValue(res.get(user_id, []))

    Check which events a user is allowed to see

    Args:
        user_id(str): user id to be checked
        events([synapse.events.EventBase]): list of events to be checked
        is_peeking(bool): should be True if:
          * the user is not currently a member of the room, and:
          * the user has not been a member of the room since the given
            events

    Returns:
        [synapse.events.EventBase]
    
Check which events a user is allowed to see
Check which events a user is allowed to see
def filter_events_for_client(store, user_id, events, is_peeking=False,
                             always_include_ids=frozenset()):
    types = (
        (EventTypes.RoomHistoryVisibility, ""),
        (EventTypes.Member, user_id),
    )
    event_id_to_state = yield store.get_state_for_events(
        frozenset(e.event_id for e in events),
        types=types
    )
    res = yield filter_events_for_clients(
        store, [(user_id, is_peeking)], events, event_id_to_state,
        always_include_ids=always_include_ids,
    )
    defer.returnValue(res.get(user_id, []))
def filter_events_for_client ( store , user_id , events , is_peeking = False , always_include_ids = frozenset ( ) ) : types = ( ( EventTypes . RoomHistoryVisibility , "" ) , ( EventTypes . Member , user_id ) , ) event_id_to_state = yield store . get_state_for_events ( frozenset ( e . event_id for e in events ) , types = types ) res = yield filter_events_for_clients ( store , [ ( user_id , is_peeking ) ] , events , event_id_to_state , always_include_ids = always_include_ids , ) defer . returnValue ( res . get ( user_id , [ ] ) )
Check which events a user is allowed to see
Check which events a user is allowed to see
"""
    Check which events a user is allowed to see

    Args:
        user_id(str): user id to be checked
        events([synapse.events.EventBase]): list of events to be checked
        is_peeking(bool): should be True if:
          * the user is not currently a member of the room, and:
          * the user has not been a member of the room since the given
            events

    Returns:
        [synapse.events.EventBase]
    """
None
store
user_id
user id to be checked
user id to be checked
events
list of events to be checked
list of events to be checked
is_peeking
should be True if:
the user is not currently a member of the room, and:
the user has not been a member of the room since the given
events
should be True if : the user is not currently a member of the room and : the user has not been a member of the room since the given events
always_include_ids