Follow new role scheme in Prosody

Prosody changed its role scheme to only support a single primary role
for each user. In addition, the names of the built-in roles have been
changed. We thus follow those changes to be compatible with the most
recent trunk.

One open question is whether we should switch admin -> operator here,
too (operator being a server-wide admin), but so far there's no need
to.
This commit is contained in:
Jonas Schäfer
2023-03-29 18:42:53 +02:00
parent fd566b7f30
commit fcfcdbeb23
3 changed files with 7 additions and 7 deletions

View File

@@ -77,7 +77,7 @@ class EditUserForm(BaseForm):
_l("Access Level"),
choices=[
("prosody:restricted", _("Limited")),
("prosody:normal", _l("Normal user")),
("prosody:user", _l("Normal user")),
("prosody:admin", _l("Administrator")),
],
)
@@ -116,7 +116,7 @@ async def edit_user(localpart: str) -> typing.Union[werkzeug.Response, str]:
await client.update_user(
localpart,
display_name=form.display_name.data,
roles=[form.role.data],
role=form.role.data,
)
await flash(
@@ -131,7 +131,7 @@ async def edit_user(localpart: str) -> typing.Union[werkzeug.Response, str]:
if target_user_info.roles:
form.role.data = target_user_info.roles[0]
else:
form.role.data = "prosody:normal"
form.role.data = "prosody:user"
return await render_template(
"admin_edit_user.html",