mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 00:09:22 +00:00
fix: permission issue for native users (#5818)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Improved code readability by adjusting indentation and line organization in the permissions checking utility - No functional changes to the existing code logic <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -51,37 +51,35 @@ pub mod enterprise_utils {
|
||||
.clone();
|
||||
|
||||
// If the user is external, check permissions
|
||||
if user.is_external {
|
||||
let stream_type_str = stream_type.as_str();
|
||||
let o2_type = format!(
|
||||
"{}:{}",
|
||||
OFGA_MODELS
|
||||
.get(stream_type_str)
|
||||
.map_or(stream_type_str, |model| model.key),
|
||||
stream_name
|
||||
);
|
||||
let stream_type_str = stream_type.as_str();
|
||||
let o2_type = format!(
|
||||
"{}:{}",
|
||||
OFGA_MODELS
|
||||
.get(stream_type_str)
|
||||
.map_or(stream_type_str, |model| model.key),
|
||||
stream_name
|
||||
);
|
||||
|
||||
let auth_extractor = AuthExtractor {
|
||||
auth: "".to_string(),
|
||||
method: "GET".to_string(),
|
||||
o2_type,
|
||||
org_id: org_id.to_string(),
|
||||
bypass_check: false,
|
||||
parent_id: "".to_string(),
|
||||
};
|
||||
let auth_extractor = AuthExtractor {
|
||||
auth: "".to_string(),
|
||||
method: "GET".to_string(),
|
||||
o2_type,
|
||||
org_id: org_id.to_string(),
|
||||
bypass_check: false,
|
||||
parent_id: "".to_string(),
|
||||
};
|
||||
|
||||
let has_permission = crate::handler::http::auth::validator::check_permissions(
|
||||
user_id,
|
||||
auth_extractor,
|
||||
user.role,
|
||||
user.is_external,
|
||||
)
|
||||
.await;
|
||||
let has_permission = crate::handler::http::auth::validator::check_permissions(
|
||||
user_id,
|
||||
auth_extractor,
|
||||
user.role,
|
||||
user.is_external,
|
||||
)
|
||||
.await;
|
||||
|
||||
if !has_permission {
|
||||
return Err("Unauthorized Access".to_string());
|
||||
}
|
||||
}
|
||||
if !has_permission {
|
||||
return Err("Unauthorized Access".to_string());
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user