@strapi/admin 4.4.0-beta.1 → 4.4.0-beta.3
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/StrapiApp.js +4 -12
- package/admin/src/components/Providers/index.js +14 -10
- package/admin/src/content-manager/components/FieldTypeIcon/index.js +31 -1
- package/admin/src/content-manager/components/Inputs/index.js +30 -10
- package/admin/src/content-manager/pages/EditSettingsView/components/FormModal.js +7 -2
- package/admin/src/content-manager/pages/EditSettingsView/index.js +2 -1
- package/admin/src/content-manager/pages/EditView/index.js +91 -84
- package/admin/src/core/apis/CustomFields.js +80 -0
- package/admin/src/core/apis/index.js +1 -0
- package/admin/src/hooks/index.js +0 -1
- package/admin/src/pages/AuthPage/utils/forms.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +180 -452
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js +1 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/DeleteButton/index.js +0 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/UpdateButton/index.js +36 -3
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +11 -13
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +2 -3
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/utils/tableHeaders.js +8 -8
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ProtectedEditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/schema.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/utils/validations/users/profile.js +2 -2
- package/admin/src/permissions/defaultPermissions.js +6 -2
- package/admin/src/translations/en.json +0 -17
- package/build/524.40377968.chunk.js +644 -0
- package/build/{Admin-authenticatedApp.3a31a087.chunk.js → Admin-authenticatedApp.50e41ff2.chunk.js} +1 -1
- package/build/{Admin_homePage.6d5e3236.chunk.js → Admin_homePage.118926e0.chunk.js} +1 -1
- package/build/{Admin_profilePage.83991a6c.chunk.js → Admin_profilePage.9d50ac44.chunk.js} +4 -4
- package/build/{Admin_settingsPage.fc9c607a.chunk.js → Admin_settingsPage.98a711e5.chunk.js} +16 -16
- package/build/admin-app.8bc3e80f.chunk.js +112 -0
- package/build/admin-edit-roles-page.554ba3fa.chunk.js +1 -0
- package/build/{admin-edit-users.5bebf473.chunk.js → admin-edit-users.c585212f.chunk.js} +2 -2
- package/build/{admin-users.dccd5f4c.chunk.js → admin-users.97a08630.chunk.js} +1 -1
- package/build/api-tokens-create-page.4c262d6e.chunk.js +1 -0
- package/build/api-tokens-edit-page.10a9d368.chunk.js +1 -0
- package/build/api-tokens-list-page.442c9f3c.chunk.js +15 -0
- package/build/content-manager.2a6f876d.chunk.js +1178 -0
- package/build/content-type-builder-list-view.5b3cd768.chunk.js +194 -0
- package/build/content-type-builder-translation-en-json.f985c9c4.chunk.js +1 -0
- package/build/content-type-builder.d4610e20.chunk.js +145 -0
- package/build/en-json.12bc5a14.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/{main.cdfda31e.js → main.fdc482f3.js} +1151 -1151
- package/build/{runtime~main.fa8f8898.js → runtime~main.29105d25.js} +2 -2
- package/build/sso-settings-page.445184e0.chunk.js +1 -0
- package/build/{webhook-edit-page.9e46fc3f.chunk.js → webhook-edit-page.d2ea3351.chunk.js} +1 -1
- package/package.json +7 -8
- package/server/bootstrap.js +1 -19
- package/server/config/admin-actions.js +0 -20
- package/server/content-types/api-token.js +1 -25
- package/server/content-types/index.js +0 -1
- package/server/controllers/api-token.js +1 -24
- package/server/controllers/index.js +0 -1
- package/server/routes/api-tokens.js +0 -11
- package/server/routes/index.js +0 -2
- package/server/services/api-token.js +29 -310
- package/server/services/constants.js +0 -10
- package/server/services/permission/engine-hooks.js +82 -0
- package/server/services/permission/engine.js +226 -36
- package/server/services/permission.js +1 -4
- package/server/strategies/admin.js +1 -7
- package/server/strategies/api-token.js +11 -71
- package/server/validation/api-tokens.js +2 -12
- package/server/validation/common-validators.js +1 -1
- package/admin/src/contexts/ApiTokenPermissions/index.js +0 -24
- package/admin/src/hooks/useRegenerate/index.js +0 -34
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/ActionBoundRoutes/index.js +0 -56
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/BoundRoute/getMethodColor.js +0 -41
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/BoundRoute/index.js +0 -72
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/CheckBoxWrapper.js +0 -30
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/index.js +0 -150
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/ContenTypesSection/index.js +0 -37
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Permissions/index.js +0 -40
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +0 -68
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/init.js +0 -13
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/reducer.js +0 -55
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/getDateOfExpiration.js +0 -16
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/index.js +0 -5
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/transformPermissionsData.js +0 -36
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/DefaultButton/index.js +0 -63
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/ReadButton/index.js +0 -19
- package/build/4235.982b5799.chunk.js +0 -30
- package/build/611.a91aff91.chunk.js +0 -158
- package/build/7379.d246dd38.chunk.js +0 -1
- package/build/admin-app.41b6472c.chunk.js +0 -112
- package/build/admin-edit-roles-page.4dd6bcb9.chunk.js +0 -1
- package/build/api-tokens-create-page.29cc87b6.chunk.js +0 -1
- package/build/api-tokens-edit-page.c294a88f.chunk.js +0 -1
- package/build/api-tokens-list-page.bb36535f.chunk.js +0 -16
- package/build/content-manager.fb5ee865.chunk.js +0 -1178
- package/build/content-type-builder-list-view.8cc534e0.chunk.js +0 -194
- package/build/content-type-builder-translation-en-json.201bfb78.chunk.js +0 -1
- package/build/content-type-builder.42cecba9.chunk.js +0 -142
- package/build/en-json.a9918c93.chunk.js +0 -1
- package/build/sso-settings-page.9ceb0140.chunk.js +0 -1
- package/server/content-types/api-token-permission.js +0 -36
- package/server/controllers/content-api.js +0 -15
- package/server/routes/content-api.js +0 -20
|
@@ -5,10 +5,9 @@ const schema = yup.object().shape({
|
|
|
5
5
|
name: yup.string(translatedErrors.string).required(translatedErrors.required),
|
|
6
6
|
type: yup
|
|
7
7
|
.string(translatedErrors.string)
|
|
8
|
-
.oneOf(['read-only', 'full-access'
|
|
8
|
+
.oneOf(['read-only', 'full-access'])
|
|
9
9
|
.required(translatedErrors.required),
|
|
10
10
|
description: yup.string().nullable(),
|
|
11
|
-
lifespan: yup.number().integer().min(1).nullable().defined(translatedErrors.required),
|
|
12
11
|
});
|
|
13
12
|
|
|
14
13
|
export default schema;
|
package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/UpdateButton/index.js
CHANGED
|
@@ -1,13 +1,46 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Pencil from '@strapi/icons/Pencil';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
5
|
+
import { Link } from '@strapi/helper-plugin';
|
|
6
|
+
import { useHistory } from 'react-router-dom';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
|
|
9
|
+
const LinkUpdate = styled(Link)`
|
|
10
|
+
svg {
|
|
11
|
+
path {
|
|
12
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
svg {
|
|
18
|
+
path {
|
|
19
|
+
fill: ${({ theme }) => theme.colors.neutral800};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
5
24
|
|
|
6
25
|
const UpdateButton = ({ tokenName, tokenId }) => {
|
|
26
|
+
const { formatMessage } = useIntl();
|
|
27
|
+
const {
|
|
28
|
+
location: { pathname },
|
|
29
|
+
} = useHistory();
|
|
30
|
+
|
|
7
31
|
return (
|
|
8
|
-
<
|
|
32
|
+
<LinkUpdate
|
|
33
|
+
to={`${pathname}/${tokenId}`}
|
|
34
|
+
title={formatMessage(
|
|
35
|
+
{
|
|
36
|
+
id: 'app.component.table.edit',
|
|
37
|
+
defaultMessage: 'Edit {target}',
|
|
38
|
+
},
|
|
39
|
+
{ target: `${tokenName}` }
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
9
42
|
<Pencil />
|
|
10
|
-
</
|
|
43
|
+
</LinkUpdate>
|
|
11
44
|
);
|
|
12
45
|
};
|
|
13
46
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { useHistory } from 'react-router-dom';
|
|
4
5
|
|
|
@@ -12,11 +13,12 @@ import {
|
|
|
12
13
|
pxToRem,
|
|
13
14
|
useTracking,
|
|
14
15
|
} from '@strapi/helper-plugin';
|
|
16
|
+
|
|
15
17
|
import DeleteButton from './DeleteButton';
|
|
16
18
|
import UpdateButton from './UpdateButton';
|
|
17
|
-
import ReadButton from './ReadButton';
|
|
18
19
|
|
|
19
|
-
const TableRows = ({ canDelete, canUpdate,
|
|
20
|
+
const TableRows = ({ canDelete, canUpdate, onClickDelete, withBulkActions, rows }) => {
|
|
21
|
+
const { formatMessage } = useIntl();
|
|
20
22
|
const [{ query }] = useQueryParams();
|
|
21
23
|
const [, sortOrder] = query.sort.split(':');
|
|
22
24
|
const {
|
|
@@ -57,24 +59,22 @@ const TableRows = ({ canDelete, canUpdate, canRead, onClickDelete, withBulkActio
|
|
|
57
59
|
</Td>
|
|
58
60
|
<Td>
|
|
59
61
|
<Typography textColor="neutral800">
|
|
60
|
-
|
|
62
|
+
{formatMessage({
|
|
63
|
+
id: `Settings.apiTokens.types.${apiToken.type}`,
|
|
64
|
+
defaultMessage: 'Type unknown',
|
|
65
|
+
})}
|
|
61
66
|
</Typography>
|
|
62
67
|
</Td>
|
|
63
68
|
<Td>
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
</Typography>
|
|
68
|
-
)}
|
|
69
|
+
<Typography textColor="neutral800">
|
|
70
|
+
<RelativeTime timestamp={new Date(apiToken.createdAt)} />
|
|
71
|
+
</Typography>
|
|
69
72
|
</Td>
|
|
70
73
|
|
|
71
74
|
{withBulkActions && (
|
|
72
75
|
<Td>
|
|
73
76
|
<Flex justifyContent="end">
|
|
74
77
|
{canUpdate && <UpdateButton tokenName={apiToken.name} tokenId={apiToken.id} />}
|
|
75
|
-
{!canUpdate && canRead && (
|
|
76
|
-
<ReadButton tokenName={apiToken.name} tokenId={apiToken.id} />
|
|
77
|
-
)}
|
|
78
78
|
{canDelete && (
|
|
79
79
|
<DeleteButton
|
|
80
80
|
tokenName={apiToken.name}
|
|
@@ -94,7 +94,6 @@ const TableRows = ({ canDelete, canUpdate, canRead, onClickDelete, withBulkActio
|
|
|
94
94
|
TableRows.defaultProps = {
|
|
95
95
|
canDelete: false,
|
|
96
96
|
canUpdate: false,
|
|
97
|
-
canRead: false,
|
|
98
97
|
onClickDelete() {},
|
|
99
98
|
rows: [],
|
|
100
99
|
withBulkActions: false,
|
|
@@ -103,7 +102,6 @@ TableRows.defaultProps = {
|
|
|
103
102
|
TableRows.propTypes = {
|
|
104
103
|
canDelete: PropTypes.bool,
|
|
105
104
|
canUpdate: PropTypes.bool,
|
|
106
|
-
canRead: PropTypes.bool,
|
|
107
105
|
onClickDelete: PropTypes.func,
|
|
108
106
|
rows: PropTypes.array,
|
|
109
107
|
withBulkActions: PropTypes.bool,
|
|
@@ -147,16 +147,15 @@ const ApiTokenListView = () => {
|
|
|
147
147
|
headers={headers}
|
|
148
148
|
contentType="api-tokens"
|
|
149
149
|
rows={apiTokens}
|
|
150
|
-
withBulkActions={canDelete || canUpdate
|
|
150
|
+
withBulkActions={canDelete || canUpdate}
|
|
151
151
|
isLoading={isLoading}
|
|
152
152
|
onConfirmDelete={(id) => deleteMutation.mutateAsync(id)}
|
|
153
153
|
>
|
|
154
154
|
<TableRows
|
|
155
|
-
canRead={canRead}
|
|
156
155
|
canDelete={canDelete}
|
|
157
156
|
canUpdate={canUpdate}
|
|
158
157
|
rows={apiTokens}
|
|
159
|
-
withBulkActions={canDelete || canUpdate
|
|
158
|
+
withBulkActions={canDelete || canUpdate}
|
|
160
159
|
/>
|
|
161
160
|
</DynamicTable>
|
|
162
161
|
)}
|
|
@@ -22,23 +22,23 @@ const tableHeaders = [
|
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
name: '
|
|
26
|
-
key: '
|
|
25
|
+
name: 'type',
|
|
26
|
+
key: 'type',
|
|
27
27
|
metadatas: {
|
|
28
28
|
label: {
|
|
29
|
-
id: 'Settings.apiTokens.ListView.headers.
|
|
30
|
-
defaultMessage: '
|
|
29
|
+
id: 'Settings.apiTokens.ListView.headers.type',
|
|
30
|
+
defaultMessage: 'Token type',
|
|
31
31
|
},
|
|
32
32
|
sortable: false,
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
name: '
|
|
37
|
-
key: '
|
|
36
|
+
name: 'createdAt',
|
|
37
|
+
key: 'createdAt',
|
|
38
38
|
metadatas: {
|
|
39
39
|
label: {
|
|
40
|
-
id: 'Settings.apiTokens.ListView.headers.
|
|
41
|
-
defaultMessage: '
|
|
40
|
+
id: 'Settings.apiTokens.ListView.headers.createdAt',
|
|
41
|
+
defaultMessage: 'Created at',
|
|
42
42
|
},
|
|
43
43
|
sortable: false,
|
|
44
44
|
},
|
|
@@ -5,7 +5,7 @@ import EditView from '../EditView';
|
|
|
5
5
|
|
|
6
6
|
const ProtectedApiTokenCreateView = () => {
|
|
7
7
|
return (
|
|
8
|
-
<CheckPagePermissions permissions={adminPermissions.settings['api-tokens'].
|
|
8
|
+
<CheckPagePermissions permissions={adminPermissions.settings['api-tokens'].update}>
|
|
9
9
|
<EditView />
|
|
10
10
|
</CheckPagePermissions>
|
|
11
11
|
);
|
|
@@ -2,7 +2,7 @@ import * as yup from 'yup';
|
|
|
2
2
|
import { translatedErrors } from '@strapi/helper-plugin';
|
|
3
3
|
|
|
4
4
|
const schema = yup.object().shape({
|
|
5
|
-
firstname: yup.string().required(translatedErrors.required),
|
|
5
|
+
firstname: yup.string().trim().required(translatedErrors.required),
|
|
6
6
|
lastname: yup.string(),
|
|
7
7
|
email: yup.string().email(translatedErrors.email).required(translatedErrors.required),
|
|
8
8
|
roles: yup.array().min(1, translatedErrors.required).required(translatedErrors.required),
|
|
@@ -2,8 +2,8 @@ import * as yup from 'yup';
|
|
|
2
2
|
import { translatedErrors } from '@strapi/helper-plugin';
|
|
3
3
|
|
|
4
4
|
export const commonUserSchema = {
|
|
5
|
-
firstname: yup.
|
|
6
|
-
lastname: yup.
|
|
5
|
+
firstname: yup.string().trim().required(translatedErrors.required),
|
|
6
|
+
lastname: yup.string(),
|
|
7
7
|
email: yup.string().email(translatedErrors.email).lowercase().required(translatedErrors.required),
|
|
8
8
|
username: yup.string().nullable(),
|
|
9
9
|
password: yup
|
|
@@ -76,12 +76,16 @@ const permissions = {
|
|
|
76
76
|
update: [{ action: 'admin::webhooks.update', subject: null }],
|
|
77
77
|
},
|
|
78
78
|
'api-tokens': {
|
|
79
|
-
main: [
|
|
79
|
+
main: [
|
|
80
|
+
{ action: 'admin::api-tokens.create', subject: null },
|
|
81
|
+
{ action: 'admin::api-tokens.read', subject: null },
|
|
82
|
+
{ action: 'admin::api-tokens.update', subject: null },
|
|
83
|
+
{ action: 'admin::api-tokens.delete', subject: null },
|
|
84
|
+
],
|
|
80
85
|
create: [{ action: 'admin::api-tokens.create', subject: null }],
|
|
81
86
|
delete: [{ action: 'admin::api-tokens.delete', subject: null }],
|
|
82
87
|
read: [{ action: 'admin::api-tokens.read', subject: null }],
|
|
83
88
|
update: [{ action: 'admin::api-tokens.update', subject: null }],
|
|
84
|
-
regenerate: [{ action: 'admin::api-tokens.regenerate', subject: null }],
|
|
85
89
|
},
|
|
86
90
|
},
|
|
87
91
|
};
|
|
@@ -91,24 +91,10 @@
|
|
|
91
91
|
"Settings.apiTokens.ListView.headers.description": "Description",
|
|
92
92
|
"Settings.apiTokens.ListView.headers.type": "Token type",
|
|
93
93
|
"Settings.apiTokens.ListView.headers.createdAt": "Created at",
|
|
94
|
-
"Settings.apiTokens.ListView.headers.lastUsedAt": "Last used",
|
|
95
94
|
"Settings.apiTokens.notification.copied": "Token copied to clipboard.",
|
|
96
95
|
"Settings.apiTokens.title": "API Tokens",
|
|
97
96
|
"Settings.apiTokens.types.full-access": "Full access",
|
|
98
97
|
"Settings.apiTokens.types.read-only": "Read-only",
|
|
99
|
-
"Settings.apiTokens.duration.7-days": "7 days",
|
|
100
|
-
"Settings.apiTokens.duration.30-days": "30 days",
|
|
101
|
-
"Settings.apiTokens.duration.90-days": "90 days",
|
|
102
|
-
"Settings.apiTokens.duration.unlimited": "Unlimited",
|
|
103
|
-
"Settings.apiTokens.form.duration":"Token duration",
|
|
104
|
-
"Settings.apiTokens.form.type":"Token type",
|
|
105
|
-
"Settings.apiTokens.duration.expiration-date":"Expiration date",
|
|
106
|
-
"Settings.apiTokens.createPage.permissions.title":"Permissions",
|
|
107
|
-
"Settings.apiTokens.createPage.permissions.description":"Only actions bound by a route are listed below.",
|
|
108
|
-
"Settings.apiTokens.RegenerateDialog.title": "Regenerate token",
|
|
109
|
-
"Settings.apiTokens.popUpWarning.message": "Are you sure you want to regenerate this token?",
|
|
110
|
-
"Settings.apiTokens.Button.cancel": "Cancel",
|
|
111
|
-
"Settings.apiTokens.Button.regenerate": "Regenerate",
|
|
112
98
|
"Settings.application.description": "Administration panel’s global information",
|
|
113
99
|
"Settings.application.edition-title": "current plan",
|
|
114
100
|
"Settings.application.get-help": "Get help",
|
|
@@ -772,9 +758,6 @@
|
|
|
772
758
|
"notification.success.delete": "The item has been deleted",
|
|
773
759
|
"notification.success.saved": "Saved",
|
|
774
760
|
"notification.success.title": "Success:",
|
|
775
|
-
"notification.success.tokencreated": "API Token successfully created",
|
|
776
|
-
"notification.success.tokenedited": "API Token successfully edited",
|
|
777
|
-
"notification.error.tokennamenotunique": "Name already assigned to another token",
|
|
778
761
|
"notification.version.update.message": "A new version of Strapi is available!",
|
|
779
762
|
"notification.warning.title": "Warning:",
|
|
780
763
|
"notification.warning.404": "404 - Not found",
|