pub trait Rbac {
    type Role: BorshSerialize + IntoStorageKey;

    fn root() -> Slot<()> { ... }
    fn slot_members_of(role: &Self::Role) -> Slot<UnorderedSet<AccountId>> { ... }
    fn with_members_of<T>(
        role: &Self::Role,
        f: impl FnOnce(&mut UnorderedSet<AccountId>) -> T
    ) -> T { ... } fn iter_members_of(role: &Self::Role) -> Iter { ... } fn has_role(account_id: &AccountId, role: &Self::Role) -> bool { ... } fn add_role(&mut self, account_id: AccountId, role: &Self::Role) { ... } fn remove_role(&mut self, account_id: &AccountId, role: &Self::Role) { ... } fn require_role(role: &Self::Role) { ... } fn prohibit_role(role: &Self::Role) { ... } }
Expand description

Role-based access control

Required Associated Types

Roles type (probably an enum).

Provided Methods

Storage slot namespace for items.

Storage slot for the backing UnorderedSet of all accounts assigned to a role.

Deserializes the backing UnorderedSet structure, executes predicate f on it, and reserializes the structure, returning the return value of f.

Iterates over all accounts that have been assigned a role.

Returns whether a given account has been given a certain role.

Assigns a role to an account.

Removes a role from an account.

Requires transaction predecessor to have a given role.

Requires transaction predecessor to not have a given role.

Implementors