File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 27
27
impl < R > std:: error:: Error for Error < R > where R : std:: fmt:: Debug { }
28
28
29
29
impl Permission {
30
+ /// Return true if this instance is `Permission::Allow`.
31
+ pub fn is_allowed ( & self ) -> bool {
32
+ matches ! ( self , Permission :: Allow )
33
+ }
30
34
/// Check this permissions and produce a reply to indicate if the `resource` can be used and in which way.
31
35
///
32
36
/// Only if this permission is set to `Allow` will the resource be usable.
Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ mod permission {
25
25
assert_eq ! ( Permission :: Deny . check_opt( "hi" ) , None ) ;
26
26
assert_eq ! ( Permission :: Forbid . check_opt( "hi" ) , None ) ;
27
27
}
28
+
29
+ #[ test]
30
+ fn is_allowed ( ) {
31
+ assert ! ( Permission :: Allow . is_allowed( ) ) ;
32
+ assert ! ( !Permission :: Deny . is_allowed( ) ) ;
33
+ assert ! ( !Permission :: Forbid . is_allowed( ) ) ;
34
+ }
28
35
}
29
36
30
37
mod identity;
You can’t perform that action at this time.
0 commit comments