From 880270bfe631d55f1fea75afa117b2058da3f16d Mon Sep 17 00:00:00 2001 From: Aine Date: Sat, 7 Dec 2024 14:47:19 +0200 Subject: [PATCH 1/2] Add support for MSC3823 - Account Suspension --- docker-compose-dev.yml | 2 +- src/i18n/de.ts | 3 +++ src/i18n/en.ts | 3 +++ src/i18n/fa.ts | 4 ++++ src/i18n/fr.ts | 3 +++ src/i18n/index.d.ts | 3 +++ src/i18n/it.ts | 3 +++ src/i18n/ru.ts | 3 +++ src/i18n/zh.ts | 4 ++++ src/resources/users.tsx | 5 ++++- src/synapse/dataProvider.ts | 4 +++- 11 files changed, 34 insertions(+), 3 deletions(-) diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index c91b80f..42b1cd8 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -1,6 +1,6 @@ services: synapse: - image: ghcr.io/element-hq/synapse:latest + image: ghcr.io/element-hq/synapse:develop entrypoint: python command: "-m synapse.app.homeserver -c /config/homeserver.yaml" ports: diff --git a/src/i18n/de.ts b/src/i18n/de.ts index eae2070..e26b190 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -159,11 +159,13 @@ const de: SynapseTranslationMessages = { is_guest: "Gast", admin: "Server Administrator", locked: "Gesperrt", + suspended: "Suspendiert", deactivated: "Deaktiviert", erased: "Gelöscht", guests: "Zeige Gäste", show_deactivated: "Zeige deaktivierte Benutzer", show_locked: "Zeige gesperrte Benutzer", + show_suspended: "Zeige suspendierte Benutzer", user_id: "Suche Benutzer", displayname: "Anzeigename", password: "Passwort", @@ -181,6 +183,7 @@ const de: SynapseTranslationMessages = { password: "Durch die Änderung des Passworts wird der Benutzer von allen Sitzungen abgemeldet.", create_password: "Generiere ein starkes und sicheres Passwort mit dem Button unten.", deactivate: "Sie müssen ein Passwort angeben, um ein Konto wieder zu aktivieren.", + suspend: "Ein gesperrter Benutzer kann sich nicht mehr anmelden und wird in den schreibgeschützten Modus versetzt.", erase: "DSGVO konformes Löschen der Benutzerdaten.", erase_text: "Das bedeutet, dass die von dem/den Benutzer(n) gesendeten Nachrichten für alle, die zum Zeitpunkt des Sendens im Raum waren, sichtbar bleiben, aber für Benutzer, die dem Raum später beitreten, nicht sichtbar sind.", erase_admin_error: "Das Löschen des eigenen Benutzers ist nicht erlaubt.", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 91fba59..9dc08c5 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -132,11 +132,13 @@ const en: SynapseTranslationMessages = { is_guest: "Guest", admin: "Server Administrator", locked: "Locked", + suspended: "Suspended", deactivated: "Deactivated", erased: "Erased", guests: "Show guests", show_deactivated: "Show deactivated users", show_locked: "Show locked users", + show_suspended: "Show suspended users", user_id: "Search user", displayname: "Displayname", password: "Password", @@ -154,6 +156,7 @@ const en: SynapseTranslationMessages = { password: "Changing password will log user out of all sessions.", create_password: "Generate a strong and secure password using the button below.", deactivate: "You must provide a password to re-activate an account.", + suspend: "Suspending user means they are put into a read-only mode.", erase: "Mark the user as GDPR-erased", erase_text: "This means messages sent by the user(-s) will still be visible by anyone who was in the room when these messages were sent, but hidden from users joining the room afterward.", erase_admin_error: "Deleting own user is not allowed.", diff --git a/src/i18n/fa.ts b/src/i18n/fa.ts index d1d1ccb..0308b9c 100644 --- a/src/i18n/fa.ts +++ b/src/i18n/fa.ts @@ -126,9 +126,12 @@ const fa: SynapseTranslationMessages = { is_guest: "مهمان", admin: "مدیر سرور", deactivated: "غیرفعال", + locked: "قفل شده", + suspended: "معلق", guests: "نمایش مهمانان", show_deactivated: "نمایش کاربران غیرفعال شده", show_locked: "نمایش کاربران قفل شده", + show_suspended: "نمایش کاربران معلق", user_id: "جستجوی کاربر", displayname: "نام نمایشی", password: "رمز عبور", @@ -146,6 +149,7 @@ const fa: SynapseTranslationMessages = { password: "با تغییر رمز عبور کاربر از تمام دستگاه ها خارج می شود.", create_password: "رمز عبور قوی و امنی را با استفاده از دکمه زیر ایجاد کنید.", deactivate: "برای فعالسازی مجدد حساب باید رمز عبور وارد کنید.", + suspend: "کاربران معلق نمی توانند وارد شوند و پیام های آنها به دیگران نمایش داده نمی شود.", erase: "کاربر را به عنوان GDPR پاک شده علامت گذاری کنید", erase_text: "وهذا يعني أن الرسائل المرسلة من قبل المستخدم (المستخدمين) ستظل مرئية من قبل أي شخص كان في الغرفة عند إرسال هذه الرسائل، ولكنها مخفية عن المستخدمين الذين ينضمون إلى الغرفة بعد ذلك.", erase_admin_error: "حذف المستخدم الخاص غير مسموح به.", diff --git a/src/i18n/fr.ts b/src/i18n/fr.ts index 7834aaf..12993fe 100644 --- a/src/i18n/fr.ts +++ b/src/i18n/fr.ts @@ -129,10 +129,12 @@ const fr: SynapseTranslationMessages = { is_guest: "Visiteur", admin: "Administrateur du serveur", locked: "Verrouillé", + suspended: "Suspendu", deactivated: "Désactivé", guests: "Afficher les visiteurs", show_deactivated: "Afficher les utilisateurs désactivés", show_locked: "Afficher les utilisateurs verrouillés", + show_suspended: "Afficher les utilisateurs suspendus", user_id: "Rechercher un utilisateur", displayname: "Nom d'affichage", password: "Mot de passe", @@ -149,6 +151,7 @@ const fr: SynapseTranslationMessages = { password: "Changer le mot de passe déconnectera l'utilisateur de toutes les sessions.", create_password: "Générer un mot de passe fort et sécurisé en utilisant le bouton ci-dessous.", deactivate: "Vous devrez fournir un mot de passe pour réactiver le compte.", + suspend: "L'utilisateur sera suspendu jusqu'à ce que vous le réactiviez.", erase: "Marquer l'utilisateur comme effacé conformément au RGPD", erase_text: "Cela signifie que les messages envoyés par le(s) utilisateur(s) seront toujours visibles par toute personne qui se trouvait dans la salle au moment où ces messages ont été envoyés, mais qu'ils seront cachés aux utilisateurs qui rejoindront la salle par la suite.", erase_admin_error: "La suppression de son propre utilisateur n'est pas autorisée.", diff --git a/src/i18n/index.d.ts b/src/i18n/index.d.ts index f69689a..c69b945 100644 --- a/src/i18n/index.d.ts +++ b/src/i18n/index.d.ts @@ -124,11 +124,13 @@ interface SynapseTranslationMessages extends TranslationMessages { is_guest: string; admin: string; locked?: string; // TODO: fa, zh + suspended: string; deactivated: string; erased?: string; // TODO: fa, fr, it, zh guests: string; show_deactivated: string; show_locked?: string; // TODO: de, fa, fr, it, zh + show_suspended: string; user_id: string; displayname: string; password: string; @@ -146,6 +148,7 @@ interface SynapseTranslationMessages extends TranslationMessages { password: string; create_password: string; deactivate: string; + suspend: string; erase: string; erase_text: string; erase_admin_error: string; diff --git a/src/i18n/it.ts b/src/i18n/it.ts index c9ab358..8a66b6d 100644 --- a/src/i18n/it.ts +++ b/src/i18n/it.ts @@ -126,10 +126,12 @@ const it: SynapseTranslationMessages = { is_guest: "Ospite", admin: "Amministratore", locked: "Bloccato", + suspended: "Sospeso", deactivated: "Disattivato", guests: "Mostra gli ospiti", show_deactivated: "Mostra gli utenti disattivati", show_locked: "Mostra gli utenti bloccati", + show_suspended: "Mostra gli utenti sospesi", user_id: "Cerca utente", displayname: "Nickname", password: "Password", @@ -147,6 +149,7 @@ const it: SynapseTranslationMessages = { password: "Cambiando la password l'utente verrà disconnesso da tutte le sessioni attive.", create_password: "Genera una password forte e sicura utilizzando il pulsante sottostante.", deactivate: "Devi fornire una password per riattivare l'account.", + suspend: "Sospendi l'utente", erase: "Constrassegna l'utente come cancellato dal GDPR", erase_text: "Ciò significa che i messaggi inviati dall'utente (o dagli utenti) saranno ancora visibili da chiunque si trovasse nella stanza al momento dell'invio, ma saranno nascosti agli utenti che si uniranno alla stanza in seguito.", erase_admin_error: "Non è consentito eliminare il proprio utente.", diff --git a/src/i18n/ru.ts b/src/i18n/ru.ts index 04f4d5e..5dcdd8c 100644 --- a/src/i18n/ru.ts +++ b/src/i18n/ru.ts @@ -162,11 +162,13 @@ const ru: SynapseTranslationMessages = { is_guest: "Гость", admin: "Администратор сервера", locked: "Заблокирован", + suspended: "Приостановлен", deactivated: "Деактивирован", erased: "Удалён", guests: "Показывать гостей", show_deactivated: "Показывать деактивированных", show_locked: "Показывать заблокированных", + show_suspended: "Показывать приостановленных", user_id: "Поиск пользователя", displayname: "Отображаемое имя", password: "Пароль", @@ -184,6 +186,7 @@ const ru: SynapseTranslationMessages = { password: "Смена пароля завершит все сессии пользователя.", create_password: "Сгенерировать надёжный и безопасный пароль, используя кнопку ниже.", deactivate: "Вы должны предоставить пароль для реактивации учётной записи.", + suspend: "Приостановка учётной записи означает, что пользователь не сможет войти в свою учётную запись, пока она не будет снова активирована.", erase: "Пометить пользователя как удалённого в соответствии с GDPR", erase_text: "Это означает, что сообщения, отправленные пользователем (-ами), будут по-прежнему видны всем, кто находился в комнате в момент их отправки, но будут скрыты от пользователей, присоединившихся к комнате после этого.", erase_admin_error: "Удаление собственного пользователя запрещено.", diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts index 919654c..4f3b19a 100644 --- a/src/i18n/zh.ts +++ b/src/i18n/zh.ts @@ -153,10 +153,13 @@ const zh: SynapseTranslationMessages = { name: "用户名", is_guest: "访客", admin: "服务器管理员", + locked: "锁定", deactivated: "被禁用", + suspended: "被锁定", guests: "显示访客", show_deactivated: "显示被禁用的账户", show_locked: "显示被锁定的账户", + show_suspended: "显示被锁定的账户", user_id: "搜索用户", displayname: "显示名字", password: "密码", @@ -172,6 +175,7 @@ const zh: SynapseTranslationMessages = { password: "更改密码会使用户注销所有会话。", create_password: "使用下面的按钮生成一个强大和安全的密码。", deactivate: "您必须提供一串密码来激活账户。", + suspend: "您必须提供一串密码来暂停账户。", erase: "将用户标记为根据 GDPR 的要求抹除了", erase_text: "这意味着用户发送的信息对于发送信息时在房间内的任何人来说都是可见的,但对于之后加入房间的用户来说则是隐藏的。", erase_admin_error: "不允许删除自己的用户", diff --git a/src/resources/users.tsx b/src/resources/users.tsx index 644385e..9be6423 100644 --- a/src/resources/users.tsx +++ b/src/resources/users.tsx @@ -111,6 +111,7 @@ const userFilters = [ , , , + , ]; const UserPreventSelfDelete: React.FC<{ children: React.ReactNode; ownUserIsSelected: boolean; asManagedUserIsSelected: boolean }> = props => { @@ -162,7 +163,7 @@ export const UserList = (props: ListProps) => ( } pagination={} @@ -179,6 +180,7 @@ export const UserList = (props: ListProps) => ( + @@ -433,6 +435,7 @@ export const UserEdit = (props: EditProps) => { + diff --git a/src/synapse/dataProvider.ts b/src/synapse/dataProvider.ts index 0490a5b..345012b 100644 --- a/src/synapse/dataProvider.ts +++ b/src/synapse/dataProvider.ts @@ -138,6 +138,7 @@ export interface User { external_ids: ExternalId[]; user_type?: string; locked: boolean; + suspended?: boolean; } interface Device { @@ -575,7 +576,7 @@ function getSearchOrder(order: "ASC" | "DESC") { const baseDataProvider: SynapseDataProvider = { getList: async (resource, params) => { console.log("getList " + resource); - const { user_id, name, guests, deactivated, locked, search_term, destination, valid } = params.filter; + const { user_id, name, guests, deactivated, locked, suspended, search_term, destination, valid } = params.filter; const { page, perPage } = params.pagination as PaginationPayload; const { field, order } = params.sort as SortPayload; const from = (page - 1) * perPage; @@ -589,6 +590,7 @@ const baseDataProvider: SynapseDataProvider = { guests: guests, deactivated: deactivated, locked: locked, + suspended: suspended, valid: valid, order_by: field, dir: getSearchOrder(order), From 149f5737dde83b3268713cbd292dab97c76071c6 Mon Sep 17 00:00:00 2001 From: Aine Date: Wed, 11 Dec 2024 18:51:20 +0200 Subject: [PATCH 2/2] update readme --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c184fbe..6acfb2c 100644 --- a/README.md +++ b/README.md @@ -100,12 +100,13 @@ The following changes are already implemented: * 🛑 [Prevent accidental user overwrites](https://github.com/etkecc/synapse-admin/pull/139) * 🔍 [Allow providing login form details via GET params](https://github.com/etkecc/synapse-admin/pull/140) * 🎨 [Add preferred theme colors to login page and footer](https://github.com/etkecc/synapse-admin/pull/155) -* 🔰 [Add "Assign Admin" button to the rooms](https://github.com/etkecc/synapse-admin/pull/156) +* 🛡️ [Add "Assign Admin" button to the rooms](https://github.com/etkecc/synapse-admin/pull/156) * 🖼️ [Add rooms' avatars](https://github.com/etkecc/synapse-admin/pull/158) -* 🤖 [User Badges](https://github.com/etkecc/synapse-admin/pull/160) -* 🔑 [Allow prefilling any fields on the login form via GET params](https://github.com/etkecc/synapse-admin/pull/181) -* 🖼️ [Add "Media" tab for rooms](https://github.com/etkecc/synapse-admin/pull/196) -* ➕ [Support E.164-based Matrix IDs (MSC4009)](https://github.com/etkecc/synapse-admin/pull/214) +* 🏷️ [User Badges](https://github.com/etkecc/synapse-admin/pull/160) +* 🔄 [Allow prefilling any fields on the login form via GET params](https://github.com/etkecc/synapse-admin/pull/181) +* 🎞️ [Add "Media" tab for rooms](https://github.com/etkecc/synapse-admin/pull/196) +* 📞 [Support E.164-based Matrix IDs (MSC4009)](https://github.com/etkecc/synapse-admin/pull/214) +* 🛑 [Add support for Account Suspension (MSC3823)](https://github.com/etkecc/synapse-admin/pull/195) #### exclusive for [etke.cc](https://etke.cc) customers