Skip to content

Commit

Permalink
Merge pull request #195 from etkecc/add-account-suspention
Browse files Browse the repository at this point in the history
Add support for Account Suspension (MSC3823)
  • Loading branch information
aine-etke authored Dec 11, 2024
2 parents f58562c + 149f573 commit 687e336
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 8 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,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",
Expand All @@ -182,6 +184,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.",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,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",
Expand All @@ -155,6 +157,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.",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/fa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ const fa: SynapseTranslationMessages = {
is_guest: "مهمان",
admin: "مدیر سرور",
deactivated: "غیرفعال",
locked: "قفل شده",
suspended: "معلق",
guests: "نمایش مهمانان",
show_deactivated: "نمایش کاربران غیرفعال شده",
show_locked: "نمایش کاربران قفل شده",
show_suspended: "نمایش کاربران معلق",
user_id: "جستجوی کاربر",
displayname: "نام نمایشی",
password: "رمز عبور",
Expand All @@ -147,6 +150,7 @@ const fa: SynapseTranslationMessages = {
password: "با تغییر رمز عبور کاربر از تمام دستگاه ها خارج می شود.",
create_password: "رمز عبور قوی و امنی را با استفاده از دکمه زیر ایجاد کنید.",
deactivate: "برای فعالسازی مجدد حساب باید رمز عبور وارد کنید.",
suspend: "کاربران معلق نمی توانند وارد شوند و پیام های آنها به دیگران نمایش داده نمی شود.",
erase: "کاربر را به عنوان GDPR پاک شده علامت گذاری کنید",
erase_text: "وهذا يعني أن الرسائل المرسلة من قبل المستخدم (المستخدمين) ستظل مرئية من قبل أي شخص كان في الغرفة عند إرسال هذه الرسائل، ولكنها مخفية عن المستخدمين الذين ينضمون إلى الغرفة بعد ذلك.",
erase_admin_error: "حذف المستخدم الخاص غير مسموح به.",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,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",
Expand All @@ -150,6 +152,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.",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,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;
Expand All @@ -147,6 +149,7 @@ interface SynapseTranslationMessages extends TranslationMessages {
password: string;
create_password: string;
deactivate: string;
suspend: string;
erase: string;
erase_text: string;
erase_admin_error: string;
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,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",
Expand All @@ -148,6 +150,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.",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ const ru: SynapseTranslationMessages = {
is_guest: "Гость",
admin: "Администратор сервера",
locked: "Заблокирован",
suspended: "Приостановлен",
deactivated: "Деактивирован",
erased: "Удалён",
guests: "Показывать гостей",
show_deactivated: "Показывать деактивированных",
show_locked: "Показывать заблокированных",
show_suspended: "Показывать приостановленных",
user_id: "Поиск пользователя",
displayname: "Отображаемое имя",
password: "Пароль",
Expand All @@ -185,6 +187,7 @@ const ru: SynapseTranslationMessages = {
password: "Смена пароля завершит все сессии пользователя.",
create_password: "Сгенерировать надёжный и безопасный пароль, используя кнопку ниже.",
deactivate: "Вы должны предоставить пароль для реактивации учётной записи.",
suspend: "Приостановка учётной записи означает, что пользователь не сможет войти в свою учётную запись, пока она не будет снова активирована.",
erase: "Пометить пользователя как удалённого в соответствии с GDPR",
erase_text: "Это означает, что сообщения, отправленные пользователем (-ами), будут по-прежнему видны всем, кто находился в комнате в момент их отправки, но будут скрыты от пользователей, присоединившихся к комнате после этого.",
erase_admin_error: "Удаление собственного пользователя запрещено.",
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,13 @@ const zh: SynapseTranslationMessages = {
name: "用户名",
is_guest: "访客",
admin: "服务器管理员",
locked: "锁定",
deactivated: "被禁用",
suspended: "被锁定",
guests: "显示访客",
show_deactivated: "显示被禁用的账户",
show_locked: "显示被锁定的账户",
show_suspended: "显示被锁定的账户",
user_id: "搜索用户",
displayname: "显示名字",
password: "密码",
Expand All @@ -173,6 +176,7 @@ const zh: SynapseTranslationMessages = {
password: "更改密码会使用户注销所有会话。",
create_password: "使用下面的按钮生成一个强大和安全的密码。",
deactivate: "您必须提供一串密码来激活账户。",
suspend: "您必须提供一串密码来暂停账户。",
erase: "将用户标记为根据 GDPR 的要求抹除了",
erase_text: "这意味着用户发送的信息对于发送信息时在房间内的任何人来说都是可见的,但对于之后加入房间的用户来说则是隐藏的。",
erase_admin_error: "不允许删除自己的用户",
Expand Down
5 changes: 4 additions & 1 deletion src/resources/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const userFilters = [
<BooleanInput source="guests" alwaysOn />,
<BooleanInput label="resources.users.fields.show_deactivated" source="deactivated" alwaysOn />,
<BooleanInput label="resources.users.fields.show_locked" source="locked" alwaysOn />,
<BooleanInput label="resources.users.fields.show_suspended" source="suspended" alwaysOn />,
];

const UserPreventSelfDelete: React.FC<{ children: React.ReactNode; ownUserIsSelected: boolean; asManagedUserIsSelected: boolean }> = props => {
Expand Down Expand Up @@ -162,7 +163,7 @@ export const UserList = (props: ListProps) => (
<List
{...props}
filters={userFilters}
filterDefaultValues={{ guests: true, deactivated: false, locked: false }}
filterDefaultValues={{ guests: true, deactivated: false, locked: false, suspended: false }}
sort={{ field: "name", order: "ASC" }}
actions={<UserListActions />}
pagination={<UserPagination />}
Expand All @@ -179,6 +180,7 @@ export const UserList = (props: ListProps) => (
<BooleanField source="admin" label="resources.users.fields.admin" />
<BooleanField source="deactivated" label="resources.users.fields.deactivated" />
<BooleanField source="locked" label="resources.users.fields.locked" />
<BooleanField source="suspended" label="resources.users.fields.suspended" />
<BooleanField source="erased" sortable={false} label="resources.users.fields.erased" />
<DateField source="creation_ts" label="resources.users.fields.creation_ts_ms" showTime options={DATE_FORMAT} />
</DatagridConfigurable>
Expand Down Expand Up @@ -433,6 +435,7 @@ export const UserEdit = (props: EditProps) => {
<BooleanInput source="admin" />
<UserBooleanInput source="locked" />
<UserBooleanInput source="deactivated" helperText="resources.users.helper.deactivate" />
<UserBooleanInput source="suspended" helperText="resources.users.helper.suspend" />
<BooleanInput source="erased" disabled />
<DateField source="creation_ts_ms" showTime options={DATE_FORMAT} />
<TextField source="consent_version" />
Expand Down
4 changes: 3 additions & 1 deletion src/synapse/dataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export interface User {
external_ids: ExternalId[];
user_type?: string;
locked: boolean;
suspended?: boolean;
}

interface Device {
Expand Down Expand Up @@ -589,7 +590,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;
Expand All @@ -603,6 +604,7 @@ const baseDataProvider: SynapseDataProvider = {
guests: guests,
deactivated: deactivated,
locked: locked,
suspended: suspended,
valid: valid,
order_by: field,
dir: getSearchOrder(order),
Expand Down

0 comments on commit 687e336

Please sign in to comment.