Check if this scope allows access to a view.
(&self, view_name: &str)
| 256 | |
| 257 | /// Check if this scope allows access to a view. |
| 258 | pub fn allows_view(&self, view_name: &str) -> bool { |
| 259 | if self.view_patterns.is_empty() { |
| 260 | return true; |
| 261 | } |
| 262 | |
| 263 | self.view_patterns |
| 264 | .iter() |
| 265 | .any(|pattern| Self::matches_pattern(pattern, view_name)) |
| 266 | } |
| 267 | |
| 268 | /// Simple glob pattern matching (supports * and ?). |
| 269 | fn matches_pattern(pattern: &str, value: &str) -> bool { |