matrix-spec/data/event-schemas/schema/m.room.power_levels.yaml
Will 00c6a866e2 Move raw API and event schemas into /data directory
Historical note: this was originally a series of several commits, spread out
over several weeks. They have been squashed together to make `git annotate`
work properly.

The original commits were:
 * 91ab3934 <Will> 2021-01-25 21:16:42 -0800 Add raw API end event schemas into /data directory
 * aae22f47 <Will> 2021-01-25 21:33:06 -0800 Remove non-data files
 * 1092d4ca <Will> 2021-01-26 20:41:33 -0800 Add data-compatiuble extension (.yaml) to all data files that currently omit one
 * 21060109 <Will> 2021-01-26 20:57:28 -0800 Remove symlink to event-schemas, and update openAPI schema paths accordingly
 * 4f633845 <Travis Ralston> 2021-04-12 21:54:54 -0600 Fix event schema examples too
 * 301c7b2f <Will> 2021-02-05 10:15:42 -0800 Restore docs describing OpenAPI extensions that we use
2021-08-27 19:16:39 +01:00

111 lines
4.5 KiB
YAML

---
allOf:
- $ref: core-event-schema/state_event.yaml
description: |-
This event specifies the minimum level a user must have in order to perform a
certain action. It also specifies the levels of each user in the room.
If a ``user_id`` is in the ``users`` list, then that ``user_id`` has the
associated power level. Otherwise they have the default level
``users_default``. If ``users_default`` is not supplied, it is assumed to be
0. If the room contains no ``m.room.power_levels`` event, the room's creator has
a power level of 100, and all other users have a power level of 0.
The level required to send a certain event is governed by ``events``,
``state_default`` and ``events_default``. If an event type is specified in
``events``, then the user must have at least the level specified in order to
send that event. If the event type is not supplied, it defaults to
``events_default`` for Message Events and ``state_default`` for State
Events.
If there is no ``state_default`` in the ``m.room.power_levels`` event, the
``state_default`` is 50. If there is no ``events_default`` in the
``m.room.power_levels`` event, the ``events_default`` is 0. If the room
contains no ``m.room.power_levels`` event, *both* the ``state_default`` and
``events_default`` are 0.
The power level required to invite a user to the room, kick a user from the
room, ban a user from the room, or redact an event sent by another user, is
defined by ``invite``, ``kick``, ``ban``, and ``redact``, respectively. Each
of these levels defaults to 50 if they are not specified in the
``m.room.power_levels`` event, or if the room contains no ``m.room.power_levels``
event.
.. NOTE::
As noted above, in the absence of an ``m.room.power_levels`` event, the
``state_default`` is 0, and all users are considered to have power level 0.
That means that **any** member of the room can send an
``m.room.power_levels`` event, changing the permissions in the room.
Server implementations should therefore ensure that each room has an
``m.room.power_levels`` event as soon as it is created. See also the
documentation of the ``/createRoom`` API.
properties:
content:
properties:
ban:
description: The level required to ban a user. Defaults to 50 if unspecified.
type: integer
events:
additionalProperties:
type: integer
description: The level required to send specific event types. This is a mapping from event type to power level required.
title: Event power levels
type: object
events_default:
description: |-
The default level required to send message events. Can be
overridden by the ``events`` key. Defaults to 0 if unspecified.
type: integer
invite:
description: The level required to invite a user. Defaults to 50 if unspecified.
type: integer
kick:
description: The level required to kick a user. Defaults to 50 if unspecified.
type: integer
redact:
description: The level required to redact an event sent by another user. Defaults to 50 if unspecified.
type: integer
state_default:
description: |-
The default level required to send state events. Can be overridden
by the ``events`` key. Defaults to 50 if unspecified.
type: integer
users:
additionalProperties:
type: integer
description: The power levels for specific users. This is a mapping from ``user_id`` to power level for that user.
title: User power levels
type: object
users_default:
description: |-
The default power level for every user in the room, unless their
``user_id`` is mentioned in the ``users`` key. Defaults to 0 if
unspecified.
type: integer
notifications:
properties:
room:
type: integer
description: The level required to trigger an ``@room`` notification. Defaults to 50 if unspecified.
additionalProperties:
type: integer
description: |-
The power level requirements for specific notification types.
This is a mapping from ``key`` to power level for that notifications key.
title: Notifications
type: object
type: object
state_key:
description: A zero-length string.
pattern: '^$'
type: string
type:
enum:
- m.room.power_levels
type: string
title: Defines the power levels (privileges) of users in the room.
type: object