Skip to content

Commit 5133d1b

Browse files
authored
Fix: Server throws "User Does not have permission to access this" occasionally (arrow flight endpoint) (#847)
reload active sessions in the do_get call to get the permissions of all available users
1 parent a498604 commit 5133d1b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

server/src/handlers/airplane.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ use tonic::{Request, Response, Status, Streaming};
6060

6161
use crate::handlers::livetail::extract_session_key;
6262
use crate::metadata::STREAM_INFO;
63+
use crate::rbac;
6364
use crate::rbac::Users;
6465

6566
use super::http::query::get_results_from_cache;
@@ -231,6 +232,20 @@ impl FlightService for AirServiceImpl {
231232
} else {
232233
None
233234
};
235+
236+
// try authorize
237+
match Users.authorize(key.clone(), rbac::role::Action::Query, None, None) {
238+
rbac::Response::Authorized => (),
239+
rbac::Response::UnAuthorized => {
240+
return Err(Status::permission_denied(
241+
"user is not authenticated to access this resource",
242+
))
243+
}
244+
rbac::Response::ReloadRequired => {
245+
return Err(Status::unauthenticated("reload required"))
246+
}
247+
}
248+
234249
let permissions = Users.get_permissions(&key);
235250

236251
authorize_and_set_filter_tags(&mut query, permissions, &stream_name).map_err(|_| {

0 commit comments

Comments
 (0)