Skip to content

Commit f7b2a2b

Browse files
Merge branch 'main' into fix-conversion-in-peak
2 parents 4c95dc6 + 3cdd854 commit f7b2a2b

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/users/filters.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,25 +180,19 @@ impl Filters {
180180
let read = self.0.read().await;
181181

182182
let mut filters = Vec::new();
183-
183+
let permissions = Users.get_permissions(key);
184184
for f in read.iter() {
185-
let query = if let Some(q) = &f.query.filter_query {
186-
q
187-
} else {
188-
continue;
189-
};
185+
let query: &str = f.query.filter_query.as_deref().unwrap_or("");
190186
let filter_type = &f.query.filter_type;
191187

192-
// if filter type is one of SQL or filter
193-
// then check if the user has access to the dataset based on the query string
194-
// if filter type is search then check if the user has access to the dataset based on the dataset name
195-
if *filter_type == FilterType::SQL || *filter_type == FilterType::Filter {
188+
// if filter type is SQL, check if the user has access to the dataset based on the query string
189+
// if filter type is search or filter, check if the user has access to the dataset based on the dataset name
190+
if *filter_type == FilterType::SQL {
196191
if (user_auth_for_query(key, query).await).is_ok() {
197192
filters.push(f.clone())
198193
}
199-
} else if *filter_type == FilterType::Search {
194+
} else if *filter_type == FilterType::Search || *filter_type == FilterType::Filter {
200195
let dataset_name = &f.stream_name;
201-
let permissions = Users.get_permissions(key);
202196
if user_auth_for_datasets(&permissions, &[dataset_name.to_string()]).is_ok() {
203197
filters.push(f.clone())
204198
}

0 commit comments

Comments
 (0)