@strapi/plugin-users-permissions 0.0.0-next.f5b09a8e61e059f02784478e27c310c6290be088 → 0.0.0-next.f6dca5adf05ef6bed9605a1535999ab0bbbf063e

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.
Files changed (192) hide show
  1. package/.eslintrc +4 -1
  2. package/LICENSE +18 -3
  3. package/admin/src/components/BoundRoute/{index.js → index.jsx} +2 -2
  4. package/admin/src/components/FormModal/Input/{index.js → index.jsx} +32 -31
  5. package/admin/src/components/FormModal/index.jsx +115 -0
  6. package/admin/src/components/Permissions/PermissionRow/{CheckboxWrapper.js → CheckboxWrapper.jsx} +4 -3
  7. package/admin/src/components/Permissions/PermissionRow/{SubCategory.js → SubCategory.jsx} +13 -22
  8. package/admin/src/components/Permissions/index.jsx +47 -0
  9. package/admin/src/components/Permissions/reducer.js +1 -1
  10. package/admin/src/components/Policies/{index.js → index.jsx} +7 -5
  11. package/admin/src/components/UsersPermissions/{index.js → index.jsx} +15 -7
  12. package/admin/src/components/UsersPermissions/reducer.js +1 -1
  13. package/admin/src/index.js +15 -32
  14. package/admin/src/pages/AdvancedSettings/index.jsx +214 -0
  15. package/admin/src/pages/AdvancedSettings/utils/layout.js +20 -35
  16. package/admin/src/pages/AdvancedSettings/utils/schema.js +5 -2
  17. package/admin/src/pages/EmailTemplates/components/EmailForm.jsx +156 -0
  18. package/admin/src/pages/EmailTemplates/components/{EmailTable.js → EmailTable.jsx} +20 -17
  19. package/admin/src/pages/EmailTemplates/{index.js → index.jsx} +36 -62
  20. package/admin/src/pages/EmailTemplates/utils/schema.js +18 -6
  21. package/admin/src/pages/Providers/{index.js → index.jsx} +98 -113
  22. package/admin/src/pages/Providers/utils/forms.js +23 -11
  23. package/admin/src/pages/Roles/constants.js +3 -3
  24. package/admin/src/pages/Roles/hooks/usePlugins.js +4 -4
  25. package/admin/src/pages/Roles/index.jsx +24 -0
  26. package/admin/src/pages/Roles/pages/{CreatePage.js → CreatePage.jsx} +53 -58
  27. package/admin/src/pages/Roles/pages/{EditPage.js → EditPage.jsx} +63 -68
  28. package/admin/src/pages/Roles/pages/ListPage/components/{TableBody.js → TableBody.jsx} +27 -31
  29. package/admin/src/pages/Roles/pages/ListPage/{index.js → index.jsx} +79 -55
  30. package/admin/src/translations/en.json +1 -1
  31. package/admin/src/utils/prefixPluginTranslations.js +13 -0
  32. package/dist/_chunks/ar-BguGUqwK.js +44 -0
  33. package/dist/_chunks/ar-BguGUqwK.js.map +1 -0
  34. package/dist/_chunks/ar-CK8BRRXB.mjs +44 -0
  35. package/dist/_chunks/ar-CK8BRRXB.mjs.map +1 -0
  36. package/dist/_chunks/cs-BVigMk0l.mjs +50 -0
  37. package/dist/_chunks/cs-BVigMk0l.mjs.map +1 -0
  38. package/dist/_chunks/cs-BW8-K_GY.js +50 -0
  39. package/dist/_chunks/cs-BW8-K_GY.js.map +1 -0
  40. package/dist/_chunks/de-BKUdRFI4.mjs +62 -0
  41. package/dist/_chunks/de-BKUdRFI4.mjs.map +1 -0
  42. package/dist/_chunks/de-owXpVluI.js +62 -0
  43. package/dist/_chunks/de-owXpVluI.js.map +1 -0
  44. package/dist/_chunks/dk-BQiTK50l.mjs +86 -0
  45. package/dist/_chunks/dk-BQiTK50l.mjs.map +1 -0
  46. package/dist/_chunks/dk-LXAnbuBk.js +86 -0
  47. package/dist/_chunks/dk-LXAnbuBk.js.map +1 -0
  48. package/dist/_chunks/en-DOHtPf-2.mjs +86 -0
  49. package/dist/_chunks/en-DOHtPf-2.mjs.map +1 -0
  50. package/dist/_chunks/en-MHo5mcsU.js +86 -0
  51. package/dist/_chunks/en-MHo5mcsU.js.map +1 -0
  52. package/dist/_chunks/es-BwLCLXAQ.js +86 -0
  53. package/dist/_chunks/es-BwLCLXAQ.js.map +1 -0
  54. package/dist/_chunks/es-DNgOVMjD.mjs +86 -0
  55. package/dist/_chunks/es-DNgOVMjD.mjs.map +1 -0
  56. package/dist/_chunks/fr-DkgRugiU.mjs +50 -0
  57. package/dist/_chunks/fr-DkgRugiU.mjs.map +1 -0
  58. package/dist/_chunks/fr-DkhpSjjm.js +50 -0
  59. package/dist/_chunks/fr-DkhpSjjm.js.map +1 -0
  60. package/dist/_chunks/id-BTemOeTZ.js +62 -0
  61. package/dist/_chunks/id-BTemOeTZ.js.map +1 -0
  62. package/dist/_chunks/id-BdEsvnaF.mjs +62 -0
  63. package/dist/_chunks/id-BdEsvnaF.mjs.map +1 -0
  64. package/dist/_chunks/index-BH6NqE8I.js +245 -0
  65. package/dist/_chunks/index-BH6NqE8I.js.map +1 -0
  66. package/dist/_chunks/index-C3i__jX-.js +281 -0
  67. package/dist/_chunks/index-C3i__jX-.js.map +1 -0
  68. package/dist/_chunks/index-CFzpNgIL.js +640 -0
  69. package/dist/_chunks/index-CFzpNgIL.js.map +1 -0
  70. package/dist/_chunks/index-CJUWqtrZ.mjs +344 -0
  71. package/dist/_chunks/index-CJUWqtrZ.mjs.map +1 -0
  72. package/dist/_chunks/index-CcWTKtCY.js +366 -0
  73. package/dist/_chunks/index-CcWTKtCY.js.map +1 -0
  74. package/dist/_chunks/index-CnX2wiLY.mjs +1142 -0
  75. package/dist/_chunks/index-CnX2wiLY.mjs.map +1 -0
  76. package/dist/_chunks/index-DUWx-KG9-C1E7ADbJ.mjs +11984 -0
  77. package/dist/_chunks/index-DUWx-KG9-C1E7ADbJ.mjs.map +1 -0
  78. package/dist/_chunks/index-DUWx-KG9-fMZ4nmrb.js +12008 -0
  79. package/dist/_chunks/index-DUWx-KG9-fMZ4nmrb.js.map +1 -0
  80. package/dist/_chunks/index-DruWuFWL.js +1172 -0
  81. package/dist/_chunks/index-DruWuFWL.js.map +1 -0
  82. package/dist/_chunks/index-PJoz36kJ.mjs +262 -0
  83. package/dist/_chunks/index-PJoz36kJ.mjs.map +1 -0
  84. package/dist/_chunks/index-R4R0dEOv.mjs +246 -0
  85. package/dist/_chunks/index-R4R0dEOv.mjs.map +1 -0
  86. package/dist/_chunks/index-XOcQhJMB.mjs +617 -0
  87. package/dist/_chunks/index-XOcQhJMB.mjs.map +1 -0
  88. package/dist/_chunks/it-B-rv0E24.mjs +62 -0
  89. package/dist/_chunks/it-B-rv0E24.mjs.map +1 -0
  90. package/dist/_chunks/it-D1rH6V6_.js +62 -0
  91. package/dist/_chunks/it-D1rH6V6_.js.map +1 -0
  92. package/dist/_chunks/ja-C8K-VBPD.mjs +48 -0
  93. package/dist/_chunks/ja-C8K-VBPD.mjs.map +1 -0
  94. package/dist/_chunks/ja-DqShgTMf.js +48 -0
  95. package/dist/_chunks/ja-DqShgTMf.js.map +1 -0
  96. package/dist/_chunks/ko-B9DGEPWH.js +86 -0
  97. package/dist/_chunks/ko-B9DGEPWH.js.map +1 -0
  98. package/dist/_chunks/ko-Busb0wIY.mjs +86 -0
  99. package/dist/_chunks/ko-Busb0wIY.mjs.map +1 -0
  100. package/dist/_chunks/ms-ByvsQjRt.mjs +49 -0
  101. package/dist/_chunks/ms-ByvsQjRt.mjs.map +1 -0
  102. package/dist/_chunks/ms-CPBU3LWf.js +49 -0
  103. package/dist/_chunks/ms-CPBU3LWf.js.map +1 -0
  104. package/dist/_chunks/nl-5qO8Rpcy.mjs +48 -0
  105. package/dist/_chunks/nl-5qO8Rpcy.mjs.map +1 -0
  106. package/dist/_chunks/nl-CwNB6YoO.js +48 -0
  107. package/dist/_chunks/nl-CwNB6YoO.js.map +1 -0
  108. package/dist/_chunks/pl-BdIzifBE.mjs +86 -0
  109. package/dist/_chunks/pl-BdIzifBE.mjs.map +1 -0
  110. package/dist/_chunks/pl-Do9UD69f.js +86 -0
  111. package/dist/_chunks/pl-Do9UD69f.js.map +1 -0
  112. package/dist/_chunks/pt-BIO24ioG.mjs +48 -0
  113. package/dist/_chunks/pt-BIO24ioG.mjs.map +1 -0
  114. package/dist/_chunks/pt-BR-D7dZhxuP.js +44 -0
  115. package/dist/_chunks/pt-BR-D7dZhxuP.js.map +1 -0
  116. package/dist/_chunks/pt-BR-f0p23AQZ.mjs +44 -0
  117. package/dist/_chunks/pt-BR-f0p23AQZ.mjs.map +1 -0
  118. package/dist/_chunks/pt-fdvyOnUp.js +48 -0
  119. package/dist/_chunks/pt-fdvyOnUp.js.map +1 -0
  120. package/dist/_chunks/ru-C94rjPGA.js +86 -0
  121. package/dist/_chunks/ru-C94rjPGA.js.map +1 -0
  122. package/dist/_chunks/ru-VWy-IB7K.mjs +86 -0
  123. package/dist/_chunks/ru-VWy-IB7K.mjs.map +1 -0
  124. package/dist/_chunks/sk-BABEhykl.js +50 -0
  125. package/dist/_chunks/sk-BABEhykl.js.map +1 -0
  126. package/dist/_chunks/sk-B_LIcepm.mjs +50 -0
  127. package/dist/_chunks/sk-B_LIcepm.mjs.map +1 -0
  128. package/dist/_chunks/sv-ABLKOokl.mjs +86 -0
  129. package/dist/_chunks/sv-ABLKOokl.mjs.map +1 -0
  130. package/dist/_chunks/sv-Be43LhA9.js +86 -0
  131. package/dist/_chunks/sv-Be43LhA9.js.map +1 -0
  132. package/dist/_chunks/th-DKyP7ueR.mjs +60 -0
  133. package/dist/_chunks/th-DKyP7ueR.mjs.map +1 -0
  134. package/dist/_chunks/th-DgVhVLhL.js +60 -0
  135. package/dist/_chunks/th-DgVhVLhL.js.map +1 -0
  136. package/dist/_chunks/tr-B_idhkEs.js +85 -0
  137. package/dist/_chunks/tr-B_idhkEs.js.map +1 -0
  138. package/dist/_chunks/tr-qa1Q5UjC.mjs +85 -0
  139. package/dist/_chunks/tr-qa1Q5UjC.mjs.map +1 -0
  140. package/dist/_chunks/uk-BmRqbeQc.mjs +49 -0
  141. package/dist/_chunks/uk-BmRqbeQc.mjs.map +1 -0
  142. package/dist/_chunks/uk-LHOivnhP.js +49 -0
  143. package/dist/_chunks/uk-LHOivnhP.js.map +1 -0
  144. package/dist/_chunks/vi-CdVRdKDw.js +50 -0
  145. package/dist/_chunks/vi-CdVRdKDw.js.map +1 -0
  146. package/dist/_chunks/vi-HW-EdMea.mjs +50 -0
  147. package/dist/_chunks/vi-HW-EdMea.mjs.map +1 -0
  148. package/dist/_chunks/zh-5hKkVPA4.mjs +86 -0
  149. package/dist/_chunks/zh-5hKkVPA4.mjs.map +1 -0
  150. package/dist/_chunks/zh-Cuq8gMnF.js +86 -0
  151. package/dist/_chunks/zh-Cuq8gMnF.js.map +1 -0
  152. package/dist/_chunks/zh-Hans-BHilK-yc.mjs +86 -0
  153. package/dist/_chunks/zh-Hans-BHilK-yc.mjs.map +1 -0
  154. package/dist/_chunks/zh-Hans-GQDMKtY4.js +86 -0
  155. package/dist/_chunks/zh-Hans-GQDMKtY4.js.map +1 -0
  156. package/dist/admin/index.js +4 -0
  157. package/dist/admin/index.js.map +1 -0
  158. package/dist/admin/index.mjs +5 -0
  159. package/dist/admin/index.mjs.map +1 -0
  160. package/package.json +27 -28
  161. package/packup.config.ts +0 -20
  162. package/server/bootstrap/index.js +18 -51
  163. package/server/bootstrap/users-permissions-actions.js +6 -0
  164. package/server/config.js +29 -0
  165. package/server/content-types/user/index.js +0 -1
  166. package/server/controllers/auth.js +62 -63
  167. package/server/controllers/content-manager-user.js +28 -30
  168. package/server/controllers/role.js +17 -4
  169. package/server/controllers/user.js +8 -9
  170. package/server/controllers/validation/auth.js +81 -25
  171. package/server/middlewares/rateLimit.js +1 -1
  172. package/server/register.js +1 -1
  173. package/server/services/jwt.js +3 -3
  174. package/server/services/permission.js +3 -7
  175. package/server/services/providers-registry.js +469 -261
  176. package/server/services/providers.js +10 -5
  177. package/server/services/role.js +15 -13
  178. package/server/services/user.js +56 -19
  179. package/server/services/users-permissions.js +15 -13
  180. package/server/utils/index.d.ts +2 -1
  181. package/server/utils/sanitize/sanitizers.js +7 -3
  182. package/server/utils/sanitize/visitors/remove-user-relation-from-role-entities.js +2 -2
  183. package/admin/src/components/FormModal/index.js +0 -126
  184. package/admin/src/components/Permissions/index.js +0 -55
  185. package/admin/src/pages/AdvancedSettings/index.js +0 -259
  186. package/admin/src/pages/EmailTemplates/components/EmailForm.js +0 -176
  187. package/admin/src/pages/Roles/index.js +0 -33
  188. package/admin/src/pages/Roles/pages/ListPage/utils/api.js +0 -30
  189. package/server/bootstrap/grant-config.js +0 -131
  190. package/strapi-server.js +0 -3
  191. /package/admin/src/components/Permissions/PermissionRow/{index.js → index.jsx} +0 -0
  192. /package/admin/src/contexts/UsersPermissionsContext/{index.js → index.jsx} +0 -0
