@strapi/admin 4.0.0-beta.13 → 4.0.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/components/AuthenticatedApp/index.js +2 -1
- package/admin/src/components/AutoReloadOverlayBlockerProvider/Blocker.js +3 -2
- package/admin/src/components/LeftMenu/index.js +5 -5
- package/admin/src/components/{UpgradePlanModal /index.js → UpgradePlanModal/index.js} +7 -11
- package/admin/src/content-manager/components/ComponentInitializer/index.js +5 -5
- package/admin/src/content-manager/components/DragLayer/index.js +3 -1
- package/admin/src/content-manager/components/DynamicTable/CellContent/Media/FileWrapper.js +4 -2
- package/admin/src/content-manager/components/DynamicTable/CellContent/Relation/PopoverContent.js +4 -4
- package/admin/src/content-manager/components/DynamicTable/CellContent/Relation/index.js +5 -5
- package/admin/src/content-manager/components/DynamicTable/CellContent/index.js +5 -5
- package/admin/src/content-manager/components/DynamicTable/ConfirmDialogDelete/index.js +3 -3
- package/admin/src/content-manager/components/DynamicTable/ConfirmDialogDeleteAll/index.js +3 -3
- package/admin/src/content-manager/components/DynamicTable/TableRows/index.js +2 -1
- package/admin/src/content-manager/components/DynamicZone/components/AddComponentButton/index.js +14 -6
- package/admin/src/content-manager/components/DynamicZone/components/Component/Rectangle.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/components/Component/index.js +11 -2
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/Category/ComponentCard/index.js +4 -4
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/Category/index.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/index.js +3 -3
- package/admin/src/content-manager/components/DynamicZone/components/DzLabel/index.js +10 -3
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +3 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +20 -20
- package/admin/src/content-manager/components/FieldComponent/Label.js +10 -4
- package/admin/src/content-manager/components/{InputJSON/Hint.js → Hint/index.js} +3 -3
- package/admin/src/content-manager/components/InputJSON/FieldError.js +9 -3
- package/admin/src/content-manager/components/InputJSON/Label.js +9 -3
- package/admin/src/content-manager/components/InputJSON/index.js +1 -1
- package/admin/src/content-manager/components/InputUID/index.js +7 -7
- package/admin/src/content-manager/components/Inputs/index.js +10 -4
- package/admin/src/content-manager/components/RepeatableComponent/AccordionGroupCustom/index.js +11 -3
- package/admin/src/content-manager/components/RepeatableComponent/AddFieldButton.js +3 -3
- package/admin/src/content-manager/components/RepeatableComponent/DragPreview.js +12 -7
- package/admin/src/content-manager/components/RepeatableComponent/DraggedItem/DraggingSibling.js +3 -3
- package/admin/src/content-manager/components/RepeatableComponent/index.js +1 -1
- package/admin/src/content-manager/components/SelectMany/ListItem.js +2 -2
- package/admin/src/content-manager/components/SelectMany/index.js +11 -2
- package/admin/src/content-manager/components/SelectOne/SingleValue.js +2 -2
- package/admin/src/content-manager/components/SelectOne/index.js +34 -21
- package/admin/src/content-manager/components/SelectWrapper/Label.js +9 -3
- package/admin/src/content-manager/components/SelectWrapper/Option.js +2 -2
- package/admin/src/content-manager/components/SelectWrapper/index.js +4 -7
- package/admin/src/content-manager/components/State/index.js +3 -3
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +3 -2
- package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +3 -3
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +5 -2
- package/admin/src/content-manager/components/Wysiwyg/WysiwygFooter.js +3 -3
- package/admin/src/content-manager/components/Wysiwyg/index.js +5 -12
- package/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js +2 -2
- package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFieldButton.js +393 -0
- package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFields.js +12 -41
- package/admin/src/content-manager/pages/EditSettingsView/components/FieldButtonContent.js +84 -0
- package/admin/src/content-manager/pages/EditSettingsView/components/FormModal.js +3 -3
- package/admin/src/content-manager/pages/EditSettingsView/components/RelationalFieldButton.js +135 -0
- package/admin/src/content-manager/pages/EditSettingsView/components/RelationalFields.js +14 -12
- package/admin/src/content-manager/pages/EditSettingsView/components/RowItemsLayout.js +39 -0
- package/admin/src/content-manager/pages/EditSettingsView/components/RowsLayout.js +32 -0
- package/admin/src/content-manager/pages/EditSettingsView/index.js +56 -5
- package/admin/src/content-manager/pages/EditView/DraftAndPublishBadge/index.js +5 -5
- package/admin/src/content-manager/pages/EditView/Header/index.js +10 -10
- package/admin/src/content-manager/pages/EditView/Informations/index.js +11 -10
- package/admin/src/content-manager/pages/EditView/index.js +7 -8
- package/admin/src/content-manager/pages/ListSettingsView/components/CardPreview.js +3 -3
- package/admin/src/content-manager/pages/ListSettingsView/components/DraggableCard.js +3 -3
- package/admin/src/content-manager/pages/ListSettingsView/components/EditFieldForm.js +3 -3
- package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +3 -3
- package/admin/src/content-manager/pages/ListSettingsView/components/SortDisplayedFields.js +3 -3
- package/admin/src/content-manager/pages/ListView/PaginationFooter/index.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +4 -0
- package/admin/src/index.js +1 -0
- package/admin/src/pages/Admin/Onboarding/index.js +4 -4
- package/admin/src/pages/AuthPage/components/ForgotPassword/index.js +10 -5
- package/admin/src/pages/AuthPage/components/ForgotPasswordSuccess/index.js +7 -7
- package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +12 -7
- package/admin/src/pages/AuthPage/components/Oops/index.js +6 -6
- package/admin/src/pages/AuthPage/components/Register/index.js +5 -14
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +10 -5
- package/admin/src/pages/AuthPage/utils/forms.js +2 -2
- package/admin/src/pages/HomePage/HomeHeader.js +5 -5
- package/admin/src/pages/HomePage/SocialLinks.js +5 -9
- package/admin/src/pages/InstalledPluginsPage/Plugins.js +111 -0
- package/admin/src/pages/InstalledPluginsPage/index.js +4 -25
- package/admin/src/pages/InstalledPluginsPage/utils/api.js +11 -0
- package/admin/src/pages/ProfilePage/index.js +10 -9
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/ContentBox/index.js +5 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +13 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/DeleteButton/index.js +6 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +12 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +7 -0
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +3 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +4 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +2 -0
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/schema.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/PaginationFooter/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/utils/validations/users/edit.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Users/utils/validations/users/profile.js +6 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +0 -1
- package/admin/src/plugins.js +14 -18
- package/admin/src/translations/en.json +1 -0
- package/admin/src/utils/getFullName.js +9 -0
- package/admin/src/utils/index.js +1 -1
- package/build/1024.1b15fbb5.chunk.js +1 -0
- package/build/1024.664cd4ee.chunk.js +1 -0
- package/build/1856.53d42ce5.chunk.js +1 -0
- package/build/1856.e06c9787.chunk.js +1 -0
- package/build/2912.591ddc96.chunk.js +1 -0
- package/build/2912.b0ac46e0.chunk.js +1 -0
- package/build/3226.0dc582b2.chunk.js +2 -0
- package/build/3226.0dc582b2.chunk.js.LICENSE.txt +15 -0
- package/build/3226.e8fe1445.chunk.js +2 -0
- package/build/3226.e8fe1445.chunk.js.LICENSE.txt +15 -0
- package/build/3471.327fa7e3.chunk.js +2 -0
- package/build/3471.327fa7e3.chunk.js.LICENSE.txt +13 -0
- package/build/4064.2683bcce.chunk.js +1 -0
- package/build/4064.56677f11.chunk.js +1 -0
- package/build/4261.a08a535e.chunk.js +1 -0
- package/build/4261.b7b7ac00.chunk.js +1 -0
- package/build/4362.60f0937a.chunk.js +1 -0
- package/build/4362.aefff6ad.chunk.js +1 -0
- package/build/4362.fd69112c.chunk.js +1 -0
- package/build/4715.2f51454b.chunk.js +1 -0
- package/build/4715.35096dd7.chunk.js +1 -0
- package/build/4715.bb03cfd8.chunk.js +1 -0
- package/build/4741.1fb6ad6e.chunk.js +2 -0
- package/build/4741.1fb6ad6e.chunk.js.LICENSE.txt +9 -0
- package/build/4741.45afdeda.chunk.js +2 -0
- package/build/4741.45afdeda.chunk.js.LICENSE.txt +9 -0
- package/build/497.05fa226b.chunk.js +1 -0
- package/build/497.838781d7.chunk.js +1 -0
- package/build/4982.5031302b.chunk.js +1 -0
- package/build/4982.a7f87e6c.chunk.js +1 -0
- package/build/5881.4bf14a31.chunk.js +2 -0
- package/build/5881.4bf14a31.chunk.js.LICENSE.txt +4 -0
- package/build/5881.deb18c91.chunk.js +2 -0
- package/build/5881.deb18c91.chunk.js.LICENSE.txt +4 -0
- package/build/6250.11ba8b50.chunk.js +1 -0
- package/build/6250.50133e63.chunk.js +1 -0
- package/build/6250.785ba0da.chunk.js +1 -0
- package/build/6925.4767e761.chunk.js +2 -0
- package/build/6925.4767e761.chunk.js.LICENSE.txt +4 -0
- package/build/7841.736189f7.chunk.js +1 -0
- package/build/7841.cc8241a5.chunk.js +1 -0
- package/build/8447.32ee17be.chunk.js +2 -0
- package/build/8447.32ee17be.chunk.js.LICENSE.txt +22 -0
- package/build/8447.686f702c.chunk.js +2 -0
- package/build/8447.686f702c.chunk.js.LICENSE.txt +22 -0
- package/build/8469.8d819a3c.chunk.js +1 -0
- package/build/849.abcc3b07.chunk.js +1 -0
- package/build/849.fc26299c.chunk.js +1 -0
- package/build/9138.86a2c5ad.chunk.js +2 -0
- package/build/9138.86a2c5ad.chunk.js.LICENSE.txt +15 -0
- package/build/9238.9258f79b.chunk.js +1 -0
- package/build/9238.f112d6c9.chunk.js +1 -0
- package/build/9964.345994e8.chunk.js +2 -0
- package/build/9964.345994e8.chunk.js.LICENSE.txt +15 -0
- package/build/Admin-authenticatedApp.62e5ca51.chunk.js +1 -0
- package/build/Admin-authenticatedApp.7bdfbab4.chunk.js +1 -0
- package/build/Admin-authenticatedApp.7e29e95b.chunk.js +1 -0
- package/build/Admin-authenticatedApp.b1104a6a.chunk.js +1 -0
- package/build/Admin-authenticatedApp.bfdec496.chunk.js +1 -0
- package/build/Admin_homePage.31e37124.chunk.js +1 -0
- package/build/Admin_homePage.4398cf1a.chunk.js +1 -0
- package/build/Admin_marketplace.201373e2.chunk.js +1 -0
- package/build/Admin_pluginsPage.db5748e1.chunk.js +1 -0
- package/build/Admin_profilePage.3aa61921.chunk.js +1 -0
- package/build/Admin_profilePage.e941f627.chunk.js +1 -0
- package/build/Admin_profilePage.f9369a69.chunk.js +1 -0
- package/build/Admin_settingsPage.363ad01d.chunk.js +1 -0
- package/build/Admin_settingsPage.60a92e51.chunk.js +1 -0
- package/build/Admin_settingsPage.ea6de611.chunk.js +1 -0
- package/build/admin-edit-roles-page.e91bd9e5.chunk.js +1 -0
- package/build/admin-edit-users.110f6f05.chunk.js +1 -0
- package/build/admin-edit-users.bcdd2e4d.chunk.js +1 -0
- package/build/admin-users.640b6123.chunk.js +1 -0
- package/build/admin-users.a2d08780.chunk.js +1 -0
- package/build/admin-users.fcabe1ed.chunk.js +1 -0
- package/build/api-tokens-create-page.451be52c.chunk.js +1 -0
- package/build/api-tokens-create-page.57119445.chunk.js +1 -0
- package/build/api-tokens-create-page.ac4285ba.chunk.js +1 -0
- package/build/api-tokens-edit-page.7b419f29.chunk.js +1 -0
- package/build/api-tokens-edit-page.b1c3ef5c.chunk.js +1 -0
- package/build/api-tokens-edit-page.b8900ddd.chunk.js +1 -0
- package/build/api-tokens-list-page.b053ddcd.chunk.js +1 -0
- package/build/api-tokens-list-page.d451255e.chunk.js +1 -0
- package/build/codemirror-addon-lint.91580cda.chunk.js +1 -0
- package/build/codemirror-theme.4a209ed5.chunk.js +1 -0
- package/build/content-manager.08eae196.chunk.js +1 -0
- package/build/content-manager.196287ea.chunk.js +1 -0
- package/build/content-manager.473d2b84.chunk.js +1 -0
- package/build/content-manager.a6c34b64.chunk.js +1 -0
- package/build/content-manager.d09d2a3a.chunk.js +1 -0
- package/build/content-type-builder.0e689f6b.chunk.js +1 -0
- package/build/content-type-builder.2a6a7156.chunk.js +1 -0
- package/build/content-type-builder.e9231547.chunk.js +1 -0
- package/build/email-settings-page.8f0ee2a7.chunk.js +1 -0
- package/build/email-settings-page.b1048dc6.chunk.js +1 -0
- package/build/en-json.6282a00f.chunk.js +1 -0
- package/build/fontawesome-css-all.162c8569.chunk.js +1 -0
- package/build/fontawesome-css.b1736497.chunk.js +1 -0
- package/build/fontawesome-js.2639263c.chunk.js +2 -0
- package/build/fontawesome-js.2639263c.chunk.js.LICENSE.txt +4 -0
- package/build/i18n-settings-page.5fe86c22.chunk.js +1 -0
- package/build/i18n-settings-page.acc3a212.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.3414cc4f.js +2 -0
- package/build/main.3414cc4f.js.LICENSE.txt +91 -0
- package/build/main.e21a82f5.js +2 -0
- package/build/main.e21a82f5.js.LICENSE.txt +91 -0
- package/build/main.f425e7e8.js +2 -0
- package/build/main.f425e7e8.js.LICENSE.txt +91 -0
- package/build/main.fa2000bd.js +2 -0
- package/build/main.fa2000bd.js.LICENSE.txt +82 -0
- package/build/main.ff33c0c2.js +2 -0
- package/build/main.ff33c0c2.js.LICENSE.txt +91 -0
- package/build/runtime~main.0685316b.js +1 -0
- package/build/runtime~main.15acd133.js +1 -0
- package/build/runtime~main.3f600349.js +1 -0
- package/build/runtime~main.44db7ede.js +1 -0
- package/build/runtime~main.cc96a027.js +1 -0
- package/build/sso-settings-page.bd7a8fd7.chunk.js +1 -0
- package/build/upload-settings.4daf6206.chunk.js +1 -0
- package/build/upload-settings.7d40d236.chunk.js +1 -0
- package/build/upload.c11a292c.chunk.js +1 -0
- package/build/upload.e53f8430.chunk.js +1 -0
- package/build/users-advanced-settings-page.2dfeffe8.chunk.js +1 -0
- package/build/users-advanced-settings-page.669b059c.chunk.js +1 -0
- package/build/users-email-settings-page.a4e19b13.chunk.js +1 -0
- package/build/users-email-settings-page.b1d1f551.chunk.js +1 -0
- package/build/users-providers-settings-page.733a51ec.chunk.js +1 -0
- package/build/users-providers-settings-page.866ddeed.chunk.js +1 -0
- package/build/users-roles-settings-page.2f12885b.chunk.js +1 -0
- package/build/users-roles-settings-page.3629c123.chunk.js +1 -0
- package/build/users-roles-settings-page.9d5895d6.chunk.js +1 -0
- package/build/users-roles-settings-page.fafcbe29.chunk.js +1 -0
- package/build/webhook-edit-page.634e50da.chunk.js +1 -0
- package/build/webhook-edit-page.f4f6935d.chunk.js +1 -0
- package/build/webhook-list-page.aae66737.chunk.js +1 -0
- package/build/webhook-list-page.fc554fbe.chunk.js +1 -0
- package/ee/admin/pages/AuthPage/components/Login/index.js +3 -3
- package/ee/admin/pages/AuthPage/components/Providers/SSOProviders.js +2 -2
- package/ee/admin/pages/AuthPage/components/Providers/index.js +12 -6
- package/ee/admin/pages/SettingsPage/SingleSignOn/index.js +119 -115
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +5 -5
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +7 -7
- package/ee/server/controllers/authentication/middlewares.js +1 -1
- package/package.json +10 -9
- package/scripts/build.js +13 -1
- package/scripts/create-dev-plugins-file.js +69 -0
- package/scripts/create-plugins-file.js +92 -0
- package/server/controllers/admin.js +8 -2
- package/server/services/content-type.js +4 -4
- package/server/services/permission/permissions-manager/sanitize.js +9 -2
- package/server/services/user.js +14 -0
- package/server/validation/authentication/register.js +2 -2
- package/server/validation/common-validators.js +1 -1
- package/server/validation/user.js +3 -3
- package/admin/src/content-manager/components/Inputs/ComingSoonInput.js +0 -72
- package/admin/src/content-manager/pages/EditSettingsView/components/FieldButton.js +0 -118
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { join, resolve, relative } = require('path');
|
|
4
|
+
const { promisify } = require('util');
|
|
5
|
+
// eslint-disable-next-line node/no-extraneous-require
|
|
6
|
+
const glob = promisify(require('glob').glob);
|
|
7
|
+
const fs = require('fs-extra');
|
|
8
|
+
const { getCorePluginsPath, createPluginsFile } = require('./create-plugins-file');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Retrieve all plugins that are inside the plugins folder
|
|
12
|
+
* @returns Object the plugins
|
|
13
|
+
*/
|
|
14
|
+
const getPluginsPackages = async () => {
|
|
15
|
+
const pathToPackages = resolve(__dirname, '..', '..', '..', 'plugins', '*');
|
|
16
|
+
const pluginsPackageDirs = await glob(pathToPackages);
|
|
17
|
+
|
|
18
|
+
return pluginsPackageDirs
|
|
19
|
+
.filter(pluginDir => {
|
|
20
|
+
return fs.existsSync(join(pluginDir, 'admin', 'src', 'index.js'));
|
|
21
|
+
})
|
|
22
|
+
.reduce((acc, current) => {
|
|
23
|
+
const depName = current
|
|
24
|
+
.replace(/\\/g, '/')
|
|
25
|
+
.split('/')
|
|
26
|
+
.slice(-1)[0];
|
|
27
|
+
|
|
28
|
+
const adminEntryPoint = join(__dirname, '..', 'admin', 'src');
|
|
29
|
+
|
|
30
|
+
const pathToPlugin = join(relative(adminEntryPoint, current), 'admin', 'src').replace(
|
|
31
|
+
/\\/g,
|
|
32
|
+
'/'
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
acc[depName] = pathToPlugin;
|
|
36
|
+
|
|
37
|
+
return acc;
|
|
38
|
+
}, {});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Write the plugins.js file or copy the plugins-dev.js file if it exists
|
|
43
|
+
*/
|
|
44
|
+
const createFile = async () => {
|
|
45
|
+
const customPluginFile = join(__dirname, '..', 'admin', 'src', 'plugins-dev.js');
|
|
46
|
+
const pluginFileDest = join(__dirname, '..', 'admin', 'src', 'plugins.js');
|
|
47
|
+
|
|
48
|
+
if (fs.existsSync(customPluginFile)) {
|
|
49
|
+
await fs.copy(customPluginFile, pluginFileDest);
|
|
50
|
+
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const corePlugins = getCorePluginsPath();
|
|
55
|
+
const plugins = await getPluginsPackages();
|
|
56
|
+
const allPlugins = { ...corePlugins, ...plugins };
|
|
57
|
+
|
|
58
|
+
return createPluginsFile(allPlugins);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
createFile()
|
|
62
|
+
.then(() => {
|
|
63
|
+
console.log('plugins.js file created');
|
|
64
|
+
process.exit();
|
|
65
|
+
})
|
|
66
|
+
.catch(err => {
|
|
67
|
+
console.error(err);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { join, resolve, relative } = require('path');
|
|
4
|
+
const { camelCase } = require('lodash');
|
|
5
|
+
const fs = require('fs-extra');
|
|
6
|
+
|
|
7
|
+
const CORE_PLUGINS = ['content-type-builder', 'email', 'upload'];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Retrieve the core plugins path
|
|
11
|
+
* @returns {Object}
|
|
12
|
+
*/
|
|
13
|
+
const getCorePluginsPath = () => {
|
|
14
|
+
const corePlugins = {};
|
|
15
|
+
|
|
16
|
+
for (const dep of CORE_PLUGINS) {
|
|
17
|
+
const packageAdminPath = join(__dirname, '..', '..', dep, 'admin', 'src');
|
|
18
|
+
|
|
19
|
+
const adminEntryPoint = resolve(join(__dirname, '..', 'admin', 'src'));
|
|
20
|
+
const pathToPlugin = join(relative(adminEntryPoint, packageAdminPath)).replace(/\\/g, '/');
|
|
21
|
+
|
|
22
|
+
corePlugins[dep] = pathToPlugin;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return corePlugins;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Retrieve the plugins real path
|
|
30
|
+
* @param {Object[]} pluginsToInstall array of plugins located in the plugins folder
|
|
31
|
+
* @returns Object of plugin's paths
|
|
32
|
+
*/
|
|
33
|
+
const getPluginToInstallPath = pluginsToInstall => {
|
|
34
|
+
const plugins = {};
|
|
35
|
+
|
|
36
|
+
for (const dep of pluginsToInstall) {
|
|
37
|
+
const packageAdminPath = join(__dirname, '..', '..', '..', 'plugins', dep, 'admin', 'src');
|
|
38
|
+
|
|
39
|
+
const adminEntryPoint = resolve(join(__dirname, '..', 'admin', 'src'));
|
|
40
|
+
const pathToPlugin = join(relative(adminEntryPoint, packageAdminPath)).replace(/\\/g, '/');
|
|
41
|
+
|
|
42
|
+
plugins[dep] = pathToPlugin;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return plugins;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Write the plugins.js file
|
|
50
|
+
* @param {Object} plugins
|
|
51
|
+
*/
|
|
52
|
+
const createPluginsFile = async plugins => {
|
|
53
|
+
const pluginFileDest = resolve(__dirname, '..', 'admin', 'src', 'plugins.js');
|
|
54
|
+
|
|
55
|
+
const allPluginsArray = Object.entries(plugins).map(([plugin, pluginPath]) => {
|
|
56
|
+
return {
|
|
57
|
+
shortName: camelCase(plugin),
|
|
58
|
+
name: plugin,
|
|
59
|
+
pluginPath,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const content = `
|
|
64
|
+
// To override this file create a plugins-dev.js one and copy the content of the plugin.js one.
|
|
65
|
+
// When starting the app the script will copy the plugins-dev.js into this one instead.
|
|
66
|
+
${allPluginsArray
|
|
67
|
+
.map(({ shortName, pluginPath }) => {
|
|
68
|
+
const req = `'${pluginPath}'`;
|
|
69
|
+
|
|
70
|
+
return `import ${shortName} from ${req};`;
|
|
71
|
+
})
|
|
72
|
+
.join('\n')}
|
|
73
|
+
|
|
74
|
+
const plugins = {
|
|
75
|
+
${[...allPluginsArray]
|
|
76
|
+
.map(({ name, shortName }) => {
|
|
77
|
+
return ` '${name}': ${shortName},`;
|
|
78
|
+
})
|
|
79
|
+
.join('\n')}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default plugins;
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
return fs.writeFile(pluginFileDest, content);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
module.exports = {
|
|
89
|
+
createPluginsFile,
|
|
90
|
+
getCorePluginsPath,
|
|
91
|
+
getPluginToInstallPath,
|
|
92
|
+
};
|
|
@@ -76,8 +76,14 @@ module.exports = {
|
|
|
76
76
|
},
|
|
77
77
|
|
|
78
78
|
async plugins(ctx) {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const enabledPlugins = strapi.config.get('enabledPlugins');
|
|
80
|
+
|
|
81
|
+
const plugins = Object.entries(enabledPlugins).map(([key, plugin]) => ({
|
|
82
|
+
name: plugin.info.name || key,
|
|
83
|
+
displayName: plugin.info.displayName || plugin.info.name || key,
|
|
84
|
+
description: plugin.info.description || '',
|
|
85
|
+
}));
|
|
86
|
+
|
|
81
87
|
ctx.send({ plugins });
|
|
82
88
|
},
|
|
83
89
|
|
|
@@ -35,11 +35,11 @@ const getNestedFields = (
|
|
|
35
35
|
if (nonAuthorizableFields.includes(key)) return fields;
|
|
36
36
|
|
|
37
37
|
const fieldPath = prefix ? `${prefix}.${key}` : key;
|
|
38
|
-
const
|
|
38
|
+
const shouldBeIncluded = !requiredOnly || attr.required === true;
|
|
39
39
|
const insideExistingFields = existingFields && existingFields.some(startsWith(fieldPath));
|
|
40
40
|
|
|
41
41
|
if (attr.type === 'component') {
|
|
42
|
-
if (
|
|
42
|
+
if (shouldBeIncluded || insideExistingFields) {
|
|
43
43
|
const compoFields = getNestedFields(components[attr.component], {
|
|
44
44
|
nestingLevel: nestingLevel - 1,
|
|
45
45
|
prefix: fieldPath,
|
|
@@ -48,7 +48,7 @@ const getNestedFields = (
|
|
|
48
48
|
existingFields,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
if (
|
|
51
|
+
if (compoFields.length === 0 && shouldBeIncluded) {
|
|
52
52
|
return fields.concat(fieldPath);
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -57,7 +57,7 @@ const getNestedFields = (
|
|
|
57
57
|
return fields;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
if (
|
|
60
|
+
if (shouldBeIncluded) {
|
|
61
61
|
return fields.concat(fieldPath);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -13,6 +13,7 @@ const {
|
|
|
13
13
|
prop,
|
|
14
14
|
uniq,
|
|
15
15
|
intersection,
|
|
16
|
+
pick,
|
|
16
17
|
} = require('lodash/fp');
|
|
17
18
|
|
|
18
19
|
const { contentTypes, traverseEntity, sanitize, pipeAsync } = require('@strapi/utils');
|
|
@@ -45,8 +46,8 @@ module.exports = ({ action, ability, model }) => {
|
|
|
45
46
|
const permittedFields = fields.shouldIncludeAll ? null : getOutputFields(fields.permitted);
|
|
46
47
|
|
|
47
48
|
return pipeAsync(
|
|
48
|
-
// Remove
|
|
49
|
-
|
|
49
|
+
// Remove unallowed fields from admin::user relations
|
|
50
|
+
traverseEntity(pickAllowedAdminUserFields, { schema }),
|
|
50
51
|
// Remove not allowed fields (RBAC)
|
|
51
52
|
traverseEntity(allowedFields(permittedFields), { schema }),
|
|
52
53
|
// Remove all fields of type 'password'
|
|
@@ -106,6 +107,12 @@ module.exports = ({ action, ability, model }) => {
|
|
|
106
107
|
|
|
107
108
|
const omitCreatorRoles = omit([`${CREATED_BY_ATTRIBUTE}.roles`, `${UPDATED_BY_ATTRIBUTE}.roles`]);
|
|
108
109
|
|
|
110
|
+
const pickAllowedAdminUserFields = ({ attribute, key, value }, { set }) => {
|
|
111
|
+
if (attribute.type === 'relation' && attribute.target === 'admin::user') {
|
|
112
|
+
set(key, pick(['id', 'firstname', 'lastname', 'username'], value));
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
109
116
|
const getInputFields = (fields = []) => {
|
|
110
117
|
const nonVisibleAttributes = getNonVisibleAttributes(schema);
|
|
111
118
|
const writableAttributes = getWritableAttributes(schema);
|
package/server/services/user.js
CHANGED
|
@@ -180,6 +180,19 @@ const findOne = async (id, populate = ['roles']) => {
|
|
|
180
180
|
return strapi.entityService.findOne('admin::user', id, { populate });
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Find one user by its email
|
|
185
|
+
* @param {string} id email
|
|
186
|
+
* @param {string || string[] || object} populate
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
189
|
+
const findOneByEmail = async (email, populate = []) => {
|
|
190
|
+
return strapi.query('admin::user').findOne({
|
|
191
|
+
where: { email },
|
|
192
|
+
populate,
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
183
196
|
/** Find many users (paginated)
|
|
184
197
|
* @param query
|
|
185
198
|
* @returns {Promise<user>}
|
|
@@ -309,6 +322,7 @@ module.exports = {
|
|
|
309
322
|
register,
|
|
310
323
|
sanitizeUser,
|
|
311
324
|
findOne,
|
|
325
|
+
findOneByEmail,
|
|
312
326
|
findPage,
|
|
313
327
|
deleteById,
|
|
314
328
|
deleteByIds,
|
|
@@ -11,7 +11,7 @@ const registrationSchema = yup
|
|
|
11
11
|
.object()
|
|
12
12
|
.shape({
|
|
13
13
|
firstname: validators.firstname.required(),
|
|
14
|
-
lastname: validators.lastname
|
|
14
|
+
lastname: validators.lastname,
|
|
15
15
|
password: validators.password.required(),
|
|
16
16
|
})
|
|
17
17
|
.required()
|
|
@@ -32,7 +32,7 @@ const adminRegistrationSchema = yup
|
|
|
32
32
|
.shape({
|
|
33
33
|
email: validators.email.required(),
|
|
34
34
|
firstname: validators.firstname.required(),
|
|
35
|
-
lastname: validators.lastname
|
|
35
|
+
lastname: validators.lastname,
|
|
36
36
|
password: validators.password.required(),
|
|
37
37
|
})
|
|
38
38
|
.required()
|
|
@@ -9,7 +9,7 @@ const userCreationSchema = yup
|
|
|
9
9
|
.shape({
|
|
10
10
|
email: validators.email.required(),
|
|
11
11
|
firstname: validators.firstname.required(),
|
|
12
|
-
lastname: validators.lastname
|
|
12
|
+
lastname: validators.lastname,
|
|
13
13
|
roles: validators.roles.min(1),
|
|
14
14
|
preferedLanguage: yup.string().nullable(),
|
|
15
15
|
})
|
|
@@ -20,7 +20,7 @@ const profileUpdateSchema = yup
|
|
|
20
20
|
.shape({
|
|
21
21
|
email: validators.email.notNull(),
|
|
22
22
|
firstname: validators.firstname.notNull(),
|
|
23
|
-
lastname: validators.lastname.
|
|
23
|
+
lastname: validators.lastname.nullable(),
|
|
24
24
|
username: validators.username.nullable(),
|
|
25
25
|
password: validators.password.notNull(),
|
|
26
26
|
currentPassword: yup
|
|
@@ -36,7 +36,7 @@ const userUpdateSchema = yup
|
|
|
36
36
|
.shape({
|
|
37
37
|
email: validators.email.notNull(),
|
|
38
38
|
firstname: validators.firstname.notNull(),
|
|
39
|
-
lastname: validators.lastname.
|
|
39
|
+
lastname: validators.lastname.nullable(),
|
|
40
40
|
username: validators.username.nullable(),
|
|
41
41
|
password: validators.password.notNull(),
|
|
42
42
|
isActive: yup.bool().notNull(),
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* CominSoonInput
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { useIntl } from 'react-intl';
|
|
9
|
-
import { TextInput } from '@strapi/design-system/TextInput';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
|
|
12
|
-
const CominSoonInput = ({ description, intlLabel, labelAction, error, name, required }) => {
|
|
13
|
-
const { formatMessage } = useIntl();
|
|
14
|
-
const label = intlLabel.id
|
|
15
|
-
? formatMessage(
|
|
16
|
-
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
|
|
17
|
-
{ ...intlLabel.values }
|
|
18
|
-
)
|
|
19
|
-
: name;
|
|
20
|
-
|
|
21
|
-
const hint = description?.id
|
|
22
|
-
? formatMessage(
|
|
23
|
-
{ id: description.id, defaultMessage: description.defaultMessage },
|
|
24
|
-
{ ...description.values }
|
|
25
|
-
)
|
|
26
|
-
: '';
|
|
27
|
-
|
|
28
|
-
const errorMessage = error ? formatMessage({ id: error, defaultMessage: error }) : '';
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<TextInput
|
|
32
|
-
disabled
|
|
33
|
-
error={errorMessage}
|
|
34
|
-
label={label}
|
|
35
|
-
labelAction={labelAction}
|
|
36
|
-
id={name}
|
|
37
|
-
hint={hint}
|
|
38
|
-
name={name}
|
|
39
|
-
onChange={() => {}}
|
|
40
|
-
placeholder="Coming soon"
|
|
41
|
-
required={required}
|
|
42
|
-
type="text"
|
|
43
|
-
value=""
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
CominSoonInput.defaultProps = {
|
|
49
|
-
description: null,
|
|
50
|
-
error: '',
|
|
51
|
-
labelAction: undefined,
|
|
52
|
-
required: false,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
CominSoonInput.propTypes = {
|
|
56
|
-
description: PropTypes.shape({
|
|
57
|
-
id: PropTypes.string.isRequired,
|
|
58
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
59
|
-
values: PropTypes.object,
|
|
60
|
-
}),
|
|
61
|
-
error: PropTypes.string,
|
|
62
|
-
intlLabel: PropTypes.shape({
|
|
63
|
-
id: PropTypes.string.isRequired,
|
|
64
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
65
|
-
values: PropTypes.object,
|
|
66
|
-
}).isRequired,
|
|
67
|
-
labelAction: PropTypes.element,
|
|
68
|
-
name: PropTypes.string.isRequired,
|
|
69
|
-
required: PropTypes.bool,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default CominSoonInput;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { Box } from '@strapi/design-system/Box';
|
|
5
|
-
import { Flex } from '@strapi/design-system/Flex';
|
|
6
|
-
import { IconButton } from '@strapi/design-system/IconButton';
|
|
7
|
-
import { Text } from '@strapi/design-system/Text';
|
|
8
|
-
import Drag from '@strapi/icons/Drag';
|
|
9
|
-
import Pencil from '@strapi/icons/Pencil';
|
|
10
|
-
import Trash from '@strapi/icons/Trash';
|
|
11
|
-
import { useIntl } from 'react-intl';
|
|
12
|
-
import ComponentFieldList from './ComponentFieldList';
|
|
13
|
-
import DynamicZoneList from './DynamicZoneList';
|
|
14
|
-
import getTrad from '../../../utils/getTrad';
|
|
15
|
-
|
|
16
|
-
const CustomIconButton = styled(IconButton)`
|
|
17
|
-
background-color: transparent;
|
|
18
|
-
path {
|
|
19
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
const CustomDragIcon = styled(Drag)`
|
|
23
|
-
height: ${12 / 16}rem;
|
|
24
|
-
width: ${12 / 16}rem;
|
|
25
|
-
path {
|
|
26
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
const CustomFlex = styled(Flex)`
|
|
30
|
-
border-right: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
const FieldButton = ({ attribute, onEditField, onDeleteField, children }) => {
|
|
34
|
-
const { formatMessage } = useIntl();
|
|
35
|
-
const getHeight = () => {
|
|
36
|
-
const higherFields = ['json', 'text', 'file', 'media', 'component', 'richtext', 'dynamiczone'];
|
|
37
|
-
|
|
38
|
-
if (attribute && higherFields.includes(attribute.type)) {
|
|
39
|
-
return `${74 / 16}rem`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return `${32 / 16}rem`;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<Flex
|
|
47
|
-
width="100%"
|
|
48
|
-
borderColor="neutral150"
|
|
49
|
-
hasRadius
|
|
50
|
-
background="neutral100"
|
|
51
|
-
minHeight={getHeight()}
|
|
52
|
-
alignItems="stretch"
|
|
53
|
-
>
|
|
54
|
-
<CustomFlex alignItems="center" paddingLeft={3} paddingRight={3}>
|
|
55
|
-
<CustomDragIcon />
|
|
56
|
-
</CustomFlex>
|
|
57
|
-
<Box overflow="hidden" width="100%">
|
|
58
|
-
<Flex paddingLeft={3} alignItems="baseline" justifyContent="space-between">
|
|
59
|
-
<Box>
|
|
60
|
-
<Text textColor="neutral800" bold>
|
|
61
|
-
{children}
|
|
62
|
-
</Text>
|
|
63
|
-
</Box>
|
|
64
|
-
<Flex>
|
|
65
|
-
<CustomIconButton
|
|
66
|
-
label={formatMessage(
|
|
67
|
-
{
|
|
68
|
-
id: getTrad('containers.ListSettingsView.modal-form.edit-label'),
|
|
69
|
-
defaultMessage: `Edit {fieldName}`,
|
|
70
|
-
},
|
|
71
|
-
{ fieldName: children }
|
|
72
|
-
)}
|
|
73
|
-
onClick={onEditField}
|
|
74
|
-
icon={<Pencil />}
|
|
75
|
-
noBorder
|
|
76
|
-
/>
|
|
77
|
-
<CustomIconButton
|
|
78
|
-
label={formatMessage(
|
|
79
|
-
{
|
|
80
|
-
id: getTrad('app.component.table.delete'),
|
|
81
|
-
defaultMessage: `Delete {target}`,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
target: children,
|
|
85
|
-
}
|
|
86
|
-
)}
|
|
87
|
-
data-testid="delete-field"
|
|
88
|
-
onClick={onDeleteField}
|
|
89
|
-
icon={<Trash />}
|
|
90
|
-
noBorder
|
|
91
|
-
/>
|
|
92
|
-
</Flex>
|
|
93
|
-
</Flex>
|
|
94
|
-
{attribute?.type === 'component' && (
|
|
95
|
-
<ComponentFieldList componentUid={attribute.component} />
|
|
96
|
-
)}
|
|
97
|
-
{attribute?.type === 'dynamiczone' && <DynamicZoneList components={attribute.components} />}
|
|
98
|
-
</Box>
|
|
99
|
-
</Flex>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
FieldButton.defaultProps = {
|
|
104
|
-
attribute: undefined,
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
FieldButton.propTypes = {
|
|
108
|
-
attribute: PropTypes.shape({
|
|
109
|
-
components: PropTypes.array,
|
|
110
|
-
component: PropTypes.string,
|
|
111
|
-
type: PropTypes.string,
|
|
112
|
-
}),
|
|
113
|
-
onEditField: PropTypes.func.isRequired,
|
|
114
|
-
onDeleteField: PropTypes.func.isRequired,
|
|
115
|
-
children: PropTypes.string.isRequired,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default FieldButton;
|