weirdnet-collab 0.3.0

Collaboration control for Weirdnet apps: project members and roles, signed allow and deny rules, owner consent grants, a decision with a reason chain, invites and a signed, mergeable audit log. App-agnostic: the app defines what a project, role and permission are.
Documentation
//! Names the app chooses: projects, roles, permissions, streams and records.
use serde::{Deserialize, Serialize};
use std::fmt;

macro_rules! name {
    ($(#[$m:meta])* $t:ident) => {
        $(#[$m])*
        #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
        #[serde(transparent)]
        pub struct $t(pub String);

        impl $t {
            /// From text.
            pub fn new(s: impl Into<String>) -> Self {
                $t(s.into())
            }

            /// The text.
            pub fn as_str(&self) -> &str {
                &self.0
            }
        }

        impl fmt::Display for $t {
            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                f.write_str(&self.0)
            }
        }

        impl From<&str> for $t {
            fn from(s: &str) -> Self {
                $t(s.to_string())
            }
        }
    };
}

name!(
    /// A project: the one scope permissions stop at.
    ProjectId
);
name!(
    /// A role such as `host`, `editor` or `viewer`; the app defines the set.
    RoleId
);
name!(
    /// A permission such as `project.edit`; the app defines the catalog.
    Permission
);
name!(
    /// A stream: only owner consent looks at one.
    StreamId
);
name!(
    /// A rule, grant, invite or audit entry id.
    RecordId
);