Skip to main content

profile_acl

Function profile_acl 

Source
pub fn profile_acl(owner: &DidNostr) -> String
Expand description

Returns the ACL for the profile document of owner, exactly as the client writes it beside the card.

It has exactly two rules, each naming the card by its root-relative IRI: the owner with read, write and control, and everyone (foaf:Agent) with read. There is no acl:default. The pod server applies an ACL on one resource in place of the inherited one, and refuses one that would remove the writer’s control, so the owner rule is required. The text ends with a newline.

§Examples

use stratum_node_core::{profile_acl, DidNostr};

let owner = DidNostr::from_hex("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")?;
let acl = profile_acl(&owner);
assert_eq!(acl.matches("a acl:Authorization").count(), 2);
assert!(acl.contains(&format!("acl:accessTo </pods/{}/profile/card>", owner.to_hex())));
assert!(!acl.contains("acl:default"));