Skip to main content

Module roles

Module roles 

Source
Expand description

Role management checks (permissions §4.2, specification §8.4). cp is the actor’s effective community permissions; the required MANAGE_ROLES bit is checked by the table.

Functions§

can_assign
Whether actor could assign role right now: the check behind invitation default roles and approval (permissions §4.7, specification §8.6 and §8.9). cp must hold MANAGE_ROLES unless the actor is the owner.
can_grant
Hierarchy over a role being granted, without MANAGE_ROLES: not @everyone, H4, and its known bits held (H3). Used by membership.approve (specification §8.9).
member_role_change
member.roles.update for one role role on target: H1; H2 unless self; H4 on the role; when assigning, role.permissions ⊆ cp (H3). @everyone is never listed.
role_create
role.create: H3 on the new role’s bits. Returns the new role’s position; the engine shifts every role at or above it up by one.
role_delete
role.delete: not @everyone; H4.
role_reorder
role.reorder: roles is the community’s role table, moves the request’s (role_id, new_position) pairs. Every role whose position changes must be below the actor before and after; positions must stay unique and non-zero; @everyone cannot be listed. The owner may move any other role.
role_update
role.update: H4 on the role, H3 on old XOR new. @everyone may change only its permissions (other_fields is true when the body changes anything else).