Check if an operation is allowed by this delegation.
(
&self,
permission: DelegationPermission,
repository: Option<&str>,
view: Option<&str>,
)
| 527 | |
| 528 | /// Check if an operation is allowed by this delegation. |
| 529 | pub fn allows( |
| 530 | &self, |
| 531 | permission: DelegationPermission, |
| 532 | repository: Option<&str>, |
| 533 | view: Option<&str>, |
| 534 | ) -> bool { |
| 535 | if !self.is_valid() { |
| 536 | return false; |
| 537 | } |
| 538 | |
| 539 | if !self.scope.has_permission(permission) { |
| 540 | return false; |
| 541 | } |
| 542 | |
| 543 | if let Some(repo) = repository { |
| 544 | if !self.scope.allows_repository(repo) { |
| 545 | return false; |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | if let Some(view_name) = view { |
| 550 | if !self.scope.allows_view(view_name) { |
| 551 | return false; |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | true |
| 556 | } |
| 557 | |
| 558 | /// Get the data to be signed for this delegation. |
| 559 | pub fn signing_data(&self) -> Vec<u8> { |
nothing calls this directly
no test coverage detected