Check a permission against a resource in one call.
(&self, permission: DelegationPermission, resource: &ResourceRef<'_>)
| 361 | |
| 362 | /// Check a permission against a resource in one call. |
| 363 | pub fn allows(&self, permission: DelegationPermission, resource: &ResourceRef<'_>) -> bool { |
| 364 | if !self.has_permission(permission) { |
| 365 | return false; |
| 366 | } |
| 367 | if let Some(server) = resource.server { |
| 368 | if !self.allows_server(server) { |
| 369 | return false; |
| 370 | } |
| 371 | } |
| 372 | if let Some(workspace) = resource.workspace { |
| 373 | if !self.allows_workspace(workspace) { |
| 374 | return false; |
| 375 | } |
| 376 | } |
| 377 | if let Some(project) = resource.project { |
| 378 | if !self.allows_project(project) { |
| 379 | return false; |
| 380 | } |
| 381 | } |
| 382 | if let Some(view) = resource.view { |
| 383 | if !self.allows_view(view) { |
| 384 | return false; |
| 385 | } |
| 386 | } |
| 387 | true |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | /// Normalize a server URL for comparison: lowercased, no trailing slash. |
no test coverage detected