method Principal.hasRole
The caller is a user who has the role named role (the name of the AppRole variant, e.g. "Support"); internal helper of has.
Example:
fn main() io {
let ann = Principal.User("ann", ["Admin"], Map.new(), false, none)
print("{ann.hasRole("Admin")} {ann.hasRole("Support")}")
}Output
true false
pub(api) fn hasRole(role: str) -> boolComplexity. O(roles).
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
role | str |
Returns
bool
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/rpc.oxl:135