ircd:Ⓜ️:rooms: Add requesting user_id/node_id to query opts for access ctrl.

This commit is contained in:
Jason Volk 2023-01-24 22:14:26 -08:00
parent db4ebe1ba7
commit ede3d5a651
3 changed files with 10 additions and 1 deletions

View File

@ -83,6 +83,14 @@ struct ircd::m::rooms::opts
/// Specify prefetching to increase iteration performance.
size_t prefetch {0};
/// Pass the c2s user_id making the request to determine access to features
/// and visibility of results. Note the endpoint does not require auth.
string_view request_user_id;
/// Pass the s2s server making the request to determine access to features
/// and visibility of results.
string_view request_node_id;
opts() = default;
opts(const string_view &search_term) noexcept; // special
};

View File

@ -133,7 +133,7 @@ get__publicrooms(client &client,
opts.search_term = search_term;
opts.lower_bound = true;
opts.room_id = since;
opts.request_user_id = request.user_id;
if(m::valid(m::id::USER, search_term))
opts.user_id = search_term;

View File

@ -113,6 +113,7 @@ handle_get(client &client,
opts.lower_bound = true;
opts.room_id = since;
opts.search_term = search_term;
opts.request_node_id = request.node_id;
size_t count{0};
m::room::id::buf prev_batch_buf;