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")}")
}Вывод
true false
pub(api) fn hasRole(role: str) -> boolСложность. O(roles).
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
role | str |
Возвращает
bool
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/rpc.oxl:135