mirror of
https://github.com/Awesome-Technologies/synapse-admin.git
synced 2025-07-22 05:24:30 +02:00
Remove possibility to create users
Change-Id: Iaa7da6efbc9da27b23ef0276dd0bb8c4a2168369
This commit is contained in:
parent
beb3303803
commit
a2e4239edd
@ -14,13 +14,10 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Datagrid,
|
Datagrid,
|
||||||
DateField,
|
DateField,
|
||||||
Create,
|
|
||||||
CreateProps,
|
|
||||||
Edit,
|
Edit,
|
||||||
EditProps,
|
EditProps,
|
||||||
List,
|
List,
|
||||||
ListProps,
|
ListProps,
|
||||||
SimpleForm,
|
|
||||||
SimpleFormIterator,
|
SimpleFormIterator,
|
||||||
TabbedForm,
|
TabbedForm,
|
||||||
FormTab,
|
FormTab,
|
||||||
@ -36,13 +33,10 @@ import {
|
|||||||
SelectInput,
|
SelectInput,
|
||||||
BulkDeleteButton,
|
BulkDeleteButton,
|
||||||
DeleteButton,
|
DeleteButton,
|
||||||
maxLength,
|
|
||||||
regex,
|
|
||||||
required,
|
required,
|
||||||
useRecordContext,
|
useRecordContext,
|
||||||
useTranslate,
|
useTranslate,
|
||||||
Pagination,
|
Pagination,
|
||||||
CreateButton,
|
|
||||||
ExportButton,
|
ExportButton,
|
||||||
TopToolbar,
|
TopToolbar,
|
||||||
NumberField,
|
NumberField,
|
||||||
@ -70,7 +64,6 @@ const UserListActions = () => {
|
|||||||
const { isLoading, total } = useListContext();
|
const { isLoading, total } = useListContext();
|
||||||
return (
|
return (
|
||||||
<TopToolbar>
|
<TopToolbar>
|
||||||
<CreateButton />
|
|
||||||
<ExportButton disabled={isLoading || total === 0} maxResults={10000} />
|
<ExportButton disabled={isLoading || total === 0} maxResults={10000} />
|
||||||
<Button component={Link} to="/import_users" label="CSV Import">
|
<Button component={Link} to="/import_users" label="CSV Import">
|
||||||
<GetAppIcon sx={{ transform: "rotate(180deg)", fontSize: "20px" }} />
|
<GetAppIcon sx={{ transform: "rotate(180deg)", fontSize: "20px" }} />
|
||||||
@ -126,14 +119,6 @@ export const UserList = (props: ListProps) => (
|
|||||||
</List>
|
</List>
|
||||||
);
|
);
|
||||||
|
|
||||||
// https://matrix.org/docs/spec/appendices#user-identifiers
|
|
||||||
// here only local part of user_id
|
|
||||||
// maxLength = 255 - "@" - ":" - storage.getItem("home_server").length
|
|
||||||
// storage.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)];
|
|
||||||
|
|
||||||
const UserEditActions = () => {
|
const UserEditActions = () => {
|
||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
@ -152,30 +137,6 @@ const UserEditActions = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UserCreate = (props: CreateProps) => (
|
|
||||||
<Create {...props}>
|
|
||||||
<SimpleForm>
|
|
||||||
<TextInput source="id" autoComplete="off" validate={validateUser} />
|
|
||||||
<TextInput source="displayname" validate={maxLength(256)} />
|
|
||||||
<PasswordInput source="password" autoComplete="new-password" validate={maxLength(512)} />
|
|
||||||
<SelectInput source="user_type" choices={choices_type} translateChoice={false} resettable />
|
|
||||||
<BooleanInput source="admin" />
|
|
||||||
<ArrayInput source="threepids">
|
|
||||||
<SimpleFormIterator disableReordering>
|
|
||||||
<SelectInput source="medium" choices={choices_medium} validate={required()} />
|
|
||||||
<TextInput source="address" validate={validateAddress} />
|
|
||||||
</SimpleFormIterator>
|
|
||||||
</ArrayInput>
|
|
||||||
<ArrayInput source="external_ids" label="synapseadmin.users.tabs.sso">
|
|
||||||
<SimpleFormIterator disableReordering>
|
|
||||||
<TextInput source="auth_provider" validate={required()} />
|
|
||||||
<TextInput source="external_id" label="resources.users.fields.id" validate={required()} />
|
|
||||||
</SimpleFormIterator>
|
|
||||||
</ArrayInput>
|
|
||||||
</SimpleForm>
|
|
||||||
</Create>
|
|
||||||
);
|
|
||||||
|
|
||||||
const UserTitle = () => {
|
const UserTitle = () => {
|
||||||
const record = useRecordContext();
|
const record = useRecordContext();
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
@ -323,7 +284,6 @@ const resource: ResourceProps = {
|
|||||||
icon: UserIcon,
|
icon: UserIcon,
|
||||||
list: UserList,
|
list: UserList,
|
||||||
edit: UserEdit,
|
edit: UserEdit,
|
||||||
create: UserCreate,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default resource;
|
export default resource;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user