@@ -1,259 +0,0 @@
1
- import React from 'react';
2
-
3
- import {
4
- Box,
5
- Button,
6
- ContentLayout,
7
- Flex,
8
- Grid,
9
- GridItem,
10
- HeaderLayout,
11
- Main,
12
- Option,
13
- Select,
14
- Typography,
15
- useNotifyAT,
16
- } from '@strapi/design-system';
17
- import {
18
- CheckPagePermissions,
19
- Form,
20
- GenericInput,
21
- LoadingIndicatorPage,
22
- SettingsPageTitle,
23
- useAPIErrorHandler,
24
- useFetchClient,
25
- useFocusWhenNavigate,
26
- useNotification,
27
- useOverlayBlocker,
28
- useRBAC,
29
- } from '@strapi/helper-plugin';
30
- import { Check } from '@strapi/icons';
31
- import { Formik } from 'formik';
32
- import { useIntl } from 'react-intl';
33
- import { useMutation, useQuery, useQueryClient } from 'react-query';
34
-
35
- import { PERMISSIONS } from '../../constants';
36
- import { getTrad } from '../../utils';
37
-
38
- import layout from './utils/layout';
39
- import schema from './utils/schema';
40
-
41
- const ProtectedAdvancedSettingsPage = () => (
42
- <CheckPagePermissions permissions={PERMISSIONS.readAdvancedSettings}>
43
- <AdvancedSettingsPage />
44
- </CheckPagePermissions>
45
- );
46
-
47
- const AdvancedSettingsPage = () => {
48
- const { formatMessage } = useIntl();
49
- const toggleNotification = useNotification();
50
- const { lockApp, unlockApp } = useOverlayBlocker();
51
- const { notifyStatus } = useNotifyAT();
52
- const queryClient = useQueryClient();
53
- const { get, put } = useFetchClient();
54
- const { formatAPIError } = useAPIErrorHandler();
55
-
56
- useFocusWhenNavigate();
57
-
58
- const {
59
- isLoading: isLoadingForPermissions,
60
- allowedActions: { canUpdate },
61
- } = useRBAC({ update: PERMISSIONS.updateAdvancedSettings });
62
-
63
- const { isLoading: isLoadingData, data } = useQuery(
64
- ['users-permissions', 'advanced'],
65
- async () => {
66
- const { data } = await get('/users-permissions/advanced');
67
-
68
- return data;
69
- },
70
- {
71
- onSuccess() {
72
- notifyStatus(
73
- formatMessage({
74
- id: getTrad('Form.advancedSettings.data.loaded'),
75
- defaultMessage: 'Advanced settings data has been loaded',
76
- })
77
- );
78
- },
79
- onError() {
80
- toggleNotification({
81
- type: 'warning',
82
- message: { id: getTrad('notification.error'), defaultMessage: 'An error occured' },
83
- });
84
- },
85
- }
86
- );
87
-
88
- const isLoading = isLoadingForPermissions || isLoadingData;
89
-
90
- const submitMutation = useMutation((body) => put('/users-permissions/advanced', body), {
91
- async onSuccess() {
92
- await queryClient.invalidateQueries(['users-permissions', 'advanced']);
93
-
94
- toggleNotification({
95
- type: 'success',
96
- message: { id: getTrad('notification.success.saved'), defaultMessage: 'Saved' },
97
- });
98
-
99
- unlockApp();
100
- },
101
- onError(error) {
102
- toggleNotification({
103
- type: 'warning',
104
- message: formatAPIError(error),
105
- });
106
-
107
- unlockApp();
108
- },
109
- refetchActive: true,
110
- });
111
-
112
- const { isLoading: isSubmittingForm } = submitMutation;
113
-
114
- const handleSubmit = async (body) => {
115
- lockApp();
116
-
117
- submitMutation.mutate({
118
- ...body,
119
- email_confirmation_redirection: body.email_confirmation
120
- ? body.email_confirmation_redirection
121
- : '',
122
- });
123
- };
124
-
125
- if (isLoading) {
126
- return (
127
- <Main aria-busy="true">
128
- <SettingsPageTitle
129
- name={formatMessage({
130
- id: getTrad('HeaderNav.link.advancedSettings'),
131
- defaultMessage: 'Advanced Settings',
132
- })}
133
- />
134
- <HeaderLayout
135
- title={formatMessage({
136
- id: getTrad('HeaderNav.link.advancedSettings'),
137
- defaultMessage: 'Advanced Settings',
138
- })}
139
- />
140
- <ContentLayout>
141
- <LoadingIndicatorPage />
142
- </ContentLayout>
143
- </Main>
144
- );
145
- }
146
-
147
- return (
148
- <Main aria-busy={isSubmittingForm}>
149
- <SettingsPageTitle
150
- name={formatMessage({
151
- id: getTrad('HeaderNav.link.advancedSettings'),
152
- defaultMessage: 'Advanced Settings',
153
- })}
154
- />
155
- <Formik
156
- onSubmit={handleSubmit}
157
- initialValues={data.settings}
158
- validateOnChange={false}
159
- validationSchema={schema}
160
- enableReinitialize
161
- >
162
- {({ errors, values, handleChange, isSubmitting, dirty }) => {
163
- return (
164
- <Form>
165
- <HeaderLayout
166
- title={formatMessage({
167
- id: getTrad('HeaderNav.link.advancedSettings'),
168
- defaultMessage: 'Advanced Settings',
169
- })}
170
- primaryAction={
171
- <Button
172
- loading={isSubmitting}
173
- type="submit"
174
- disabled={canUpdate ? !dirty : !canUpdate}
175
- startIcon={<Check />}
176
- size="S"
177
- >
178
- {formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
179
- </Button>
180
- }
181
- />
182
- <ContentLayout>
183
- <Box
184
- background="neutral0"
185
- hasRadius
186
- shadow="filterShadow"
187
- paddingTop={6}
188
- paddingBottom={6}
189
- paddingLeft={7}
190
- paddingRight={7}
191
- >
192
- <Flex direction="column" alignItems="stretch" gap={4}>
193
- <Typography variant="delta" as="h2">
194
- {formatMessage({
195
- id: 'global.settings',
196
- defaultMessage: 'Settings',
197
- })}
198
- </Typography>
199
- <Grid gap={6}>
200
- <GridItem col={6} s={12}>
201
- <Select
202
- label={formatMessage({
203
- id: getTrad('EditForm.inputSelect.label.role'),
204
- defaultMessage: 'Default role for authenticated users',
205
- })}
206
- value={values.default_role}
207
- hint={formatMessage({
208
- id: getTrad('EditForm.inputSelect.description.role'),
209
- defaultMessage:
210
- 'It will attach the new authenticated user to the selected role.',
211
- })}
212
- onChange={(e) =>
213
- handleChange({ target: { name: 'default_role', value: e } })
214
- }
215
- >
216
- {data.roles.map((role) => {
217
- return (
218
- <Option key={role.type} value={role.type}>
219
- {role.name}
220
- </Option>
221
- );
222
- })}
223
- </Select>
224
- </GridItem>
225
- {layout.map((input) => {
226
- let value = values[input.name];
227
-
228
- if (!value) {
229
- value = input.type === 'bool' ? false : '';
230
- }
231
-
232
- return (
233
- <GridItem key={input.name} {...input.size}>
234
- <GenericInput
235
- {...input}
236
- value={value}
237
- error={errors[input.name]}
238
- disabled={
239
- input.name === 'email_confirmation_redirection' &&
240
- values.email_confirmation === false
241
- }
242
- onChange={handleChange}
243
- />
244
- </GridItem>
245
- );
246
- })}
247
- </Grid>
248
- </Flex>
249
- </Box>
250
- </ContentLayout>
251
- </Form>
252
- );
253
- }}
254
- </Formik>
255
- </Main>
256
- );
257
- };
258
-
259
- export default ProtectedAdvancedSettingsPage;
@@ -1,176 +0,0 @@
1
- import React from 'react';
2
-
3
- import {
4
- Button,
5
- Grid,
6
- GridItem,
7
- ModalBody,
8
- ModalFooter,
9
- ModalHeader,
10
- ModalLayout,
11
- Textarea,
12
- } from '@strapi/design-system';
13
- import { Breadcrumbs, Crumb } from '@strapi/design-system/v2';
14
- import { Form, GenericInput } from '@strapi/helper-plugin';
15
- import { Formik } from 'formik';
16
- import PropTypes from 'prop-types';
17
- import { useIntl } from 'react-intl';
18
-
19
- import { getTrad } from '../../../utils';
20
- import schema from '../utils/schema';
21
-
22
- const EmailForm = ({ template, onToggle, onSubmit }) => {
23
- const { formatMessage } = useIntl();
24
-
25
- return (
26
- <ModalLayout
27
- onClose={onToggle}
28
- labelledBy={`${formatMessage({
29
- id: getTrad('PopUpForm.header.edit.email-templates'),
30
- defaultMessage: 'Edit email template',
31
- })}, ${formatMessage({ id: getTrad(template.display), defaultMessage: template.display })}`}
32
- >
33
- <ModalHeader>
34
- <Breadcrumbs
35
- label={`${formatMessage({
36
- id: getTrad('PopUpForm.header.edit.email-templates'),
37
- defaultMessage: 'Edit email template',
38
- })}, ${formatMessage({
39
- id: getTrad(template.display),
40
- defaultMessage: template.display,
41
- })}`}
42
- >
43
- <Crumb>
44
- {formatMessage({
45
- id: getTrad('PopUpForm.header.edit.email-templates'),
46
- defaultMessage: 'Edit email template',
47
- })}
48
- </Crumb>
49
- <Crumb isCurrent>
50
- {formatMessage({ id: getTrad(template.display), defaultMessage: template.display })}
51
- </Crumb>
52
- </Breadcrumbs>
53
- </ModalHeader>
54
- <Formik
55
- onSubmit={onSubmit}
56
- initialValues={template}
57
- validateOnChange={false}
58
- validationSchema={schema}
59
- enableReinitialize
60
- >
61
- {({ errors, values, handleChange, isSubmitting }) => {
62
- return (
63
- <Form>
64
- <ModalBody>
65
- <Grid gap={5}>
66
- <GridItem col={6} s={12}>
67
- <GenericInput
68
- intlLabel={{
69
- id: getTrad('PopUpForm.Email.options.from.name.label'),
70
- defaultMessage: 'Shipper name',
71
- }}
72
- name="options.from.name"
73
- onChange={handleChange}
74
- value={values.options.from.name}
75
- error={errors?.options?.from?.name}
76
- type="text"
77
- />
78
- </GridItem>
79
- <GridItem col={6} s={12}>
80
- <GenericInput
81
- intlLabel={{
82
- id: getTrad('PopUpForm.Email.options.from.email.label'),
83
- defaultMessage: 'Shipper email',
84
- }}
85
- name="options.from.email"
86
- onChange={handleChange}
87
- value={values.options.from.email}
88
- error={errors?.options?.from?.email}
89
- type="text"
90
- />
91
- </GridItem>
92
- <GridItem col={6} s={12}>
93
- <GenericInput
94
- intlLabel={{
95
- id: getTrad('PopUpForm.Email.options.response_email.label'),
96
- defaultMessage: 'Response email',
97
- }}
98
- name="options.response_email"
99
- onChange={handleChange}
100
- value={values.options.response_email}
101
- error={errors?.options?.response_email}
102
- type="text"
103
- />
104
- </GridItem>
105
- <GridItem col={6} s={12}>
106
- <GenericInput
107
- intlLabel={{
108
- id: getTrad('PopUpForm.Email.options.object.label'),
109
- defaultMessage: 'Subject',
110
- }}
111
- name="options.object"
112
- onChange={handleChange}
113
- value={values.options.object}
114
- error={errors?.options?.object}
115
- type="text"
116
- />
117
- </GridItem>
118
- <GridItem col={12} s={12}>
119
- <Textarea
120
- label={formatMessage({
121
- id: getTrad('PopUpForm.Email.options.message.label'),
122
- defaultMessage: 'Message',
123
- })}
124
- id="options.message"
125
- onChange={handleChange}
126
- value={values.options.message}
127
- error={
128
- errors?.options?.message &&
129
- formatMessage({
130
- id: errors.options.message,
131
- defaultMessage: errors.options.message,
132
- })
133
- }
134
- />
135
- </GridItem>
136
- </Grid>
137
- </ModalBody>
138
- <ModalFooter
139
- startActions={
140
- <Button onClick={onToggle} variant="tertiary">
141
- Cancel
142
- </Button>
143
- }
144
- endActions={
145
- <Button loading={isSubmitting} type="submit">
146
- Finish
147
- </Button>
148
- }
149
- />
150
- </Form>
151
- );
152
- }}
153
- </Formik>
154
- </ModalLayout>
155
- );
156
- };
157
-
158
- EmailForm.propTypes = {
159
- template: PropTypes.shape({
160
- display: PropTypes.string,
161
- icon: PropTypes.string,
162
- options: PropTypes.shape({
163
- from: PropTypes.shape({
164
- name: PropTypes.string,
165
- email: PropTypes.string,
166
- }),
167
- message: PropTypes.string,
168
- object: PropTypes.string,
169
- response_email: PropTypes.string,
170
- }),
171
- }).isRequired,
172
- onSubmit: PropTypes.func.isRequired,
173
- onToggle: PropTypes.func.isRequired,
174
- };
175
-
176
- export default EmailForm;
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
-
3
- import { AnErrorOccurred, CheckPagePermissions } from '@strapi/helper-plugin';
4
- import { Route, Switch } from 'react-router-dom';
5
-
6
- import { PERMISSIONS } from '../../constants';
7
-
8
- import { ProtectedRolesCreatePage } from './pages/CreatePage';
9
- import { ProtectedRolesEditPage } from './pages/EditPage';
10
- import { ProtectedRolesListPage } from './pages/ListPage';
11
-
12
- const Roles = () => {
13
- return (
14
- <CheckPagePermissions permissions={PERMISSIONS.accessRoles}>
15
- <Switch>
16
- <Route
17
- path="/settings/users-permissions/roles/new"
18
- component={ProtectedRolesCreatePage}
19
- exact
20
- />
21
- <Route
22
- path="/settings/users-permissions/roles/:id"
23
- component={ProtectedRolesEditPage}
24
- exact
25
- />
26
- <Route path="/settings/users-permissions/roles" component={ProtectedRolesListPage} exact />
27
- <Route path="" component={AnErrorOccurred} />
28
- </Switch>
29
- </CheckPagePermissions>
30
- );
31
- };
32
-
33
- export default Roles;
@@ -1,30 +0,0 @@
1
- import { getFetchClient } from '@strapi/helper-plugin';
2
-
3
- export const fetchData = async (toggleNotification, notifyStatus) => {
4
- try {
5
- const { get } = getFetchClient();
6
- const { data } = await get('/users-permissions/roles');
7
- notifyStatus('The roles have loaded successfully');
8
-
9
- return data;
10
- } catch (err) {
11
- toggleNotification({
12
- type: 'warning',
13
- message: { id: 'notification.error' },
14
- });
15
-
16
- throw new Error(err);
17
- }
18
- };
19
-
20
- export const deleteData = async (id, toggleNotification) => {
21
- try {
22
- const { del } = getFetchClient();
23
- await del(`/users-permissions/roles/${id}`);
24
- } catch (error) {
25
- toggleNotification({
26
- type: 'warning',
27
- message: { id: 'notification.error', defaultMessage: 'An error occured' },
28
- });
29
- }
30
- };
@@ -1,131 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = (baseURL) => ({
4
- email: {
5
- enabled: true,
6
- icon: 'envelope',
7
- },
8
- discord: {
9
- enabled: false,
10
- icon: 'discord',
11
- key: '',
12
- secret: '',
13
- callback: `${baseURL}/discord/callback`,
14
- scope: ['identify', 'email'],
15
- },
16
- facebook: {
17
- enabled: false,
18
- icon: 'facebook-square',
19
- key: '',
20
- secret: '',
21
- callback: `${baseURL}/facebook/callback`,
22
- scope: ['email'],
23
- },
24
- google: {
25
- enabled: false,
26
- icon: 'google',
27
- key: '',
28
- secret: '',
29
- callback: `${baseURL}/google/callback`,
30
- scope: ['email'],
31
- },
32
- github: {
33
- enabled: false,
34
- icon: 'github',
35
- key: '',
36
- secret: '',
37
- callback: `${baseURL}/github/callback`,
38
- scope: ['user', 'user:email'],
39
- },
40
- microsoft: {
41
- enabled: false,
42
- icon: 'windows',
43
- key: '',
44
- secret: '',
45
- callback: `${baseURL}/microsoft/callback`,
46
- scope: ['user.read'],
47
- },
48
- twitter: {
49
- enabled: false,
50
- icon: 'twitter',
51
- key: '',
52
- secret: '',
53
- callback: `${baseURL}/twitter/callback`,
54
- },
55
- instagram: {
56
- enabled: false,
57
- icon: 'instagram',
58
- key: '',
59
- secret: '',
60
- callback: `${baseURL}/instagram/callback`,
61
- scope: ['user_profile'],
62
- },
63
- vk: {
64
- enabled: false,
65
- icon: 'vk',
66
- key: '',
67
- secret: '',
68
- callback: `${baseURL}/vk/callback`,
69
- scope: ['email'],
70
- },
71
- twitch: {
72
- enabled: false,
73
- icon: 'twitch',
74
- key: '',
75
- secret: '',
76
- callback: `${baseURL}/twitch/callback`,
77
- scope: ['user:read:email'],
78
- },
79
- linkedin: {
80
- enabled: false,
81
- icon: 'linkedin',
82
- key: '',
83
- secret: '',
84
- callback: `${baseURL}/linkedin/callback`,
85
- scope: ['r_liteprofile', 'r_emailaddress'],
86
- },
87
- cognito: {
88
- enabled: false,
89
- icon: 'aws',
90
- key: '',
91
- secret: '',
92
- subdomain: 'my.subdomain.com',
93
- callback: `${baseURL}/cognito/callback`,
94
- scope: ['email', 'openid', 'profile'],
95
- },
96
- reddit: {
97
- enabled: false,
98
- icon: 'reddit',
99
- key: '',
100
- secret: '',
101
- state: true,
102
- callback: `${baseURL}/reddit/callback`,
103
- scope: ['identity'],
104
- },
105
- auth0: {
106
- enabled: false,
107
- icon: '',
108
- key: '',
109
- secret: '',
110
- subdomain: 'my-tenant.eu',
111
- callback: `${baseURL}/auth0/callback`,
112
- scope: ['openid', 'email', 'profile'],
113
- },
114
- cas: {
115
- enabled: false,
116
- icon: 'book',
117
- key: '',
118
- secret: '',
119
- callback: `${baseURL}/cas/callback`,
120
- scope: ['openid email'], // scopes should be space delimited
121
- subdomain: 'my.subdomain.com/cas',
122
- },
123
- patreon: {
124
- enabled: false,
125
- icon: '',
126
- key: '',
127
- secret: '',
128
- callback: `${baseURL}/patreon/callback`,
129
- scope: ['identity', 'identity[email]'],
130
- },
131
- });
package/strapi-server.js DELETED
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = require('./server');