This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
add default_power_level_content_override config option. #12618
Merged
anoadragon453
merged 36 commits into
matrix-org:develop
from
andybalaam:configurable_default_pl
May 12, 2022
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
0a6f1d1
add default_power_level_content_override config option.
ara4n 8cb9abe
changelog
ara4n ba33466
update sample config
ara4n f415534
Merge branch 'develop' into matthew/configurable_default_pl
andybalaam c3a8159
Apply default_power_level_content_override before power_level_content…
andybalaam 20e2a51
Provide an example of a default_power_level_content_override
andybalaam f7eed3a
Generate docs
andybalaam 7531942
Add a config manual entry for default_power_level_content_override
andybalaam 50b0b1e
Re-order room permissions config
andybalaam 9da3abc
Move changelog file to correct name for this PR
andybalaam 45da8d0
Tests for power level overrides
andybalaam bbea127
Merge branch 'develop' into configurable_default_pl
andybalaam 0cb64bf
Update test config to match documentation
andybalaam f863ad9
Document the way power level overrides overwrite per key
andybalaam eba1ed4
Reformat changelog for default_power_level_content_override
andybalaam 9d70d83
Explicitly mention that the config will be overlaid
andybalaam e860ec6
Expand 12618 changelog entry
andybalaam 4309993
Delete extranous sentence about MSC3779 and MSC3761
andybalaam 3aed63a
More realistic example for default_power_level_content_override
andybalaam 9c99926
Fix indent of example config
andybalaam 52197b0
Fix case of create in default power level tests
andybalaam 55e1ecc
Spread out multi-line docstring
andybalaam 21459d8
Use Python native string literal concatenation
andybalaam 08b00e1
Reduce the user of Cucumber-style Given/And comments to be more readable
andybalaam 9adeaa7
Document allowed keys inside default_power_level_content_override
andybalaam 4dda230
Move default_power_level_content_override into a member
andybalaam ae9421c
Remove assumptions about default power levels from tests
andybalaam aa43bb1
Generate sample config
andybalaam d84ba9a
Code formatting
andybalaam 990b7fa
Tidy default override if, and check against None instead of falsey
andybalaam 8122c1b
Fix typo use->used
andybalaam a91a043
Remove extraneous null presets in example config
andybalaam 383e021
Regenerate sample config
andybalaam b2ae9c9
Add wording "per room preset"
andybalaam e1a913d
Quotes for config key example
andybalaam 8a639df
Make config example valid yaml
andybalaam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add a `default_power_level_content_override` config option to set default room power levels per room preset. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -63,6 +63,19 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None: | |||||
"Invalid value for encryption_enabled_by_default_for_room_type" | ||||||
) | ||||||
|
||||||
self.default_power_level_content_override = config.get( | ||||||
"default_power_level_content_override", | ||||||
None, | ||||||
) | ||||||
if self.default_power_level_content_override is not None: | ||||||
for preset in self.default_power_level_content_override: | ||||||
if preset not in vars(RoomCreationPreset).values(): | ||||||
raise ConfigError( | ||||||
"Unrecognised room preset %s in default_power_level_content_override" | ||||||
% preset | ||||||
) | ||||||
# We validate the actual overrides when we try to apply them. | ||||||
|
||||||
def generate_config_section(self, **kwargs: Any) -> str: | ||||||
return """\ | ||||||
## Rooms ## | ||||||
|
@@ -83,4 +96,38 @@ def generate_config_section(self, **kwargs: Any) -> str: | |||||
# will also not affect rooms created by other servers. | ||||||
# | ||||||
#encryption_enabled_by_default_for_room_type: invite | ||||||
|
||||||
# Override the default power levels for rooms created on this server, per | ||||||
# room creation preset. | ||||||
# | ||||||
# The appropriate dictionary for the room preset will be applied on top | ||||||
# of the existing power levels content. | ||||||
# | ||||||
# Useful if you know that your users need special permissions in rooms | ||||||
# that they create (e.g. to send particular types of state events without | ||||||
# needing an elevated power level). This takes the same shape as the | ||||||
# `power_level_content_override` parameter in the /createRoom API, but | ||||||
# is applied before that parameter. | ||||||
andybalaam marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
# | ||||||
# Valid keys are some or all of `private_chat`, `trusted_private_chat` | ||||||
# and `public_chat`. Inside each of those should be any of the | ||||||
# properties allowed in `power_level_content_override` in the | ||||||
# /createRoom API. If any property is missing, its default value will | ||||||
# continue to be used. If any property is present, it will overwrite | ||||||
# the existing default completely (so if the `events` property exists, | ||||||
# the default event power levels will be ignored). | ||||||
# | ||||||
#default_power_level_content_override: | ||||||
# private_chat: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
# "events": | ||||||
# "com.example.myeventtype" : 0 | ||||||
# "m.room.avatar": 50 | ||||||
# "m.room.canonical_alias": 50 | ||||||
# "m.room.encryption": 100 | ||||||
# "m.room.history_visibility": 100 | ||||||
# "m.room.name": 50 | ||||||
# "m.room.power_levels": 100 | ||||||
# "m.room.server_acl": 100 | ||||||
# "m.room.tombstone": 100 | ||||||
# "events_default": 1 | ||||||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.