Skip to main content

is_acl_path

Function is_acl_path 

Source
pub fn is_acl_path(path: &str) -> bool
Expand description

Returns true when path names an access-control resource.

This is the single ACL predicate shared by the gate, the signer, the pod proxy and manifest validation. path may be a full pod path (/pods/<owner>/… or /pods/<owner>.acl) or a relative path inside a pod. It is an ACL if and only if it does not end in / and its last segment ends in the four ASCII bytes .acl, compared byte for byte and case-sensitively.

§Examples

use stratum_node_core::is_acl_path;

assert!(is_acl_path(".acl"));
assert!(is_acl_path("a.acl"));
assert!(is_acl_path("profile/card.acl"));
assert!(is_acl_path("reports.acl"));
assert!(is_acl_path("/pods/79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798.acl"));
assert!(!is_acl_path("a.acl/"));
assert!(!is_acl_path("a.ACL"));
assert!(!is_acl_path("/pods/79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798/"));