---
title: "check role permission · RUAL Documentation"
description: "Whether a subject holds one permission under a root, at a path below it, by a role model the entity defines: may this badge holder open the door of this…"
canonical: https://docs.rual.nl/block-types/data/roles_check
language: en
---

# check role permission

This block is part of the [`data`](https://docs.rual.nl/block-types/data) group and was last modified in core [`v15.0.2`](https://docs.rual.nl/core-versions/150002).

Whether a subject holds one permission under a root, at a path below it, by a role model the entity defines: may this badge holder open the door of this room, may this team member edit this project, may this member send in this channel.

- model `value` required the name of a roles model the entity has (its setting roles_model_{model}), e.g. facilities, projects or chat

- root `value` the root's guid; optional when path is given

- path `array` scope ids from the root's first level to the leaf; empty is the root

- member `value` a member document's guid

- subject `value` usually a user guid; default the run's socket's user

- permission `value` required a permission the model decides, e.g. open_door, edit or send_messages

- allowed `condition`

- success `condition`

- error `value`

roles_resolve for one permission, for a guard. A model is the entity's setting roles_model_{model} (JSON) and nothing else: none is built in, and an entity without that setting has no such model (MODEL_NOT_FOUND). It names the stores of roots, members, roles and scopes and the fields linking them, and how each permission is decided. A path is scope ids from the root's first level down to the leaf (company → building → room; org → team → project; server → channel); it must be that chain under the root, else nothing is allowed; empty is the root itself. Overrides apply root to leaf, the deepest level naming the scope deciding: by "lists" (roles list scope ids they allow and deny, "*" is every scope, explicit beats "*", higher rank wins, a deny wins a tie, the owner ignores denies) or by "entries" (roles carry [{type, enabled, scopes}], read base role first then by rank; the last entry naming the deepest named level, or covering every scope, wins; none means the model's allowed_when_unset; the owner and a root whose type allows everything allow everything, staff their staff_allowed set). A role marked by the model's role.held_by_flag_field is held by exactly the members whose member.held_flag is set. The model's gate permission, if it names one, must hold at a path before any other. Results are cached per node and every write to the model's stores is heard at once. allowed is false for a non-member, at a path that is not the root's, where the gate does not hold, and when the resolver failed (error then says why: MODEL_REQUIRED, MODEL_NOT_FOUND, MODEL_INVALID, ROOT_REQUIRED, ROOT_NOT_FOUND, SUBJECT_REQUIRED, PERMISSION_REQUIRED, PATH_INVALID, PATH_UNCHECKABLE, ROLES_NOT_ENABLED).

## Version history

Introduced in [`v15.0.2`](https://docs.rual.nl/core-versions/150002).

- [`v15.0.2`](https://docs.rual.nl/core-versions/150002): block added in this release.

- [Back to `data`](https://docs.rual.nl/block-types/data): Return to the main group to view all sub-groups

- [Back to `roles`](https://docs.rual.nl/block-types/data?group=roles): Return to the group to view all blocks within this group
