File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -180,25 +180,19 @@ impl Filters {
180
180
let read = self . 0 . read ( ) . await ;
181
181
182
182
let mut filters = Vec :: new ( ) ;
183
-
183
+ let permissions = Users . get_permissions ( key ) ;
184
184
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 ( "" ) ;
190
186
let filter_type = & f. query . filter_type ;
191
187
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 {
196
191
if ( user_auth_for_query ( key, query) . await ) . is_ok ( ) {
197
192
filters. push ( f. clone ( ) )
198
193
}
199
- } else if * filter_type == FilterType :: Search {
194
+ } else if * filter_type == FilterType :: Search || * filter_type == FilterType :: Filter {
200
195
let dataset_name = & f. stream_name ;
201
- let permissions = Users . get_permissions ( key) ;
202
196
if user_auth_for_datasets ( & permissions, & [ dataset_name. to_string ( ) ] ) . is_ok ( ) {
203
197
filters. push ( f. clone ( ) )
204
198
}
You can’t perform that action at this time.
0 commit comments