@strapi/admin 4.7.2-exp.175f7ac70ee76d6c825e4429e15fc85ee78d23bb → 4.8.0
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/content-manager/components/ComponentInitializer/index.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +3 -31
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +65 -134
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findAllAndReplace.js +85 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/index.js +1 -2
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +7 -1
- package/admin/src/content-manager/components/NonRepeatableComponent/index.js +1 -1
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +1 -2
- package/admin/src/content-manager/components/RelationInputDataManager/RelationInputDataManager.js +39 -33
- package/admin/src/content-manager/hooks/useRelation/useRelation.js +2 -2
- package/admin/src/content-manager/pages/EditView/Header/index.js +1 -1
- package/admin/src/content-manager/utils/createDefaultForm.js +0 -8
- package/admin/src/pages/AuthPage/components/Register/index.js +1 -1
- package/admin/src/pages/SettingsPage/components/Tokens/FormHead/index.js +1 -0
- package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +266 -4
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/index.js +1 -2
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/index.js +2 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js +2 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/index.js +2 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/index.js +9 -4
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/index.js +3 -7
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +303 -124
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +1 -1
- package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +18 -10
- package/admin/src/translations/ca.json +7 -13
- package/admin/src/translations/de.json +0 -6
- package/admin/src/translations/dk.json +0 -6
- package/admin/src/translations/en.json +0 -6
- package/admin/src/translations/es.json +0 -6
- package/admin/src/translations/eu.json +165 -171
- package/admin/src/translations/fr.json +0 -6
- package/admin/src/translations/gu.json +0 -6
- package/admin/src/translations/he.json +0 -6
- package/admin/src/translations/hi.json +0 -6
- package/admin/src/translations/hu.json +0 -6
- package/admin/src/translations/id.json +0 -6
- package/admin/src/translations/it.json +0 -6
- package/admin/src/translations/ja.json +0 -6
- package/admin/src/translations/ko.json +0 -6
- package/admin/src/translations/ml.json +0 -6
- package/admin/src/translations/nl.json +0 -6
- package/admin/src/translations/no.json +0 -6
- package/admin/src/translations/pl.json +0 -6
- package/admin/src/translations/pt-BR.json +0 -6
- package/admin/src/translations/ru.json +0 -6
- package/admin/src/translations/sa.json +0 -6
- package/admin/src/translations/sk.json +0 -6
- package/admin/src/translations/sv.json +0 -6
- package/admin/src/translations/th.json +0 -6
- package/admin/src/translations/tr.json +0 -6
- package/admin/src/translations/zh-Hans.json +0 -6
- package/admin/src/translations/zh.json +0 -6
- package/build/{4649.daa290f6.chunk.js → 4649.33220ac3.chunk.js} +2 -2
- package/build/{6891.ef7464be.chunk.js → 7112.2bf13da3.chunk.js} +6 -6
- package/build/7259.3675c199.chunk.js +1 -0
- package/build/{3094.1cac9087.chunk.js → 8580.0aa21940.chunk.js} +5 -5
- package/build/{Admin-authenticatedApp.25bdcdc0.chunk.js → Admin-authenticatedApp.5abacdd4.chunk.js} +4 -4
- package/build/Admin_settingsPage.caf3b9ab.chunk.js +9 -0
- package/build/{admin-app.d9d96db4.chunk.js → admin-app.4b313104.chunk.js} +2 -2
- package/build/admin-edit-roles-page.3b196317.chunk.js +216 -0
- package/build/{admin-edit-users.48031e30.chunk.js → admin-edit-users.af3b0f15.chunk.js} +1 -1
- package/build/admin-roles-list.0ad504a7.chunk.js +2 -0
- package/build/{admin-users.77b4188a.chunk.js → admin-users.af8c3123.chunk.js} +1 -1
- package/build/api-tokens-list-page.93f24348.chunk.js +16 -0
- package/build/ca-json.43e14418.chunk.js +1 -0
- package/build/content-manager.84afc839.chunk.js +1139 -0
- package/build/{content-type-builder.cdd117c3.chunk.js → content-type-builder.55dac849.chunk.js} +1 -1
- package/build/de-json.fcac7381.chunk.js +1 -0
- package/build/dk-json.e34cad0d.chunk.js +1 -0
- package/build/{en-json.e688dfe2.chunk.js → en-json.01a88a30.chunk.js} +1 -1
- package/build/es-json.715b6fd8.chunk.js +1 -0
- package/build/eu-json.fb17c8f9.chunk.js +1 -0
- package/build/fr-json.f66c3211.chunk.js +1 -0
- package/build/gu-json.4d667d0c.chunk.js +1 -0
- package/build/{he-json.f0de8cdb.chunk.js → he-json.3cf0b48a.chunk.js} +1 -1
- package/build/{hi-json.14a17920.chunk.js → hi-json.323be97d.chunk.js} +1 -1
- package/build/{hu-json.33172d09.chunk.js → hu-json.fe71e6c8.chunk.js} +1 -1
- package/build/id-json.41e07c46.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/it-json.bfe27ed8.chunk.js +1 -0
- package/build/ja-json.81b6d1e3.chunk.js +1 -0
- package/build/ko-json.4539f4ba.chunk.js +1 -0
- package/build/main.5b92c1d6.js +3809 -0
- package/build/{ml-json.3e69969b.chunk.js → ml-json.8988e374.chunk.js} +1 -1
- package/build/{nl-json.641782d5.chunk.js → nl-json.98345913.chunk.js} +1 -1
- package/build/{no-json.9b3cd181.chunk.js → no-json.19a2dbfa.chunk.js} +1 -1
- package/build/pl-json.59a5dab3.chunk.js +1 -0
- package/build/pt-BR-json.9410688b.chunk.js +1 -0
- package/build/{ru-json.c4a4f50b.chunk.js → ru-json.6a01cea6.chunk.js} +1 -1
- package/build/runtime~main.0bf1f619.js +2 -0
- package/build/sa-json.6359a11c.chunk.js +1 -0
- package/build/sk-json.2374f129.chunk.js +1 -0
- package/build/{sv-json.207afc0d.chunk.js → sv-json.ae6e71ea.chunk.js} +1 -1
- package/build/th-json.5f659396.chunk.js +1 -0
- package/build/{tr-json.f1a0d19d.chunk.js → tr-json.bac5dbd3.chunk.js} +1 -1
- package/build/transfer-tokens-list-page.ce37354b.chunk.js +16 -0
- package/build/zh-Hans-json.4c9706a6.chunk.js +1 -0
- package/build/{zh-json.085a34f4.chunk.js → zh-json.3529f1e5.chunk.js} +1 -1
- package/ee/server/controllers/index.js +0 -1
- package/ee/server/controllers/role.js +0 -39
- package/ee/server/controllers/user.js +1 -35
- package/ee/server/routes/index.js +0 -49
- package/ee/server/validation/role.js +28 -20
- package/package.json +13 -13
- package/server/bootstrap.js +0 -1
- package/server/controllers/api-token.js +4 -2
- package/server/controllers/permission.js +2 -4
- package/server/controllers/role.js +70 -23
- package/server/controllers/transfer/runner.js +5 -3
- package/server/domain/user.js +3 -0
- package/server/routes/roles.js +48 -0
- package/server/services/permission/permissions-manager/sanitize.js +2 -2
- package/server/services/permission/queries.js +1 -74
- package/server/strategies/data-transfer.js +3 -1
- package/server/validation/permission.js +1 -82
- package/server/validation/role.js +44 -0
- package/admin/src/assets/images/hot-air-balloon.png +0 -0
- package/admin/src/assets/images/upgrade-details.png +0 -0
- package/admin/src/components/UpgradePlanModal/index.js +0 -123
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +0 -51
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/recursivelyFindPathsBasedOnCondition.js +0 -79
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/utils/constants.js +0 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/utils/constants.js +0 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/constants.js +0 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/utils/constants.js +0 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/utils/constants.js +0 -3
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/utils/constants.js +0 -3
- package/build/617f9c948fa79e6d73bd.png +0 -0
- package/build/6d21938306785f176538.png +0 -0
- package/build/7259.63e91b59.chunk.js +0 -1
- package/build/Admin_settingsPage.6814a96e.chunk.js +0 -177
- package/build/admin-edit-roles-page.bf130aaf.chunk.js +0 -1
- package/build/api-tokens-list-page.149903c8.chunk.js +0 -16
- package/build/ca-json.59c4502c.chunk.js +0 -1
- package/build/content-manager.d792c194.chunk.js +0 -1139
- package/build/de-json.dbc2cf1b.chunk.js +0 -1
- package/build/dk-json.52f67b15.chunk.js +0 -1
- package/build/es-json.c40c57dd.chunk.js +0 -1
- package/build/eu-json.6702a0d2.chunk.js +0 -1
- package/build/fr-json.ea9ec573.chunk.js +0 -1
- package/build/gu-json.94f0d242.chunk.js +0 -1
- package/build/id-json.e0d83d41.chunk.js +0 -1
- package/build/it-json.8be59205.chunk.js +0 -1
- package/build/ja-json.3008b720.chunk.js +0 -1
- package/build/ko-json.7d2f95b1.chunk.js +0 -1
- package/build/main.64fe0c37.js +0 -3928
- package/build/pl-json.05814145.chunk.js +0 -1
- package/build/pt-BR-json.d72350de.chunk.js +0 -1
- package/build/runtime~main.122b5a09.js +0 -2
- package/build/sa-json.e5e7ccaf.chunk.js +0 -1
- package/build/sk-json.3529b8aa.chunk.js +0 -1
- package/build/th-json.f664b96d.chunk.js +0 -1
- package/build/transfer-tokens-list-page.c6f8039a.chunk.js +0 -16
- package/build/zh-Hans-json.993d085f.chunk.js +0 -1
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +0 -270
- package/ee/admin/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/utils/constants.js +0 -3
- package/ee/admin/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ConditionsSelect/MenuList/utils/constants.js +0 -3
- package/ee/admin/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/utils/constants.js +0 -3
- package/ee/admin/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/constants.js +0 -3
- package/ee/admin/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/utils/constants.js +0 -3
- package/ee/admin/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/utils/constants.js +0 -3
- package/ee/admin/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/utils/constants.js +0 -3
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +0 -376
- package/ee/admin/pages/SettingsPage/pages/Roles/ProtectedListPage/index.js +0 -12
- package/ee/server/controllers/permission.js +0 -21
- package/ee/server/validation/permission.js +0 -8
- package/server/domain/role.js +0 -29
- /package/{ee/admin → admin/src}/pages/SettingsPage/pages/Roles/CreatePage/utils/schema.js +0 -0
- /package/{ee/admin → admin/src}/pages/SettingsPage/pages/Roles/ListPage/reducer.js +0 -0
|
@@ -1,8 +1,270 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { format } from 'date-fns';
|
|
3
|
+
import {
|
|
4
|
+
CheckPagePermissions,
|
|
5
|
+
Form,
|
|
6
|
+
LoadingIndicatorPage,
|
|
7
|
+
SettingsPageTitle,
|
|
8
|
+
request,
|
|
9
|
+
useNotification,
|
|
10
|
+
useOverlayBlocker,
|
|
11
|
+
useTracking,
|
|
12
|
+
Link,
|
|
13
|
+
} from '@strapi/helper-plugin';
|
|
14
|
+
import {
|
|
15
|
+
Box,
|
|
16
|
+
Button,
|
|
17
|
+
ContentLayout,
|
|
18
|
+
HeaderLayout,
|
|
19
|
+
Grid,
|
|
20
|
+
GridItem,
|
|
21
|
+
Main,
|
|
22
|
+
Flex,
|
|
23
|
+
Typography,
|
|
24
|
+
TextInput,
|
|
25
|
+
Textarea,
|
|
26
|
+
} from '@strapi/design-system';
|
|
27
|
+
import { ArrowLeft } from '@strapi/icons';
|
|
28
|
+
import { Formik } from 'formik';
|
|
29
|
+
import get from 'lodash/get';
|
|
30
|
+
import isEmpty from 'lodash/isEmpty';
|
|
31
|
+
import { useIntl } from 'react-intl';
|
|
32
|
+
import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
33
|
+
import styled from 'styled-components';
|
|
34
|
+
import Permissions from '../EditPage/components/Permissions';
|
|
35
|
+
import { useFetchPermissionsLayout, useFetchRole } from '../../../../../hooks';
|
|
36
|
+
import adminPermissions from '../../../../../permissions';
|
|
37
|
+
import schema from './utils/schema';
|
|
38
|
+
|
|
39
|
+
const UsersRoleNumber = styled.div`
|
|
40
|
+
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
|
41
|
+
background: ${({ theme }) => theme.colors.primary100};
|
|
42
|
+
padding: ${({ theme }) => `${theme.spaces[2]} ${theme.spaces[4]}`};
|
|
43
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
44
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
|
45
|
+
font-size: ${12 / 16}rem;
|
|
46
|
+
font-weight: bold;
|
|
47
|
+
`;
|
|
3
48
|
|
|
4
49
|
const CreatePage = () => {
|
|
5
|
-
|
|
50
|
+
const toggleNotification = useNotification();
|
|
51
|
+
const { lockApp, unlockApp } = useOverlayBlocker();
|
|
52
|
+
const { formatMessage } = useIntl();
|
|
53
|
+
const [isSubmitting, setIsSubmiting] = useState(false);
|
|
54
|
+
const { replace } = useHistory();
|
|
55
|
+
const permissionsRef = useRef();
|
|
56
|
+
const { trackUsage } = useTracking();
|
|
57
|
+
const params = useRouteMatch('/settings/roles/duplicate/:id');
|
|
58
|
+
const id = get(params, 'params.id', null);
|
|
59
|
+
const { isLoading: isLayoutLoading, data: permissionsLayout } = useFetchPermissionsLayout();
|
|
60
|
+
const { permissions: rolePermissions, isLoading: isRoleLoading } = useFetchRole(id);
|
|
61
|
+
|
|
62
|
+
const handleCreateRoleSubmit = (data) => {
|
|
63
|
+
lockApp();
|
|
64
|
+
setIsSubmiting(true);
|
|
65
|
+
|
|
66
|
+
if (id) {
|
|
67
|
+
trackUsage('willDuplicateRole');
|
|
68
|
+
} else {
|
|
69
|
+
trackUsage('willCreateNewRole');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
Promise.resolve(
|
|
73
|
+
request('/admin/roles', {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
body: data,
|
|
76
|
+
})
|
|
77
|
+
)
|
|
78
|
+
.then(async (res) => {
|
|
79
|
+
const { permissionsToSend } = permissionsRef.current.getPermissions();
|
|
80
|
+
|
|
81
|
+
if (id) {
|
|
82
|
+
trackUsage('didDuplicateRole');
|
|
83
|
+
} else {
|
|
84
|
+
trackUsage('didCreateNewRole');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (res.data.id && !isEmpty(permissionsToSend)) {
|
|
88
|
+
await request(`/admin/roles/${res.data.id}/permissions`, {
|
|
89
|
+
method: 'PUT',
|
|
90
|
+
body: { permissions: permissionsToSend },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return res;
|
|
95
|
+
})
|
|
96
|
+
.then((res) => {
|
|
97
|
+
setIsSubmiting(false);
|
|
98
|
+
toggleNotification({
|
|
99
|
+
type: 'success',
|
|
100
|
+
message: { id: 'Settings.roles.created', defaultMessage: 'created' },
|
|
101
|
+
});
|
|
102
|
+
replace(`/settings/roles/${res.data.id}`);
|
|
103
|
+
})
|
|
104
|
+
.catch((err) => {
|
|
105
|
+
console.error(err);
|
|
106
|
+
setIsSubmiting(false);
|
|
107
|
+
toggleNotification({
|
|
108
|
+
type: 'warning',
|
|
109
|
+
message: { id: 'notification.error' },
|
|
110
|
+
});
|
|
111
|
+
})
|
|
112
|
+
.finally(() => {
|
|
113
|
+
unlockApp();
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const defaultDescription = `${formatMessage({
|
|
118
|
+
id: 'Settings.roles.form.created',
|
|
119
|
+
defaultMessage: 'Created',
|
|
120
|
+
})} ${format(new Date(), 'PPP')}`;
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<Main>
|
|
124
|
+
<SettingsPageTitle name="Roles" />
|
|
125
|
+
<Formik
|
|
126
|
+
initialValues={{ name: '', description: defaultDescription }}
|
|
127
|
+
onSubmit={handleCreateRoleSubmit}
|
|
128
|
+
validationSchema={schema}
|
|
129
|
+
validateOnChange={false}
|
|
130
|
+
>
|
|
131
|
+
{({ handleSubmit, values, errors, handleReset, handleChange }) => (
|
|
132
|
+
<Form noValidate>
|
|
133
|
+
<>
|
|
134
|
+
<HeaderLayout
|
|
135
|
+
primaryAction={
|
|
136
|
+
<Flex gap={2}>
|
|
137
|
+
<Button
|
|
138
|
+
variant="secondary"
|
|
139
|
+
onClick={() => {
|
|
140
|
+
handleReset();
|
|
141
|
+
permissionsRef.current.resetForm();
|
|
142
|
+
}}
|
|
143
|
+
size="L"
|
|
144
|
+
>
|
|
145
|
+
{formatMessage({
|
|
146
|
+
id: 'app.components.Button.reset',
|
|
147
|
+
defaultMessage: 'Reset',
|
|
148
|
+
})}
|
|
149
|
+
</Button>
|
|
150
|
+
<Button onClick={handleSubmit} loading={isSubmitting} size="L">
|
|
151
|
+
{formatMessage({
|
|
152
|
+
id: 'global.save',
|
|
153
|
+
defaultMessage: 'Save',
|
|
154
|
+
})}
|
|
155
|
+
</Button>
|
|
156
|
+
</Flex>
|
|
157
|
+
}
|
|
158
|
+
title={formatMessage({
|
|
159
|
+
id: 'Settings.roles.create.title',
|
|
160
|
+
defaultMessage: 'Create a role',
|
|
161
|
+
})}
|
|
162
|
+
subtitle={formatMessage({
|
|
163
|
+
id: 'Settings.roles.create.description',
|
|
164
|
+
defaultMessage: 'Define the rights given to the role',
|
|
165
|
+
})}
|
|
166
|
+
navigationAction={
|
|
167
|
+
<Link startIcon={<ArrowLeft />} to="/settings/roles">
|
|
168
|
+
{formatMessage({
|
|
169
|
+
id: 'global.back',
|
|
170
|
+
defaultMessage: 'Back',
|
|
171
|
+
})}
|
|
172
|
+
</Link>
|
|
173
|
+
}
|
|
174
|
+
/>
|
|
175
|
+
<ContentLayout>
|
|
176
|
+
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
177
|
+
<Box background="neutral0" padding={6} shadow="filterShadow" hasRadius>
|
|
178
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
179
|
+
<Flex justifyContent="space-between">
|
|
180
|
+
<Box>
|
|
181
|
+
<Box>
|
|
182
|
+
<Typography fontWeight="bold">
|
|
183
|
+
{formatMessage({
|
|
184
|
+
id: 'global.details',
|
|
185
|
+
defaultMessage: 'Details',
|
|
186
|
+
})}
|
|
187
|
+
</Typography>
|
|
188
|
+
</Box>
|
|
189
|
+
<Box>
|
|
190
|
+
<Typography variant="pi" textColor="neutral600">
|
|
191
|
+
{formatMessage({
|
|
192
|
+
id: 'Settings.roles.form.description',
|
|
193
|
+
defaultMessage: 'Name and description of the role',
|
|
194
|
+
})}
|
|
195
|
+
</Typography>
|
|
196
|
+
</Box>
|
|
197
|
+
</Box>
|
|
198
|
+
<UsersRoleNumber>
|
|
199
|
+
{formatMessage(
|
|
200
|
+
{
|
|
201
|
+
id: 'Settings.roles.form.button.users-with-role',
|
|
202
|
+
defaultMessage:
|
|
203
|
+
'{number, plural, =0 {# users} one {# user} other {# users}} with this role',
|
|
204
|
+
},
|
|
205
|
+
{ number: 0 }
|
|
206
|
+
)}
|
|
207
|
+
</UsersRoleNumber>
|
|
208
|
+
</Flex>
|
|
209
|
+
<Grid gap={4}>
|
|
210
|
+
<GridItem col={6}>
|
|
211
|
+
<TextInput
|
|
212
|
+
name="name"
|
|
213
|
+
error={errors.name && formatMessage({ id: errors.name })}
|
|
214
|
+
label={formatMessage({
|
|
215
|
+
id: 'global.name',
|
|
216
|
+
defaultMessage: 'Name',
|
|
217
|
+
})}
|
|
218
|
+
onChange={handleChange}
|
|
219
|
+
value={values.name}
|
|
220
|
+
/>
|
|
221
|
+
</GridItem>
|
|
222
|
+
<GridItem col={6}>
|
|
223
|
+
<Textarea
|
|
224
|
+
label={formatMessage({
|
|
225
|
+
id: 'global.description',
|
|
226
|
+
defaultMessage: 'Description',
|
|
227
|
+
})}
|
|
228
|
+
name="description"
|
|
229
|
+
error={errors.description && formatMessage({ id: errors.description })}
|
|
230
|
+
onChange={handleChange}
|
|
231
|
+
>
|
|
232
|
+
{values.description}
|
|
233
|
+
</Textarea>
|
|
234
|
+
</GridItem>
|
|
235
|
+
</Grid>
|
|
236
|
+
</Flex>
|
|
237
|
+
</Box>
|
|
238
|
+
{!isLayoutLoading && !isRoleLoading ? (
|
|
239
|
+
<Box shadow="filterShadow" hasRadius>
|
|
240
|
+
<Permissions
|
|
241
|
+
isFormDisabled={false}
|
|
242
|
+
ref={permissionsRef}
|
|
243
|
+
permissions={rolePermissions}
|
|
244
|
+
layout={permissionsLayout}
|
|
245
|
+
/>
|
|
246
|
+
</Box>
|
|
247
|
+
) : (
|
|
248
|
+
<Box background="neutral0" padding={6} shadow="filterShadow" hasRadius>
|
|
249
|
+
<LoadingIndicatorPage />
|
|
250
|
+
</Box>
|
|
251
|
+
)}
|
|
252
|
+
</Flex>
|
|
253
|
+
</ContentLayout>
|
|
254
|
+
</>
|
|
255
|
+
</Form>
|
|
256
|
+
)}
|
|
257
|
+
</Formik>
|
|
258
|
+
</Main>
|
|
259
|
+
);
|
|
6
260
|
};
|
|
7
261
|
|
|
8
|
-
export default
|
|
262
|
+
export default function () {
|
|
263
|
+
return (
|
|
264
|
+
<CheckPagePermissions permissions={adminPermissions.settings.roles.create}>
|
|
265
|
+
<CreatePage />
|
|
266
|
+
</CheckPagePermissions>
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export { CreatePage };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import IS_DISABLED from 'ee_else_ce/pages/SettingsPage/pages/Roles/EditPage/components/ConditionsModal/ActionRow/utils/constants';
|
|
4
3
|
import { Box, Flex, Typography, MultiSelectNested } from '@strapi/design-system';
|
|
5
4
|
import { useIntl } from 'react-intl';
|
|
6
5
|
|
|
@@ -52,7 +51,7 @@ const ActionRow = ({
|
|
|
52
51
|
onChange={handleChange}
|
|
53
52
|
value={getSelectedValues(value)}
|
|
54
53
|
options={getNestedOptions(arrayOfOptionsGroupedByCategory)}
|
|
55
|
-
disabled={isFormDisabled
|
|
54
|
+
disabled={isFormDisabled}
|
|
56
55
|
/>
|
|
57
56
|
</Box>
|
|
58
57
|
</Flex>
|
|
@@ -6,7 +6,6 @@ import get from 'lodash/get';
|
|
|
6
6
|
import omit from 'lodash/omit';
|
|
7
7
|
import { useIntl } from 'react-intl';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
|
-
import IS_DISABLED from 'ee_else_ce/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/Collapse/utils/constants';
|
|
10
9
|
import { usePermissionsDataManager } from '../../../../../../../../hooks';
|
|
11
10
|
import ConditionsButton from '../../ConditionsButton';
|
|
12
11
|
import ConditionsModal from '../../ConditionsModal';
|
|
@@ -179,7 +178,7 @@ const Collapse = ({
|
|
|
179
178
|
<Cell key={actionId} justifyContent="center" alignItems="center">
|
|
180
179
|
{hasConditions && <TinyDot />}
|
|
181
180
|
<BaseCheckbox
|
|
182
|
-
disabled={isFormDisabled
|
|
181
|
+
disabled={isFormDisabled}
|
|
183
182
|
name={checkboxName}
|
|
184
183
|
aria-label={formatMessage(
|
|
185
184
|
{
|
|
@@ -208,7 +207,7 @@ const Collapse = ({
|
|
|
208
207
|
<Cell key={actionId} justifyContent="center" alignItems="center">
|
|
209
208
|
{hasConditions && <TinyDot />}
|
|
210
209
|
<BaseCheckbox
|
|
211
|
-
disabled={isFormDisabled
|
|
210
|
+
disabled={isFormDisabled}
|
|
212
211
|
indeterminate={hasConditions}
|
|
213
212
|
name={checkboxName}
|
|
214
213
|
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
|
@@ -4,7 +4,6 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { BaseCheckbox, Flex } from '@strapi/design-system';
|
|
6
6
|
import get from 'lodash/get';
|
|
7
|
-
import IS_DISABLED from 'ee_else_ce/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/constants';
|
|
8
7
|
import { usePermissionsDataManager } from '../../../../../../../../../hooks';
|
|
9
8
|
import HiddenAction from '../../../HiddenAction';
|
|
10
9
|
import { cellWidth, rowHeight } from '../../../Permissions/utils/constants';
|
|
@@ -133,7 +132,7 @@ const ActionRow = ({
|
|
|
133
132
|
return (
|
|
134
133
|
<Cell key={actionId} justifyContent="center" alignItems="center">
|
|
135
134
|
<BaseCheckbox
|
|
136
|
-
disabled={isFormDisabled
|
|
135
|
+
disabled={isFormDisabled}
|
|
137
136
|
name={checkboxName.join('..')}
|
|
138
137
|
aria-label={formatMessage(
|
|
139
138
|
{
|
|
@@ -164,7 +163,7 @@ const ActionRow = ({
|
|
|
164
163
|
return (
|
|
165
164
|
<Cell key={label} justifyContent="center" alignItems="center">
|
|
166
165
|
<BaseCheckbox
|
|
167
|
-
disabled={isFormDisabled
|
|
166
|
+
disabled={isFormDisabled}
|
|
168
167
|
name={checkboxName.join('..')}
|
|
169
168
|
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
|
170
169
|
onValueChange={(value) => {
|
|
@@ -5,7 +5,6 @@ import upperFirst from 'lodash/upperFirst';
|
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import { BaseCheckbox, Box, Flex, Typography } from '@strapi/design-system';
|
|
8
|
-
import IS_DISABLED from 'ee_else_ce/pages/SettingsPage/pages/Roles/EditPage/components/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/utils/constants';
|
|
9
8
|
import { usePermissionsDataManager } from '../../../../../../../../../hooks';
|
|
10
9
|
import CollapseLabel from '../../../CollapseLabel';
|
|
11
10
|
import Curve from '../../../Curve';
|
|
@@ -150,7 +149,7 @@ const SubActionRow = ({
|
|
|
150
149
|
return (
|
|
151
150
|
<Cell key={propertyLabel} justifyContent="center" alignItems="center">
|
|
152
151
|
<BaseCheckbox
|
|
153
|
-
disabled={isFormDisabled
|
|
152
|
+
disabled={isFormDisabled}
|
|
154
153
|
name={checkboxName.join('..')}
|
|
155
154
|
aria-label={formatMessage(
|
|
156
155
|
{
|
|
@@ -181,7 +180,7 @@ const SubActionRow = ({
|
|
|
181
180
|
<Cell key={propertyLabel} justifyContent="center" alignItems="center">
|
|
182
181
|
<BaseCheckbox
|
|
183
182
|
key={propertyLabel}
|
|
184
|
-
disabled={isFormDisabled
|
|
183
|
+
disabled={isFormDisabled}
|
|
185
184
|
name={checkboxName.join('..')}
|
|
186
185
|
aria-label={formatMessage(
|
|
187
186
|
{
|
|
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { BaseCheckbox, Box, Flex, Typography } from '@strapi/design-system';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import get from 'lodash/get';
|
|
6
|
-
import IS_DISABLED from 'ee_else_ce/pages/SettingsPage/pages/Roles/EditPage/components/GlobalActions/utils/constants';
|
|
7
6
|
import { useIntl } from 'react-intl';
|
|
8
7
|
import { usePermissionsDataManager } from '../../../../../../../hooks';
|
|
9
8
|
import { cellWidth, firstRowWidth } from '../Permissions/utils/constants';
|
|
@@ -28,10 +27,16 @@ const GlobalActions = ({ actions, isFormDisabled, kind }) => {
|
|
|
28
27
|
|
|
29
28
|
return (
|
|
30
29
|
<Box paddingBottom={4} paddingTop={6} style={{ paddingLeft: firstRowWidth }}>
|
|
31
|
-
<Flex
|
|
30
|
+
<Flex gap={0}>
|
|
32
31
|
{displayedActions.map(({ label, actionId }) => {
|
|
33
32
|
return (
|
|
34
|
-
<CenteredStack
|
|
33
|
+
<CenteredStack
|
|
34
|
+
direction="column"
|
|
35
|
+
alignItems="center"
|
|
36
|
+
justifyContent="center"
|
|
37
|
+
key={actionId}
|
|
38
|
+
gap={3}
|
|
39
|
+
>
|
|
35
40
|
<Typography variant="sigma" textColor="neutral500">
|
|
36
41
|
{formatMessage({
|
|
37
42
|
id: `Settings.roles.form.permissions.${label.toLowerCase()}`,
|
|
@@ -39,7 +44,7 @@ const GlobalActions = ({ actions, isFormDisabled, kind }) => {
|
|
|
39
44
|
})}
|
|
40
45
|
</Typography>
|
|
41
46
|
<BaseCheckbox
|
|
42
|
-
disabled={isFormDisabled
|
|
47
|
+
disabled={isFormDisabled}
|
|
43
48
|
onValueChange={(value) => {
|
|
44
49
|
onChangeCollectionTypeGlobalActionCheckbox(kind, actionId, value);
|
|
45
50
|
}}
|
|
@@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { Grid, GridItem, Box, Checkbox, Flex, Typography } from '@strapi/design-system';
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
6
|
import get from 'lodash/get';
|
|
7
|
-
import IS_DISABLED from 'ee_else_ce/pages/SettingsPage/pages/Roles/EditPage/components/PluginsAndSettings/SubCategory/utils/constants';
|
|
8
7
|
import { usePermissionsDataManager } from '../../../../../../../../hooks';
|
|
9
8
|
import { getCheckboxState, removeConditionKeyFromData } from '../../utils';
|
|
10
9
|
import ConditionsButton from '../../ConditionsButton';
|
|
@@ -77,7 +76,7 @@ const SubCategory = ({ categoryName, isFormDisabled, subCategoryName, actions, p
|
|
|
77
76
|
<Box paddingLeft={4}>
|
|
78
77
|
<Checkbox
|
|
79
78
|
name={pathToData.join('..')}
|
|
80
|
-
disabled={isFormDisabled
|
|
79
|
+
disabled={isFormDisabled}
|
|
81
80
|
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
|
82
81
|
onValueChange={(value) => {
|
|
83
82
|
onChangeParentCheckbox({
|
|
@@ -99,13 +98,10 @@ const SubCategory = ({ categoryName, isFormDisabled, subCategoryName, actions, p
|
|
|
99
98
|
{formattedActions.map(({ checkboxName, value, action, displayName, hasConditions }) => {
|
|
100
99
|
return (
|
|
101
100
|
<GridItem col={3} key={action}>
|
|
102
|
-
<CheckboxWrapper
|
|
103
|
-
disabled={isFormDisabled || IS_DISABLED}
|
|
104
|
-
hasConditions={hasConditions}
|
|
105
|
-
>
|
|
101
|
+
<CheckboxWrapper disabled={isFormDisabled} hasConditions={hasConditions}>
|
|
106
102
|
<Checkbox
|
|
107
103
|
name={checkboxName}
|
|
108
|
-
disabled={isFormDisabled
|
|
104
|
+
disabled={isFormDisabled}
|
|
109
105
|
// Keep same signature as packages/core/admin/admin/src/components/Roles/Permissions/index.js l.91
|
|
110
106
|
onValueChange={(value) => {
|
|
111
107
|
onChangeSimpleCheckbox({
|