Merge branch 'master' into register_token

This commit is contained in:
Dirk Klimpel 2021-11-15 21:38:58 +01:00 committed by GitHub
commit 30ede32e94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 62 additions and 35 deletions

View File

@ -1,5 +1,5 @@
# Builder # Builder
FROM node:current as builder FROM node:lts as builder
WORKDIR /src WORKDIR /src

View File

@ -5,6 +5,7 @@
This project is built using [react-admin](https://marmelab.com/react-admin/). This project is built using [react-admin](https://marmelab.com/react-admin/).
It needs at least Synapse v1.42.0 for all functions to work as expected! It needs at least Synapse v1.42.0 for all functions to work as expected!
You get your server version with the request `/_synapse/admin/v1/server_version`. You get your server version with the request `/_synapse/admin/v1/server_version`.

View File

@ -59,7 +59,7 @@ export const RoomDirectoryBulkDeleteButton = props => (
<BulkDeleteButton <BulkDeleteButton
{...props} {...props}
label="resources.room_directory.action.erase" label="resources.room_directory.action.erase"
undoable={false} mutationMode="pessimistic"
confirmTitle="resources.room_directory.action.title" confirmTitle="resources.room_directory.action.title"
confirmContent="resources.room_directory.action.content" confirmContent="resources.room_directory.action.content"
resource="room_directory" resource="room_directory"
@ -191,7 +191,7 @@ export const FilterableRoomDirectoryList = ({
filters={<RoomDirectoryFilter />} filters={<RoomDirectoryFilter />}
perPage={100} perPage={100}
> >
<Datagrid> <Datagrid rowClick={(id, basePath, record) => "/rooms/" + id + "/show"}>
<AvatarField <AvatarField
source="avatar_src" source="avatar_src"
sortable={false} sortable={false}

View File

@ -24,7 +24,10 @@ const ServerNoticeDialog = ({ open, loading, onClose, onSend }) => {
const ServerNoticeToolbar = props => ( const ServerNoticeToolbar = props => (
<Toolbar {...props}> <Toolbar {...props}>
<SaveButton label="resources.servernotices.action.send" /> <SaveButton
label="resources.servernotices.action.send"
disabled={props.pristine}
/>
<Button label="ra.action.cancel" onClick={onClose}> <Button label="ra.action.cancel" onClick={onClose}>
<IconCancel /> <IconCancel />
</Button> </Button>

View File

@ -315,7 +315,7 @@ const RoomBulkActionButtons = props => (
{...props} {...props}
confirmTitle="resources.rooms.action.erase.title" confirmTitle="resources.rooms.action.erase.title"
confirmContent="resources.rooms.action.erase.content" confirmContent="resources.rooms.action.erase.content"
undoable={false} mutationMode="pessimistic"
/> />
</Fragment> </Fragment>
); );

View File

@ -36,7 +36,9 @@ import {
BulkDeleteButton, BulkDeleteButton,
DeleteButton, DeleteButton,
SaveButton, SaveButton,
maxLength,
regex, regex,
required,
useTranslate, useTranslate,
Pagination, Pagination,
CreateButton, CreateButton,
@ -142,7 +144,7 @@ const UserBulkActionButtons = props => (
{...props} {...props}
label="resources.users.action.erase" label="resources.users.action.erase"
confirmTitle="resources.users.helper.erase" confirmTitle="resources.users.helper.erase"
undoable={false} mutationMode="pessimistic"
/> />
</Fragment> </Fragment>
); );
@ -180,10 +182,16 @@ export const UserList = props => {
}; };
// https://matrix.org/docs/spec/appendices#user-identifiers // https://matrix.org/docs/spec/appendices#user-identifiers
const validateUser = regex( // here only local part of user_id
/^@[a-z0-9._=\-/]+:.*/, // maxLength = 255 - "@" - ":" - localStorage.getItem("home_server").length
"synapseadmin.users.invalid_user_id" // localStorage.getItem("home_server").length is not valid here
); const validateUser = [
required(),
maxLength(253),
regex(/^[a-z0-9._=\-/]+$/, "synapseadmin.users.invalid_user_id"),
];
const validateAddress = [required(), maxLength(255)];
export function generateRandomUser() { export function generateRandomUser() {
const homeserver = localStorage.getItem("home_server"); const homeserver = localStorage.getItem("home_server");
@ -230,7 +238,7 @@ const UserEditToolbar = props => {
const translate = useTranslate(); const translate = useTranslate();
return ( return (
<Toolbar {...props}> <Toolbar {...props}>
<SaveButton submitOnEnter={true} /> <SaveButton submitOnEnter={true} disabled={props.pristine} />
<DeleteButton <DeleteButton
label="resources.users.action.erase" label="resources.users.action.erase"
confirmTitle={translate("resources.users.helper.erase", { confirmTitle={translate("resources.users.helper.erase", {
@ -247,8 +255,12 @@ export const UserCreate = props => (
<Create {...props}> <Create {...props}>
<SimpleForm> <SimpleForm>
<TextInput source="id" autoComplete="off" validate={validateUser} /> <TextInput source="id" autoComplete="off" validate={validateUser} />
<TextInput source="displayname" /> <TextInput source="displayname" validate={maxLength(256)} />
<PasswordInput source="password" autoComplete="new-password" /> <PasswordInput
source="password"
autoComplete="new-password"
validate={maxLength(512)}
/>
<BooleanInput source="admin" /> <BooleanInput source="admin" />
<ArrayInput source="threepids"> <ArrayInput source="threepids">
<SimpleFormIterator> <SimpleFormIterator>
@ -258,8 +270,19 @@ export const UserCreate = props => (
{ id: "email", name: "resources.users.email" }, { id: "email", name: "resources.users.email" },
{ id: "msisdn", name: "resources.users.msisdn" }, { id: "msisdn", name: "resources.users.msisdn" },
]} ]}
validate={required()}
/>
<TextInput source="address" validate={validateAddress} />
</SimpleFormIterator>
</ArrayInput>
<ArrayInput source="external_ids" label="synapseadmin.users.tabs.sso">
<SimpleFormIterator>
<TextInput source="auth_provider" validate={required()} />
<TextInput
source="external_id"
label="resources.users.fields.id"
validate={required()}
/> />
<TextInput source="address" />
</SimpleFormIterator> </SimpleFormIterator>
</ArrayInput> </ArrayInput>
</SimpleForm> </SimpleForm>
@ -339,16 +362,16 @@ export const UserEdit = props => {
icon={<AssignmentIndIcon />} icon={<AssignmentIndIcon />}
path="sso" path="sso"
> >
<ArrayField source="external_ids" label={false}> <ArrayInput source="external_ids" label={false}>
<Datagrid style={{ width: "100%" }}> <SimpleFormIterator>
<TextField source="auth_provider" sortable={false} /> <TextInput source="auth_provider" validate={required()} />
<TextField <TextInput
source="external_id" source="external_id"
label="resources.users.fields.id" label="resources.users.fields.id"
sortable={false} validate={required()}
/> />
</Datagrid> </SimpleFormIterator>
</ArrayField> </ArrayInput>
</FormTab> </FormTab>
<FormTab <FormTab

View File

@ -12,8 +12,7 @@ const de = {
url_error: "Keine gültige Matrix Server URL", url_error: "Keine gültige Matrix Server URL",
}, },
users: { users: {
invalid_user_id: invalid_user_id: "Lokaler Anteil der Matrix Benutzer-ID ohne Homeserver.",
"Muss eine vollständige Matrix Benutzer-ID sein, z.B. @benutzer_id:homeserver",
tabs: { sso: "SSO" }, tabs: { sso: "SSO" },
}, },
rooms: { rooms: {

View File

@ -12,8 +12,7 @@ const en = {
url_error: "Not a valid Matrix server URL", url_error: "Not a valid Matrix server URL",
}, },
users: { users: {
invalid_user_id: invalid_user_id: "Localpart of a Matrix user-id without homeserver.",
"Must be a fully qualified Matrix user-id, e.g. @user_id:homeserver",
tabs: { sso: "SSO" }, tabs: { sso: "SSO" },
}, },
rooms: { rooms: {

View File

@ -41,7 +41,9 @@ const resourceMap = {
data: "users", data: "users",
total: json => json.total, total: json => json.total,
create: data => ({ create: data => ({
endpoint: `/_synapse/admin/v2/users/${data.id}`, endpoint: `/_synapse/admin/v2/users/@${data.id}:${localStorage.getItem(
"home_server"
)}`,
body: data, body: data,
method: "PUT", method: "PUT",
}), }),

View File

@ -7729,9 +7729,9 @@ minipass-pipeline@^1.2.2:
minipass "^3.0.0" minipass "^3.0.0"
minipass@^3.0.0, minipass@^3.1.1: minipass@^3.0.0, minipass@^3.1.1:
version "3.1.3" version "3.1.5"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.3.tgz#7d42ff1f39635482e15f9cdb53184deebd5815fd" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.1.5.tgz#71f6251b0a33a49c01b3cf97ff77eda030dff732"
integrity sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg== integrity sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw==
dependencies: dependencies:
yallist "^4.0.0" yallist "^4.0.0"
@ -11077,9 +11077,9 @@ tapable@^1.0.0, tapable@^1.1.3:
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==
tar@^6.0.2: tar@^6.0.2:
version "6.1.8" version "6.1.11"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.8.tgz#4fc50cfe56511c538ce15b71e05eebe66530cbd4" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621"
integrity sha512-sb9b0cp855NbkMJcskdSYA7b11Q8JsX4qe4pyUAfHp+Y6jBjJeek2ZVlwEfWayshEIwlIzXx0Fain3QG9JPm2A== integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==
dependencies: dependencies:
chownr "^2.0.0" chownr "^2.0.0"
fs-minipass "^2.0.0" fs-minipass "^2.0.0"
@ -11213,9 +11213,9 @@ tiny-warning@^1.0.0, tiny-warning@^1.0.2, tiny-warning@^1.0.3:
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
tmpl@1.0.x: tmpl@1.0.x:
version "1.0.4" version "1.0.5"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==
to-arraybuffer@^1.0.0: to-arraybuffer@^1.0.0:
version "1.0.1" version "1.0.1"