matrix-spec/event-schemas/schema/m.room.power_levels
Travis Ralston 45c68e323a Add general clarity to the /createRoom endpoint
This commit does a number of things:
* Minor formatting/alignment changes
* Document the room_alias response key. This could be deprecated now, or forfeited, if needed.
* Remove the guest_can_join parameter - it is not actually supported
* Document the previously undocumented power_level_content_override parameter
* Clarify that the room_id is required on the response
* More clearly spell out which events are created as part of the request
* Clarify how the room alias becomes the canonical alias
* Clarify how the `visibility` may be used to determine a default preset to apply
* Document the `m.federate` creation content parameter, adding an option for the homeserver to define a default value

References:
* Preset being inferred by the visibility: cd32c19a60/synapse/handlers/room.py (L172-L177)
* Power level content overrides:
  * https://github.com/matrix-org/synapse/blob/master/synapse/handlers/room.py#L198
  * https://github.com/matrix-org/synapse/blob/master/synapse/handlers/room.py#L335-L359
* Aliases becoming canonical: https://github.com/matrix-org/synapse/blob/master/synapse/handlers/room.py#L366-L370
* `m.federate` landing in the create event: https://github.com/matrix-org/synapse/blob/master/synapse/handlers/room.py#L311-L315

Fixes https://github.com/matrix-org/matrix-doc/issues/1243
Fixes https://github.com/matrix-org/matrix-doc/issues/1471
Inspired by https://github.com/matrix-org/matrix-doc/issues/1213
2018-08-15 17:25:30 -06:00

57 lines
2.4 KiB
Plaintext

---
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, 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:
$ref: "../power_level_content_schema.yaml"
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