@strapi/admin 4.11.2 → 4.11.4
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 -2
- package/admin/src/constants.js +90 -0
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +10 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +12 -8
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +5 -6
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +99 -178
- package/admin/src/content-manager/components/RelationInput/components/Option.js +17 -15
- package/admin/src/content-manager/components/RelationInput/components/RelationList.js +2 -2
- package/admin/src/content-manager/components/RelationInputDataManager/RelationInputDataManager.js +12 -6
- package/admin/src/content-manager/components/RelationInputDataManager/utils/select.js +18 -3
- package/admin/src/content-manager/pages/App/index.js +4 -4
- package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +9 -5
- package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +3 -4
- package/admin/src/content-manager/pages/EditView/hooks/useOnce.js +14 -0
- package/admin/src/content-manager/pages/EditView/index.js +31 -10
- package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/RelationMultiple/index.js +1 -1
- package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/utils/hasContent.js +1 -1
- package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/ConfirmDialogDelete/index.js +7 -4
- package/admin/src/content-manager/pages/ListView/components/ConfirmDialogDeleteAll/index.js +78 -0
- package/admin/src/content-manager/pages/ListView/{FieldPicker → components/FieldPicker}/index.js +20 -9
- package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/TableRows/index.js +90 -61
- package/admin/src/content-manager/pages/ListView/index.js +173 -34
- package/admin/src/content-manager/pages/ListView/utils/index.js +0 -2
- package/admin/src/content-manager/pages/ListViewLayoutManager/Permissions.js +1 -1
- package/admin/src/content-manager/pages/SingleTypeRecursivePath/index.js +4 -4
- package/admin/src/hooks/useMenu/index.js +70 -37
- package/admin/src/hooks/useMenu/utils/getGeneralLinks.js +5 -2
- package/admin/src/hooks/useSettingsMenu/constants.js +0 -7
- package/admin/src/hooks/useSettingsMenu/index.js +19 -5
- package/admin/src/pages/App/constants.js +1 -0
- package/admin/src/pages/App/index.js +23 -2
- package/admin/src/pages/App/reducer.js +8 -1
- package/admin/src/pages/App/selectors.js +12 -0
- package/admin/src/pages/AuthPage/{utils/forms.js → constants.js} +6 -8
- package/admin/src/pages/AuthPage/index.js +17 -5
- package/admin/src/pages/InstalledPluginsPage/index.js +10 -7
- package/admin/src/pages/MarketplacePage/index.js +11 -6
- package/admin/src/pages/ProfilePage/index.js +2 -2
- package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +15 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +4 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +4 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ProtectedCreateView/index.js +5 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ProtectedEditView/index.js +5 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ProtectedListView/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +130 -107
- package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +5 -3
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
- package/admin/src/pages/SettingsPage/pages/Roles/ProtectedEditPage/index.js +8 -9
- package/admin/src/pages/SettingsPage/pages/Roles/ProtectedListPage/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +4 -2
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +4 -2
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedCreateView/index.js +5 -2
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedEditView/index.js +5 -2
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedListView/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/{utils/layout.js → constants.js} +35 -2
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +43 -10
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +4 -2
- package/admin/src/pages/SettingsPage/pages/Users/ProtectedEditPage/index.js +13 -9
- package/admin/src/pages/SettingsPage/pages/Users/ProtectedListPage/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js +4 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/utils/makeWebhookValidationSchema.js +11 -5
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +4 -3
- package/admin/src/pages/SettingsPage/pages/Webhooks/ProtectedCreateView/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/Webhooks/ProtectedEditView/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/Webhooks/ProtectedListView/index.js +11 -6
- package/admin/src/translations/ca.json +1 -0
- package/admin/src/translations/en.json +4 -1
- package/admin/src/translations/es.json +5 -0
- package/admin/src/translations/fr.json +1 -0
- package/build/1386.3b2aa6a7.chunk.js +3 -0
- package/build/1799.44d2e264.chunk.js +33 -0
- package/build/1970.39a2d75e.chunk.js +1 -0
- package/build/3269.1ea0f5a6.chunk.js +1 -0
- package/build/{3528.969338e2.chunk.js → 3528.4845cf92.chunk.js} +1 -1
- package/build/448.829e1344.chunk.js +1 -0
- package/build/{5542.64b623c9.chunk.js → 5542.c62d0daf.chunk.js} +1 -1
- package/build/5563.86f9aa9c.chunk.js +79 -0
- package/build/{5932.9e1f8f92.chunk.js → 5932.6a23b88c.chunk.js} +1 -1
- package/build/{7018.0e8a6297.chunk.js → 7018.98feed67.chunk.js} +1 -1
- package/build/7259.fb69d4bf.chunk.js +1 -0
- package/build/7394.423886bd.chunk.js +1 -0
- package/build/{371.6e4e2c1f.chunk.js → 970.89601f27.chunk.js} +24 -24
- package/build/Admin-authenticatedApp.cb649fc1.chunk.js +79 -0
- package/build/{Admin_InternalErrorPage.4a6f7b20.chunk.js → Admin_InternalErrorPage.8911cb49.chunk.js} +1 -1
- package/build/{Admin_homePage.6cd6c25c.chunk.js → Admin_homePage.be30ef4e.chunk.js} +1 -1
- package/build/{Admin_marketplace.c82c1d3c.chunk.js → Admin_marketplace.74a58e20.chunk.js} +8 -8
- package/build/Admin_pluginsPage.ce464189.chunk.js +6 -0
- package/build/{Admin_profilePage.9d70d609.chunk.js → Admin_profilePage.2131eb68.chunk.js} +2 -2
- package/build/Admin_settingsPage.4069bb8a.chunk.js +79 -0
- package/build/{Upload_ConfigureTheView.34f449d7.chunk.js → Upload_ConfigureTheView.7a1cb9c9.chunk.js} +1 -1
- package/build/admin-app.fea867af.chunk.js +61 -0
- package/build/admin-edit-roles-page.3fdd6b9d.chunk.js +267 -0
- package/build/admin-edit-users.200551e3.chunk.js +10 -0
- package/build/admin-roles-list.e17b00d7.chunk.js +23 -0
- package/build/admin-users.3b12dca2.chunk.js +11 -0
- package/build/api-tokens-create-page.3dd4e921.chunk.js +1 -0
- package/build/api-tokens-edit-page.9a1dd2fa.chunk.js +1 -0
- package/build/api-tokens-list-page.a103f526.chunk.js +16 -0
- package/build/audit-logs-settings-page.f538490f.chunk.js +1 -0
- package/build/ca-json.1fed5d8b.chunk.js +1 -0
- package/build/content-manager.c40f5ff9.chunk.js +1088 -0
- package/build/{content-type-builder-list-view.c28d33a6.chunk.js → content-type-builder-list-view.a200a358.chunk.js} +3 -3
- package/build/content-type-builder.bd1bbff1.chunk.js +166 -0
- package/build/{email-settings-page.aee46eaa.chunk.js → email-settings-page.45695daa.chunk.js} +2 -2
- package/build/en-json.fb9f6ddd.chunk.js +1 -0
- package/build/es-json.42096084.chunk.js +1 -0
- package/build/fr-json.69789980.chunk.js +1 -0
- package/build/{i18n-settings-page.4bc37a3f.chunk.js → i18n-settings-page.29308d0b.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.ee36abd9.js +2927 -0
- package/build/review-workflows-settings.93808ae0.chunk.js +110 -0
- package/build/{runtime~main.2d0ed226.js → runtime~main.efd966f6.js} +2 -2
- package/build/sso-settings-page.0cdb96a6.chunk.js +1 -0
- package/build/transfer-tokens-create-page.de14cad4.chunk.js +1 -0
- package/build/transfer-tokens-edit-page.4f5e39af.chunk.js +1 -0
- package/build/transfer-tokens-list-page.7237443d.chunk.js +16 -0
- package/build/{upload-settings.a05aa26c.chunk.js → upload-settings.cb6c14c3.chunk.js} +2 -2
- package/build/upload.7e629643.chunk.js +26 -0
- package/build/users-advanced-settings-page.750b1f76.chunk.js +9 -0
- package/build/{users-email-settings-page.0bc87315.chunk.js → users-email-settings-page.e9bcd865.chunk.js} +1 -1
- package/build/{users-providers-settings-page.e88f1ac5.chunk.js → users-providers-settings-page.a94253e9.chunk.js} +1 -1
- package/build/{users-roles-settings-page.573a5c3e.chunk.js → users-roles-settings-page.1f505119.chunk.js} +5 -5
- package/build/webhook-edit-page.77ef4f1a.chunk.js +33 -0
- package/build/webhook-list-page.940a40f1.chunk.js +63 -0
- package/ee/admin/constants.js +16 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +1 -1
- package/ee/admin/hooks/useLicenseLimits/index.js +4 -2
- package/ee/admin/hooks/useSettingsMenu/constants.js +0 -5
- package/ee/admin/pages/AuthPage/constants.js +12 -0
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +7 -7
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +11 -6
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ProtectedPage.js +20 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +68 -73
- package/ee/admin/pages/SettingsPage/pages/SingleSignOn/index.js +16 -12
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/{utils/roleSettingsForm.js → constants.js} +14 -8
- package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/EventTableEE.js +8 -9
- package/ee/server/constants/webhookEvents.js +5 -0
- package/ee/server/controllers/workflows/stages/index.js +1 -1
- package/ee/server/services/passport.js +1 -1
- package/ee/server/services/review-workflows/entity-service-decorator.js +52 -1
- package/ee/server/services/review-workflows/review-workflows.js +4 -1
- package/package.json +12 -12
- package/server/content-types/User.js +10 -0
- package/server/services/permission/permissions-manager/sanitize.js +1 -1
- package/server/strategies/api-token.js +9 -5
- package/server/strategies/data-transfer.js +9 -5
- package/admin/src/content-manager/components/DynamicTable/index.js +0 -163
- package/admin/src/content-manager/components/RelationInput/components/Relation.js +0 -53
- package/admin/src/content-manager/pages/ListView/FieldPicker/utils/getAllAllowedHeader.js +0 -17
- package/admin/src/content-manager/pages/ListView/PaginationFooter/index.js +0 -35
- package/admin/src/hooks/useMenu/reducer.js +0 -63
- package/admin/src/pages/AuthPage/utils/index.js +0 -2
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +0 -8
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm.js +0 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/schema.js +0 -11
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/stepper.js +0 -17
- package/admin/src/permissions/customPermissions.js +0 -1
- package/admin/src/permissions/defaultPermissions.js +0 -92
- package/admin/src/permissions/index.js +0 -8
- package/build/1970.d246745e.chunk.js +0 -1
- package/build/3562.e0b1a0b3.chunk.js +0 -50
- package/build/5563.8a76bb1d.chunk.js +0 -79
- package/build/7259.eac09d4b.chunk.js +0 -1
- package/build/7447.3dabc92f.chunk.js +0 -35
- package/build/9363.6a7a78fc.chunk.js +0 -33
- package/build/Admin-authenticatedApp.4e158a8c.chunk.js +0 -79
- package/build/Admin_pluginsPage.5d9d4060.chunk.js +0 -6
- package/build/Admin_settingsPage.fefeafa0.chunk.js +0 -79
- package/build/admin-app.42c7a752.chunk.js +0 -63
- package/build/admin-edit-roles-page.6d62ca0b.chunk.js +0 -267
- package/build/admin-edit-users.bce64103.chunk.js +0 -10
- package/build/admin-roles-list.81ae57e3.chunk.js +0 -23
- package/build/admin-users.1ec50325.chunk.js +0 -11
- package/build/api-tokens-create-page.65411a36.chunk.js +0 -1
- package/build/api-tokens-edit-page.60312cb6.chunk.js +0 -1
- package/build/api-tokens-list-page.36a241c1.chunk.js +0 -16
- package/build/audit-logs-settings-page.fca8e2a0.chunk.js +0 -1
- package/build/ca-json.43e14418.chunk.js +0 -1
- package/build/content-manager.d6e60c78.chunk.js +0 -1094
- package/build/content-type-builder.dc0c8745.chunk.js +0 -132
- package/build/en-json.f5fa476a.chunk.js +0 -1
- package/build/es-json.715b6fd8.chunk.js +0 -1
- package/build/fr-json.73494bf5.chunk.js +0 -1
- package/build/main.9b423e8b.js +0 -2926
- package/build/review-workflows-settings.fc0b59ca.chunk.js +0 -61
- package/build/sso-settings-page.52f8d7de.chunk.js +0 -1
- package/build/transfer-tokens-create-page.9ec277d7.chunk.js +0 -1
- package/build/transfer-tokens-edit-page.fa5ade14.chunk.js +0 -1
- package/build/transfer-tokens-list-page.ae9900e4.chunk.js +0 -16
- package/build/upload.b0efd607.chunk.js +0 -26
- package/build/users-advanced-settings-page.d9e11bab.chunk.js +0 -9
- package/build/webhook-edit-page.1e8c9382.chunk.js +0 -31
- package/build/webhook-list-page.b2bcb3b6.chunk.js +0 -63
- package/ee/admin/pages/AuthPage/utils/forms.js +0 -16
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +0 -14
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/CellValue.js +0 -0
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/Media/FileWrapper.js +0 -0
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/Media/index.js +0 -0
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/MultipleMedias.js +0 -0
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/RelationSingle/index.js +0 -0
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/RepeatableComponent/index.js +0 -0
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/SingleComponent/index.js +0 -0
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/index.js +0 -0
- /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/utils/isSingleRelation.js +0 -0
|
@@ -16,10 +16,13 @@ import {
|
|
|
16
16
|
useFetchClient,
|
|
17
17
|
useNotification,
|
|
18
18
|
} from '@strapi/helper-plugin';
|
|
19
|
+
import merge from 'lodash/merge';
|
|
19
20
|
import { useIntl } from 'react-intl';
|
|
21
|
+
import { useDispatch } from 'react-redux';
|
|
20
22
|
import { Route, Switch } from 'react-router-dom';
|
|
21
23
|
|
|
22
24
|
import PrivateRoute from '../../components/PrivateRoute';
|
|
25
|
+
import { ADMIN_PERMISSIONS_CE } from '../../constants';
|
|
23
26
|
import { useConfigurations } from '../../hooks';
|
|
24
27
|
import { useEnterprise } from '../../hooks/useEnterprise';
|
|
25
28
|
import { createRoute, makeUniqueRoutes } from '../../utils';
|
|
@@ -27,7 +30,7 @@ import AuthPage from '../AuthPage';
|
|
|
27
30
|
import NotFoundPage from '../NotFoundPage';
|
|
28
31
|
import UseCasePage from '../UseCasePage';
|
|
29
32
|
|
|
30
|
-
import { ROUTES_CE } from './constants';
|
|
33
|
+
import { ROUTES_CE, SET_ADMIN_PERMISSIONS } from './constants';
|
|
31
34
|
import { getUID } from './utils';
|
|
32
35
|
|
|
33
36
|
const AuthenticatedApp = lazy(() =>
|
|
@@ -35,6 +38,14 @@ const AuthenticatedApp = lazy(() =>
|
|
|
35
38
|
);
|
|
36
39
|
|
|
37
40
|
function App() {
|
|
41
|
+
const adminPermissions = useEnterprise(ADMIN_PERMISSIONS_CE, async () => (await import('../../../../ee/admin/constants')).ADMIN_PERMISSIONS_EE, {
|
|
42
|
+
combine(cePermissions, eePermissions) {
|
|
43
|
+
// the `settings` NS e.g. are deep nested objects, that need a deep merge
|
|
44
|
+
return merge({}, cePermissions, eePermissions);
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
defaultValue: ADMIN_PERMISSIONS_CE,
|
|
48
|
+
})
|
|
38
49
|
const routes = useEnterprise(
|
|
39
50
|
ROUTES_CE,
|
|
40
51
|
async () => (await import('../../../../ee/admin/pages/App/constants')).ROUTES_EE,
|
|
@@ -49,6 +60,7 @@ function App() {
|
|
|
49
60
|
isLoading: true,
|
|
50
61
|
hasAdmin: false,
|
|
51
62
|
});
|
|
63
|
+
const dispatch = useDispatch();
|
|
52
64
|
const appInfo = useAppInfo();
|
|
53
65
|
const { get, post } = useFetchClient();
|
|
54
66
|
|
|
@@ -60,6 +72,10 @@ function App() {
|
|
|
60
72
|
|
|
61
73
|
const [telemetryProperties, setTelemetryProperties] = useState(null);
|
|
62
74
|
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
dispatch({ type: SET_ADMIN_PERMISSIONS, payload: adminPermissions });
|
|
77
|
+
}, [adminPermissions, dispatch]);
|
|
78
|
+
|
|
63
79
|
useEffect(() => {
|
|
64
80
|
const currentToken = auth.getToken();
|
|
65
81
|
|
|
@@ -110,14 +126,19 @@ function App() {
|
|
|
110
126
|
setTelemetryProperties(properties);
|
|
111
127
|
|
|
112
128
|
try {
|
|
129
|
+
const event = 'didInitializeAdministration';
|
|
113
130
|
await post('https://analytics.strapi.io/api/v2/track', {
|
|
114
131
|
// This event is anonymous
|
|
115
|
-
event
|
|
132
|
+
event,
|
|
116
133
|
userId: '',
|
|
117
134
|
deviceId,
|
|
118
135
|
eventPropeties: {},
|
|
119
136
|
userProperties: { environment: appInfo.currentEnvironment },
|
|
120
137
|
groupProperties: { ...properties, projectId: uuid },
|
|
138
|
+
}, {
|
|
139
|
+
headers: {
|
|
140
|
+
'X-Strapi-Event': event,
|
|
141
|
+
}
|
|
121
142
|
});
|
|
122
143
|
} catch (e) {
|
|
123
144
|
// Silent.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import produce from 'immer';
|
|
2
2
|
|
|
3
|
-
import { SET_APP_RUNTIME_STATUS } from './constants';
|
|
3
|
+
import { SET_APP_RUNTIME_STATUS, SET_ADMIN_PERMISSIONS } from './constants';
|
|
4
4
|
|
|
5
5
|
const initialState = {
|
|
6
|
+
permissions: {},
|
|
6
7
|
status: 'init',
|
|
7
8
|
};
|
|
8
9
|
|
|
@@ -14,6 +15,12 @@ const reducer = (state = initialState, action) =>
|
|
|
14
15
|
draftState.status = 'runtime';
|
|
15
16
|
break;
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
case SET_ADMIN_PERMISSIONS: {
|
|
20
|
+
draftState.permissions = action.payload;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
default:
|
|
18
25
|
return draftState;
|
|
19
26
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
|
|
3
|
+
import { initialState } from './reducer';
|
|
4
|
+
|
|
5
|
+
const selectAppDomain = () => (state) => {
|
|
6
|
+
return state.admin_app || initialState;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const selectAdminPermissions = createSelector(
|
|
10
|
+
selectAppDomain(),
|
|
11
|
+
(state) => state.permissions
|
|
12
|
+
);
|
|
@@ -2,13 +2,13 @@ import { translatedErrors } from '@strapi/helper-plugin';
|
|
|
2
2
|
import Login from 'ee_else_ce/pages/AuthPage/components/Login';
|
|
3
3
|
import * as yup from 'yup';
|
|
4
4
|
|
|
5
|
-
import ForgotPassword from '
|
|
6
|
-
import ForgotPasswordSuccess from '
|
|
7
|
-
import Oops from '
|
|
8
|
-
import Register from '
|
|
9
|
-
import ResetPassword from '
|
|
5
|
+
import ForgotPassword from './components/ForgotPassword';
|
|
6
|
+
import ForgotPasswordSuccess from './components/ForgotPasswordSuccess';
|
|
7
|
+
import Oops from './components/Oops';
|
|
8
|
+
import Register from './components/Register';
|
|
9
|
+
import ResetPassword from './components/ResetPassword';
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
export const FORMS = {
|
|
12
12
|
'forgot-password': {
|
|
13
13
|
Component: ForgotPassword,
|
|
14
14
|
endPoint: 'forgot-password',
|
|
@@ -119,5 +119,3 @@ const forms = {
|
|
|
119
119
|
}),
|
|
120
120
|
},
|
|
121
121
|
};
|
|
122
|
-
|
|
123
|
-
export default forms;
|
|
@@ -2,7 +2,6 @@ import React, { useEffect, useReducer } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { auth, useFetchClient, useGuidedTour, useQuery, useTracking } from '@strapi/helper-plugin';
|
|
4
4
|
import axios from 'axios';
|
|
5
|
-
import forms from 'ee_else_ce/pages/AuthPage/utils/forms';
|
|
6
5
|
import camelCase from 'lodash/camelCase';
|
|
7
6
|
import get from 'lodash/get';
|
|
8
7
|
import omit from 'lodash/omit';
|
|
@@ -11,8 +10,10 @@ import { Redirect, useHistory, useRouteMatch } from 'react-router-dom';
|
|
|
11
10
|
|
|
12
11
|
import persistStateToLocaleStorage from '../../components/GuidedTour/utils/persistStateToLocaleStorage';
|
|
13
12
|
import useLocalesProvider from '../../components/LocalesProvider/useLocalesProvider';
|
|
13
|
+
import { useEnterprise } from '../../hooks/useEnterprise';
|
|
14
14
|
import formatAPIErrors from '../../utils/formatAPIErrors';
|
|
15
15
|
|
|
16
|
+
import { FORMS } from './constants';
|
|
16
17
|
import init from './init';
|
|
17
18
|
import { initialState, reducer } from './reducer';
|
|
18
19
|
|
|
@@ -28,10 +29,19 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
28
29
|
params: { authType },
|
|
29
30
|
} = useRouteMatch('/auth/:authType');
|
|
30
31
|
const query = useQuery();
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
32
|
+
const forms = useEnterprise(
|
|
33
|
+
FORMS,
|
|
34
|
+
async () => (await import('../../../../ee/admin/pages/AuthPage/constants')).FORMS,
|
|
35
|
+
{
|
|
36
|
+
combine(ceForms, eeForms) {
|
|
37
|
+
return {
|
|
38
|
+
...ceForms,
|
|
39
|
+
...eeForms,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
defaultValue: FORMS,
|
|
44
|
+
}
|
|
35
45
|
);
|
|
36
46
|
const [{ formErrors, modifiedData, requestError }, dispatch] = useReducer(
|
|
37
47
|
reducer,
|
|
@@ -40,6 +50,8 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
|
|
|
40
50
|
);
|
|
41
51
|
const CancelToken = axios.CancelToken;
|
|
42
52
|
const source = CancelToken.source();
|
|
53
|
+
const { Component, endPoint, fieldsToDisable, fieldsToOmit, inputsPrefix, schema, ...rest } =
|
|
54
|
+
forms?.[authType] ?? {};
|
|
43
55
|
|
|
44
56
|
useEffect(() => {
|
|
45
57
|
// Cancel request on unmount
|
|
@@ -3,21 +3,24 @@ import React from 'react';
|
|
|
3
3
|
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
|
4
4
|
import { Helmet } from 'react-helmet';
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
|
+
import { useSelector } from 'react-redux';
|
|
6
7
|
|
|
7
|
-
import
|
|
8
|
+
import { selectAdminPermissions } from '../App/selectors';
|
|
8
9
|
|
|
9
10
|
import Plugins from './Plugins';
|
|
10
11
|
|
|
11
12
|
const InstalledPluginsPage = () => {
|
|
12
13
|
const { formatMessage } = useIntl();
|
|
13
|
-
const
|
|
14
|
-
id: 'global.plugins',
|
|
15
|
-
defaultMessage: 'Plugins',
|
|
16
|
-
});
|
|
14
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
17
15
|
|
|
18
16
|
return (
|
|
19
|
-
<CheckPagePermissions permissions={
|
|
20
|
-
<Helmet
|
|
17
|
+
<CheckPagePermissions permissions={permissions.marketplace.main}>
|
|
18
|
+
<Helmet
|
|
19
|
+
title={formatMessage({
|
|
20
|
+
id: 'global.plugins',
|
|
21
|
+
defaultMessage: 'Plugins',
|
|
22
|
+
})}
|
|
23
|
+
/>
|
|
21
24
|
<Plugins />
|
|
22
25
|
</CheckPagePermissions>
|
|
23
26
|
);
|
|
@@ -23,10 +23,11 @@ import {
|
|
|
23
23
|
} from '@strapi/helper-plugin';
|
|
24
24
|
import { Helmet } from 'react-helmet';
|
|
25
25
|
import { useIntl } from 'react-intl';
|
|
26
|
+
import { useSelector } from 'react-redux';
|
|
26
27
|
|
|
27
28
|
import useDebounce from '../../hooks/useDebounce';
|
|
28
29
|
import useNavigatorOnLine from '../../hooks/useNavigatorOnLine';
|
|
29
|
-
import
|
|
30
|
+
import { selectAdminPermissions } from '../App/selectors';
|
|
30
31
|
|
|
31
32
|
import MissingPluginBanner from './components/MissingPluginBanner';
|
|
32
33
|
import NpmPackagesFilters from './components/NpmPackagesFilters';
|
|
@@ -249,11 +250,15 @@ const MarketPlacePage = () => {
|
|
|
249
250
|
);
|
|
250
251
|
};
|
|
251
252
|
|
|
252
|
-
const ProtectedMarketPlace = () =>
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
const ProtectedMarketPlace = () => {
|
|
254
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<CheckPagePermissions permissions={permissions.marketplace.main}>
|
|
258
|
+
<MarketPlacePage />
|
|
259
|
+
</CheckPagePermissions>
|
|
260
|
+
);
|
|
261
|
+
};
|
|
257
262
|
|
|
258
263
|
export { MarketPlacePage };
|
|
259
264
|
export default ProtectedMarketPlace;
|
|
@@ -197,13 +197,13 @@ const ProfilePage = () => {
|
|
|
197
197
|
validationSchema={schema}
|
|
198
198
|
enableReinitialize
|
|
199
199
|
>
|
|
200
|
-
{({ errors, values, handleChange, isSubmitting }) => {
|
|
200
|
+
{({ errors, values, handleChange, isSubmitting, dirty }) => {
|
|
201
201
|
return (
|
|
202
202
|
<Form>
|
|
203
203
|
<HeaderLayout
|
|
204
204
|
title={data.username || getFullName(data.firstname, data.lastname)}
|
|
205
205
|
primaryAction={
|
|
206
|
-
<Button startIcon={<Check />} loading={isSubmitting} type="submit">
|
|
206
|
+
<Button startIcon={<Check />} loading={isSubmitting} type="submit" disabled={!dirty}>
|
|
207
207
|
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
|
208
208
|
</Button>
|
|
209
209
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useTracking,
|
|
11
11
|
} from '@strapi/helper-plugin';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
|
+
import { useIntl } from 'react-intl';
|
|
13
14
|
import { useHistory } from 'react-router-dom';
|
|
14
15
|
|
|
15
16
|
import DeleteButton from './DeleteButton';
|
|
@@ -28,6 +29,7 @@ const Table = ({
|
|
|
28
29
|
const { canDelete, canUpdate, canRead } = permissions;
|
|
29
30
|
const withBulkActions = canDelete || canUpdate || canRead;
|
|
30
31
|
const [{ query }] = useQueryParams();
|
|
32
|
+
const { formatMessage } = useIntl();
|
|
31
33
|
const [, sortOrder] = query ? query.sort.split(':') : 'ASC';
|
|
32
34
|
const {
|
|
33
35
|
push,
|
|
@@ -83,7 +85,19 @@ const Table = ({
|
|
|
83
85
|
<Td>
|
|
84
86
|
{token.lastUsedAt && (
|
|
85
87
|
<Typography textColor="neutral800">
|
|
86
|
-
<RelativeTime
|
|
88
|
+
<RelativeTime
|
|
89
|
+
timestamp={new Date(token.lastUsedAt)}
|
|
90
|
+
customIntervals={[
|
|
91
|
+
{
|
|
92
|
+
unit: 'hours',
|
|
93
|
+
threshold: 1,
|
|
94
|
+
text: formatMessage({
|
|
95
|
+
id: 'Settings.apiTokens.lastHour',
|
|
96
|
+
defaultMessage: 'last hour',
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
]}
|
|
100
|
+
/>
|
|
87
101
|
</Typography>
|
|
88
102
|
)}
|
|
89
103
|
</Td>
|
|
@@ -15,11 +15,12 @@ import {
|
|
|
15
15
|
import { Formik } from 'formik';
|
|
16
16
|
import { useIntl } from 'react-intl';
|
|
17
17
|
import { useQuery } from 'react-query';
|
|
18
|
+
import { useSelector } from 'react-redux';
|
|
18
19
|
import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
19
20
|
|
|
20
21
|
import { ApiTokenPermissionsContextProvider } from '../../../../../contexts/ApiTokenPermissions';
|
|
21
|
-
import adminPermissions from '../../../../../permissions';
|
|
22
22
|
import { formatAPIErrors } from '../../../../../utils';
|
|
23
|
+
import { selectAdminPermissions } from '../../../../App/selectors';
|
|
23
24
|
import { API_TOKEN_TYPE } from '../../../components/Tokens/constants';
|
|
24
25
|
import FormHead from '../../../components/Tokens/FormHead';
|
|
25
26
|
import TokenBox from '../../../components/Tokens/TokenBox';
|
|
@@ -39,6 +40,7 @@ const ApiTokenCreateView = () => {
|
|
|
39
40
|
const { lockApp, unlockApp } = useOverlayBlocker();
|
|
40
41
|
const toggleNotification = useNotification();
|
|
41
42
|
const history = useHistory();
|
|
43
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
42
44
|
const [apiToken, setApiToken] = useState(
|
|
43
45
|
history.location.state?.apiToken.accessKey
|
|
44
46
|
? {
|
|
@@ -51,7 +53,7 @@ const ApiTokenCreateView = () => {
|
|
|
51
53
|
const { setCurrentStep } = useGuidedTour();
|
|
52
54
|
const {
|
|
53
55
|
allowedActions: { canCreate, canUpdate, canRegenerate },
|
|
54
|
-
} = useRBAC(
|
|
56
|
+
} = useRBAC(permissions.settings['api-tokens']);
|
|
55
57
|
const [state, dispatch] = useReducer(reducer, initialState, (state) => init(state, {}));
|
|
56
58
|
const {
|
|
57
59
|
params: { id },
|
|
@@ -17,9 +17,10 @@ import { Plus } from '@strapi/icons';
|
|
|
17
17
|
import qs from 'qs';
|
|
18
18
|
import { useIntl } from 'react-intl';
|
|
19
19
|
import { useMutation, useQuery, useQueryClient } from 'react-query';
|
|
20
|
+
import { useSelector } from 'react-redux';
|
|
20
21
|
import { useHistory } from 'react-router-dom';
|
|
21
22
|
|
|
22
|
-
import
|
|
23
|
+
import { selectAdminPermissions } from '../../../../App/selectors';
|
|
23
24
|
import { API_TOKEN_TYPE } from '../../../components/Tokens/constants';
|
|
24
25
|
import Table from '../../../components/Tokens/Table';
|
|
25
26
|
|
|
@@ -30,9 +31,10 @@ const ApiTokenListView = () => {
|
|
|
30
31
|
const queryClient = useQueryClient();
|
|
31
32
|
const { formatMessage } = useIntl();
|
|
32
33
|
const toggleNotification = useNotification();
|
|
34
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
33
35
|
const {
|
|
34
36
|
allowedActions: { canCreate, canDelete, canUpdate, canRead },
|
|
35
|
-
} = useRBAC(
|
|
37
|
+
} = useRBAC(permissions.settings['api-tokens']);
|
|
36
38
|
const { push } = useHistory();
|
|
37
39
|
const { trackUsage } = useTracking();
|
|
38
40
|
const { startSection } = useGuidedTour();
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import { selectAdminPermissions } from '../../../../App/selectors';
|
|
6
7
|
import EditView from '../EditView';
|
|
7
8
|
|
|
8
9
|
const ProtectedApiTokenCreateView = () => {
|
|
10
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
11
|
+
|
|
9
12
|
return (
|
|
10
|
-
<CheckPagePermissions permissions={
|
|
13
|
+
<CheckPagePermissions permissions={permissions.settings['api-tokens'].create}>
|
|
11
14
|
<EditView />
|
|
12
15
|
</CheckPagePermissions>
|
|
13
16
|
);
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import { selectAdminPermissions } from '../../../../App/selectors';
|
|
6
7
|
import EditView from '../EditView';
|
|
7
8
|
|
|
8
9
|
const ProtectedApiTokenCreateView = () => {
|
|
10
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
11
|
+
|
|
9
12
|
return (
|
|
10
|
-
<CheckPagePermissions permissions={
|
|
13
|
+
<CheckPagePermissions permissions={permissions.settings['api-tokens'].read}>
|
|
11
14
|
<EditView />
|
|
12
15
|
</CheckPagePermissions>
|
|
13
16
|
);
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
+
import { selectAdminPermissions } from '../../../../App/selectors';
|
|
6
7
|
import ListView from '../ListView';
|
|
7
8
|
|
|
8
|
-
const ProtectedApiTokenListView = () =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const ProtectedApiTokenListView = () => {
|
|
10
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<CheckPagePermissions permissions={permissions.settings['api-tokens'].main}>
|
|
14
|
+
<ListView />
|
|
15
|
+
</CheckPagePermissions>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
13
18
|
|
|
14
19
|
export default ProtectedApiTokenListView;
|