@strapi/plugin-users-permissions 0.0.0-next.cb00a1799402728de4ecec6d52a815e33fcedaf3 → 0.0.0-next.ce84fada19d58a7dfbdd553035e6558f8befcba4

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 (246) hide show
  1. package/LICENSE +18 -3
  2. package/admin/src/components/BoundRoute/index.jsx +2 -2
  3. package/admin/src/components/FormModal/Input/index.jsx +32 -31
  4. package/admin/src/components/FormModal/index.jsx +57 -68
  5. package/admin/src/components/Permissions/PermissionRow/CheckboxWrapper.jsx +4 -3
  6. package/admin/src/components/Permissions/PermissionRow/SubCategory.jsx +13 -22
  7. package/admin/src/components/Permissions/index.jsx +27 -35
  8. package/admin/src/components/Permissions/reducer.js +1 -1
  9. package/admin/src/components/Policies/index.jsx +7 -5
  10. package/admin/src/components/UsersPermissions/index.jsx +15 -7
  11. package/admin/src/components/UsersPermissions/reducer.js +1 -1
  12. package/admin/src/index.js +15 -32
  13. package/admin/src/pages/AdvancedSettings/index.jsx +83 -128
  14. package/admin/src/pages/AdvancedSettings/utils/layout.js +20 -35
  15. package/admin/src/pages/AdvancedSettings/utils/schema.js +5 -2
  16. package/admin/src/pages/EmailTemplates/components/EmailForm.jsx +119 -139
  17. package/admin/src/pages/EmailTemplates/components/EmailTable.jsx +20 -17
  18. package/admin/src/pages/EmailTemplates/index.jsx +36 -62
  19. package/admin/src/pages/EmailTemplates/utils/schema.js +18 -6
  20. package/admin/src/pages/Providers/index.jsx +98 -113
  21. package/admin/src/pages/Providers/utils/forms.js +11 -11
  22. package/admin/src/pages/Roles/constants.js +3 -3
  23. package/admin/src/pages/Roles/hooks/usePlugins.js +4 -4
  24. package/admin/src/pages/Roles/index.jsx +9 -18
  25. package/admin/src/pages/Roles/pages/CreatePage.jsx +53 -58
  26. package/admin/src/pages/Roles/pages/EditPage.jsx +63 -68
  27. package/admin/src/pages/Roles/pages/ListPage/components/TableBody.jsx +27 -31
  28. package/admin/src/pages/Roles/pages/ListPage/index.jsx +81 -55
  29. package/admin/src/translations/en.json +1 -1
  30. package/admin/src/utils/prefixPluginTranslations.js +13 -0
  31. package/dist/_chunks/{ar-t5qTFaAD.js → ar-BguGUqwK.js} +1 -1
  32. package/dist/_chunks/ar-BguGUqwK.js.map +1 -0
  33. package/dist/_chunks/{ar-MvD8Ghac.mjs → ar-CK8BRRXB.mjs} +1 -1
  34. package/dist/_chunks/ar-CK8BRRXB.mjs.map +1 -0
  35. package/dist/_chunks/{cs-BMuXwxA1.mjs → cs-BVigMk0l.mjs} +1 -1
  36. package/dist/_chunks/cs-BVigMk0l.mjs.map +1 -0
  37. package/dist/_chunks/{cs-I8N4u-Sd.js → cs-BW8-K_GY.js} +1 -1
  38. package/dist/_chunks/cs-BW8-K_GY.js.map +1 -0
  39. package/dist/_chunks/{de-zs2qqc0W.mjs → de-BKUdRFI4.mjs} +1 -1
  40. package/dist/_chunks/de-BKUdRFI4.mjs.map +1 -0
  41. package/dist/_chunks/{de-YTjtq89K.js → de-owXpVluI.js} +1 -1
  42. package/dist/_chunks/de-owXpVluI.js.map +1 -0
  43. package/dist/_chunks/{dk-HctVBMsG.mjs → dk-BQiTK50l.mjs} +1 -1
  44. package/dist/_chunks/dk-BQiTK50l.mjs.map +1 -0
  45. package/dist/_chunks/{dk-TF-dWjzl.js → dk-LXAnbuBk.js} +1 -1
  46. package/dist/_chunks/dk-LXAnbuBk.js.map +1 -0
  47. package/dist/_chunks/{en-CE3wEy_c.mjs → en-DOHtPf-2.mjs} +2 -2
  48. package/dist/_chunks/en-DOHtPf-2.mjs.map +1 -0
  49. package/dist/_chunks/{en-m608rMZx.js → en-MHo5mcsU.js} +2 -2
  50. package/dist/_chunks/en-MHo5mcsU.js.map +1 -0
  51. package/dist/_chunks/{es-XBQsB8_9.js → es-BwLCLXAQ.js} +1 -1
  52. package/dist/_chunks/es-BwLCLXAQ.js.map +1 -0
  53. package/dist/_chunks/{es-9381tih_.mjs → es-DNgOVMjD.mjs} +1 -1
  54. package/dist/_chunks/es-DNgOVMjD.mjs.map +1 -0
  55. package/dist/_chunks/{fr-CMSc77If.mjs → fr-DkgRugiU.mjs} +1 -1
  56. package/dist/_chunks/fr-DkgRugiU.mjs.map +1 -0
  57. package/dist/_chunks/{fr-6cz3U-IF.js → fr-DkhpSjjm.js} +1 -1
  58. package/dist/_chunks/fr-DkhpSjjm.js.map +1 -0
  59. package/dist/_chunks/{id-RJ934rq-.js → id-BTemOeTZ.js} +1 -1
  60. package/dist/_chunks/id-BTemOeTZ.js.map +1 -0
  61. package/dist/_chunks/{id-SDuyIkZa.mjs → id-BdEsvnaF.mjs} +1 -1
  62. package/dist/_chunks/id-BdEsvnaF.mjs.map +1 -0
  63. package/dist/_chunks/{index-duDzoPIj.mjs → index-BOrMKeRw.mjs} +48 -49
  64. package/dist/_chunks/index-BOrMKeRw.mjs.map +1 -0
  65. package/dist/_chunks/{index-5NjYl5zP.js → index-Belq5KbY.js} +256 -274
  66. package/dist/_chunks/index-Belq5KbY.js.map +1 -0
  67. package/dist/_chunks/{index-KON9250R.mjs → index-Bz6iwjmq.mjs} +103 -103
  68. package/dist/_chunks/index-Bz6iwjmq.mjs.map +1 -0
  69. package/dist/_chunks/{index-ocoaOzEA.js → index-CD4fcjMf.js} +106 -106
  70. package/dist/_chunks/index-CD4fcjMf.js.map +1 -0
  71. package/dist/_chunks/index-CNonxjKA.js +281 -0
  72. package/dist/_chunks/index-CNonxjKA.js.map +1 -0
  73. package/dist/_chunks/index-CuNna9c6.mjs +262 -0
  74. package/dist/_chunks/index-CuNna9c6.mjs.map +1 -0
  75. package/dist/_chunks/index-D5NoyXgv.js +366 -0
  76. package/dist/_chunks/index-D5NoyXgv.js.map +1 -0
  77. package/dist/_chunks/{index-0mLL_8vR.js → index-DGJ3FzF4.js} +49 -50
  78. package/dist/_chunks/index-DGJ3FzF4.js.map +1 -0
  79. package/dist/_chunks/{index-IkWThHpX.mjs → index-DThn8eCU.mjs} +240 -256
  80. package/dist/_chunks/index-DThn8eCU.mjs.map +1 -0
  81. package/dist/_chunks/index-Dk2iD2AC.mjs +344 -0
  82. package/dist/_chunks/index-Dk2iD2AC.mjs.map +1 -0
  83. package/dist/_chunks/index-TfyEeDrd-BfJxOAzF.mjs +11845 -0
  84. package/dist/_chunks/index-TfyEeDrd-BfJxOAzF.mjs.map +1 -0
  85. package/dist/_chunks/index-TfyEeDrd-QiBdpWEj.js +11869 -0
  86. package/dist/_chunks/index-TfyEeDrd-QiBdpWEj.js.map +1 -0
  87. package/dist/_chunks/{it-bvH7DgQo.mjs → it-B-rv0E24.mjs} +1 -1
  88. package/dist/_chunks/it-B-rv0E24.mjs.map +1 -0
  89. package/dist/_chunks/{it-YhZOlM2X.js → it-D1rH6V6_.js} +1 -1
  90. package/dist/_chunks/it-D1rH6V6_.js.map +1 -0
  91. package/dist/_chunks/{ja-o_-JPvQv.mjs → ja-C8K-VBPD.mjs} +1 -1
  92. package/dist/_chunks/ja-C8K-VBPD.mjs.map +1 -0
  93. package/dist/_chunks/{ja-xssHUXFv.js → ja-DqShgTMf.js} +1 -1
  94. package/dist/_chunks/ja-DqShgTMf.js.map +1 -0
  95. package/dist/_chunks/{ko-C3mHUSJa.js → ko-B9DGEPWH.js} +1 -1
  96. package/dist/_chunks/ko-B9DGEPWH.js.map +1 -0
  97. package/dist/_chunks/{ko-XJbPSez_.mjs → ko-Busb0wIY.mjs} +1 -1
  98. package/dist/_chunks/ko-Busb0wIY.mjs.map +1 -0
  99. package/dist/_chunks/{ms-II5Ea73J.mjs → ms-ByvsQjRt.mjs} +1 -1
  100. package/dist/_chunks/ms-ByvsQjRt.mjs.map +1 -0
  101. package/dist/_chunks/{ms-d0hfg65Z.js → ms-CPBU3LWf.js} +1 -1
  102. package/dist/_chunks/ms-CPBU3LWf.js.map +1 -0
  103. package/dist/_chunks/{nl-vEy6TN0K.mjs → nl-5qO8Rpcy.mjs} +1 -1
  104. package/dist/_chunks/nl-5qO8Rpcy.mjs.map +1 -0
  105. package/dist/_chunks/{nl-TA7TfK_5.js → nl-CwNB6YoO.js} +1 -1
  106. package/dist/_chunks/nl-CwNB6YoO.js.map +1 -0
  107. package/dist/_chunks/{pl-2VowaFGt.mjs → pl-BdIzifBE.mjs} +1 -1
  108. package/dist/_chunks/pl-BdIzifBE.mjs.map +1 -0
  109. package/dist/_chunks/{pl-0pUL9hdA.js → pl-Do9UD69f.js} +1 -1
  110. package/dist/_chunks/pl-Do9UD69f.js.map +1 -0
  111. package/dist/_chunks/{pt-Rf9W51IO.mjs → pt-BIO24ioG.mjs} +1 -1
  112. package/dist/_chunks/pt-BIO24ioG.mjs.map +1 -0
  113. package/dist/_chunks/{pt-BR-WNOhafR4.js → pt-BR-D7dZhxuP.js} +1 -1
  114. package/dist/_chunks/pt-BR-D7dZhxuP.js.map +1 -0
  115. package/dist/_chunks/{pt-BR-sS1Xp3Jt.mjs → pt-BR-f0p23AQZ.mjs} +1 -1
  116. package/dist/_chunks/pt-BR-f0p23AQZ.mjs.map +1 -0
  117. package/dist/_chunks/{pt-guNR9Gax.js → pt-fdvyOnUp.js} +1 -1
  118. package/dist/_chunks/pt-fdvyOnUp.js.map +1 -0
  119. package/dist/_chunks/{ru-X3BMXDds.js → ru-C94rjPGA.js} +1 -1
  120. package/dist/_chunks/ru-C94rjPGA.js.map +1 -0
  121. package/dist/_chunks/{ru-qKHnd5or.mjs → ru-VWy-IB7K.mjs} +1 -1
  122. package/dist/_chunks/ru-VWy-IB7K.mjs.map +1 -0
  123. package/dist/_chunks/{sk-NWPw1oTN.js → sk-BABEhykl.js} +1 -1
  124. package/dist/_chunks/sk-BABEhykl.js.map +1 -0
  125. package/dist/_chunks/{sk-_Ryr-eTT.mjs → sk-B_LIcepm.mjs} +1 -1
  126. package/dist/_chunks/sk-B_LIcepm.mjs.map +1 -0
  127. package/dist/_chunks/{sv-BqzScFXS.mjs → sv-ABLKOokl.mjs} +1 -1
  128. package/dist/_chunks/sv-ABLKOokl.mjs.map +1 -0
  129. package/dist/_chunks/{sv-76NnbB__.js → sv-Be43LhA9.js} +1 -1
  130. package/dist/_chunks/sv-Be43LhA9.js.map +1 -0
  131. package/dist/_chunks/{th-WsknMEpq.mjs → th-DKyP7ueR.mjs} +1 -1
  132. package/dist/_chunks/th-DKyP7ueR.mjs.map +1 -0
  133. package/dist/_chunks/{th-cbppX21D.js → th-DgVhVLhL.js} +1 -1
  134. package/dist/_chunks/th-DgVhVLhL.js.map +1 -0
  135. package/dist/_chunks/{tr-6mm_Fmz7.js → tr-B_idhkEs.js} +1 -1
  136. package/dist/_chunks/tr-B_idhkEs.js.map +1 -0
  137. package/dist/_chunks/{tr-_DB1F1GW.mjs → tr-qa1Q5UjC.mjs} +1 -1
  138. package/dist/_chunks/tr-qa1Q5UjC.mjs.map +1 -0
  139. package/dist/_chunks/{uk-yxMSQAwI.mjs → uk-BmRqbeQc.mjs} +1 -1
  140. package/dist/_chunks/uk-BmRqbeQc.mjs.map +1 -0
  141. package/dist/_chunks/{uk-sI2I1ogF.js → uk-LHOivnhP.js} +1 -1
  142. package/dist/_chunks/uk-LHOivnhP.js.map +1 -0
  143. package/dist/_chunks/{vi-A3zJxaiI.js → vi-CdVRdKDw.js} +1 -1
  144. package/dist/_chunks/vi-CdVRdKDw.js.map +1 -0
  145. package/dist/_chunks/{vi-xY0zCW3d.mjs → vi-HW-EdMea.mjs} +1 -1
  146. package/dist/_chunks/vi-HW-EdMea.mjs.map +1 -0
  147. package/dist/_chunks/{zh-OFeldzbX.mjs → zh-5hKkVPA4.mjs} +1 -1
  148. package/dist/_chunks/zh-5hKkVPA4.mjs.map +1 -0
  149. package/dist/_chunks/{zh-72SpmFXa.js → zh-Cuq8gMnF.js} +1 -1
  150. package/dist/_chunks/zh-Cuq8gMnF.js.map +1 -0
  151. package/dist/_chunks/{zh-Hans-E84cu4kP.mjs → zh-Hans-BHilK-yc.mjs} +1 -1
  152. package/dist/_chunks/zh-Hans-BHilK-yc.mjs.map +1 -0
  153. package/dist/_chunks/{zh-Hans-ArWWtyP4.js → zh-Hans-GQDMKtY4.js} +1 -1
  154. package/dist/_chunks/zh-Hans-GQDMKtY4.js.map +1 -0
  155. package/dist/admin/index.js +1 -2
  156. package/dist/admin/index.js.map +1 -1
  157. package/dist/admin/index.mjs +1 -2
  158. package/dist/admin/index.mjs.map +1 -1
  159. package/package.json +26 -27
  160. package/server/bootstrap/index.js +18 -51
  161. package/server/bootstrap/users-permissions-actions.js +6 -0
  162. package/server/config.js +29 -0
  163. package/server/content-types/user/index.js +0 -1
  164. package/server/controllers/auth.js +48 -59
  165. package/server/controllers/content-manager-user.js +28 -30
  166. package/server/controllers/role.js +1 -1
  167. package/server/controllers/user.js +8 -9
  168. package/server/middlewares/rateLimit.js +1 -1
  169. package/server/register.js +1 -1
  170. package/server/services/jwt.js +3 -3
  171. package/server/services/permission.js +3 -7
  172. package/server/services/providers-registry.js +468 -275
  173. package/server/services/providers.js +10 -5
  174. package/server/services/role.js +15 -13
  175. package/server/services/user.js +56 -19
  176. package/server/services/users-permissions.js +15 -13
  177. package/server/utils/index.d.ts +2 -1
  178. package/server/utils/sanitize/sanitizers.js +7 -3
  179. package/server/utils/sanitize/visitors/remove-user-relation-from-role-entities.js +2 -2
  180. package/admin/src/pages/Roles/pages/ListPage/utils/api.js +0 -30
  181. package/dist/_chunks/ar-MvD8Ghac.mjs.map +0 -1
  182. package/dist/_chunks/ar-t5qTFaAD.js.map +0 -1
  183. package/dist/_chunks/cs-BMuXwxA1.mjs.map +0 -1
  184. package/dist/_chunks/cs-I8N4u-Sd.js.map +0 -1
  185. package/dist/_chunks/de-YTjtq89K.js.map +0 -1
  186. package/dist/_chunks/de-zs2qqc0W.mjs.map +0 -1
  187. package/dist/_chunks/dk-HctVBMsG.mjs.map +0 -1
  188. package/dist/_chunks/dk-TF-dWjzl.js.map +0 -1
  189. package/dist/_chunks/en-CE3wEy_c.mjs.map +0 -1
  190. package/dist/_chunks/en-m608rMZx.js.map +0 -1
  191. package/dist/_chunks/es-9381tih_.mjs.map +0 -1
  192. package/dist/_chunks/es-XBQsB8_9.js.map +0 -1
  193. package/dist/_chunks/fr-6cz3U-IF.js.map +0 -1
  194. package/dist/_chunks/fr-CMSc77If.mjs.map +0 -1
  195. package/dist/_chunks/id-RJ934rq-.js.map +0 -1
  196. package/dist/_chunks/id-SDuyIkZa.mjs.map +0 -1
  197. package/dist/_chunks/index-0mLL_8vR.js.map +0 -1
  198. package/dist/_chunks/index-5NjYl5zP.js.map +0 -1
  199. package/dist/_chunks/index-IkWThHpX.mjs.map +0 -1
  200. package/dist/_chunks/index-KON9250R.mjs.map +0 -1
  201. package/dist/_chunks/index-Pf0THMXE.js +0 -407
  202. package/dist/_chunks/index-Pf0THMXE.js.map +0 -1
  203. package/dist/_chunks/index-cDoSHOCB.mjs +0 -385
  204. package/dist/_chunks/index-cDoSHOCB.mjs.map +0 -1
  205. package/dist/_chunks/index-duDzoPIj.mjs.map +0 -1
  206. package/dist/_chunks/index-n3_BB2IX.js +0 -320
  207. package/dist/_chunks/index-n3_BB2IX.js.map +0 -1
  208. package/dist/_chunks/index-ocoaOzEA.js.map +0 -1
  209. package/dist/_chunks/index-r2sL6daw.mjs +0 -301
  210. package/dist/_chunks/index-r2sL6daw.mjs.map +0 -1
  211. package/dist/_chunks/it-YhZOlM2X.js.map +0 -1
  212. package/dist/_chunks/it-bvH7DgQo.mjs.map +0 -1
  213. package/dist/_chunks/ja-o_-JPvQv.mjs.map +0 -1
  214. package/dist/_chunks/ja-xssHUXFv.js.map +0 -1
  215. package/dist/_chunks/ko-C3mHUSJa.js.map +0 -1
  216. package/dist/_chunks/ko-XJbPSez_.mjs.map +0 -1
  217. package/dist/_chunks/ms-II5Ea73J.mjs.map +0 -1
  218. package/dist/_chunks/ms-d0hfg65Z.js.map +0 -1
  219. package/dist/_chunks/nl-TA7TfK_5.js.map +0 -1
  220. package/dist/_chunks/nl-vEy6TN0K.mjs.map +0 -1
  221. package/dist/_chunks/pl-0pUL9hdA.js.map +0 -1
  222. package/dist/_chunks/pl-2VowaFGt.mjs.map +0 -1
  223. package/dist/_chunks/pt-BR-WNOhafR4.js.map +0 -1
  224. package/dist/_chunks/pt-BR-sS1Xp3Jt.mjs.map +0 -1
  225. package/dist/_chunks/pt-Rf9W51IO.mjs.map +0 -1
  226. package/dist/_chunks/pt-guNR9Gax.js.map +0 -1
  227. package/dist/_chunks/ru-X3BMXDds.js.map +0 -1
  228. package/dist/_chunks/ru-qKHnd5or.mjs.map +0 -1
  229. package/dist/_chunks/sk-NWPw1oTN.js.map +0 -1
  230. package/dist/_chunks/sk-_Ryr-eTT.mjs.map +0 -1
  231. package/dist/_chunks/sv-76NnbB__.js.map +0 -1
  232. package/dist/_chunks/sv-BqzScFXS.mjs.map +0 -1
  233. package/dist/_chunks/th-WsknMEpq.mjs.map +0 -1
  234. package/dist/_chunks/th-cbppX21D.js.map +0 -1
  235. package/dist/_chunks/tr-6mm_Fmz7.js.map +0 -1
  236. package/dist/_chunks/tr-_DB1F1GW.mjs.map +0 -1
  237. package/dist/_chunks/uk-sI2I1ogF.js.map +0 -1
  238. package/dist/_chunks/uk-yxMSQAwI.mjs.map +0 -1
  239. package/dist/_chunks/vi-A3zJxaiI.js.map +0 -1
  240. package/dist/_chunks/vi-xY0zCW3d.mjs.map +0 -1
  241. package/dist/_chunks/zh-72SpmFXa.js.map +0 -1
  242. package/dist/_chunks/zh-Hans-ArWWtyP4.js.map +0 -1
  243. package/dist/_chunks/zh-Hans-E84cu4kP.mjs.map +0 -1
  244. package/dist/_chunks/zh-OFeldzbX.mjs.map +0 -1
  245. package/server/bootstrap/grant-config.js +0 -140
  246. package/strapi-server.js +0 -3
@@ -1,11 +1,8 @@
1
1
  import * as React from 'react';
2
2
 
3
+ import { useTracking, Layouts } from '@strapi/admin/strapi-admin';
3
4
  import {
4
- ContentLayout,
5
- HeaderLayout,
6
5
  IconButton,
7
- Layout,
8
- Main,
9
6
  Table,
10
7
  Tbody,
11
8
  Td,
@@ -14,23 +11,16 @@ import {
14
11
  Tr,
15
12
  Typography,
16
13
  VisuallyHidden,
14
+ useCollator,
17
15
  } from '@strapi/design-system';
16
+ import { Pencil } from '@strapi/icons';
18
17
  import {
19
- CheckPagePermissions,
20
- LoadingIndicatorPage,
21
- onRowClick,
22
- SettingsPageTitle,
23
- stopPropagation,
18
+ Page,
24
19
  useAPIErrorHandler,
25
- useCollator,
26
- useFetchClient,
27
- useFocusWhenNavigate,
28
20
  useNotification,
29
- useOverlayBlocker,
21
+ useFetchClient,
30
22
  useRBAC,
31
- useTracking,
32
- } from '@strapi/helper-plugin';
33
- import { Pencil } from '@strapi/icons';
23
+ } from '@strapi/strapi/admin';
34
24
  import upperFirst from 'lodash/upperFirst';
35
25
  import { useIntl } from 'react-intl';
36
26
  import { useMutation, useQuery, useQueryClient } from 'react-query';
@@ -47,16 +37,13 @@ export const ProvidersPage = () => {
47
37
  const { trackUsage } = useTracking();
48
38
  const [isOpen, setIsOpen] = React.useState(false);
49
39
  const [providerToEditName, setProviderToEditName] = React.useState(null);
50
- const toggleNotification = useNotification();
51
- const { lockApp, unlockApp } = useOverlayBlocker();
40
+ const { toggleNotification } = useNotification();
52
41
  const { get, put } = useFetchClient();
53
42
  const { formatAPIError } = useAPIErrorHandler();
54
43
  const formatter = useCollator(locale, {
55
44
  sensitivity: 'base',
56
45
  });
57
46
 
58
- useFocusWhenNavigate();
59
-
60
47
  const {
61
48
  isLoading: isLoadingPermissions,
62
49
  allowedActions: { canUpdate },
@@ -76,25 +63,22 @@ export const ProvidersPage = () => {
76
63
 
77
64
  const submitMutation = useMutation((body) => put('/users-permissions/providers', body), {
78
65
  async onSuccess() {
79
- await queryClient.invalidateQueries(['users-permissions', 'providers']);
66
+ await queryClient.invalidateQueries(['users-permissions', 'get-providers']);
80
67
 
81
68
  toggleNotification({
82
69
  type: 'success',
83
- message: { id: getTrad('notification.success.submit') },
70
+ message: formatMessage({ id: getTrad('notification.success.submit') }),
84
71
  });
85
72
 
86
73
  trackUsage('didEditAuthenticationProvider');
87
74
 
88
75
  handleToggleModal();
89
- unlockApp();
90
76
  },
91
77
  onError(error) {
92
78
  toggleNotification({
93
- type: 'warning',
79
+ type: 'danger',
94
80
  message: formatAPIError(error),
95
81
  });
96
-
97
- unlockApp();
98
82
  },
99
83
  refetchActive: false,
100
84
  });
@@ -150,104 +134,105 @@ export const ProvidersPage = () => {
150
134
  };
151
135
 
152
136
  const handleSubmit = async (values) => {
153
- lockApp();
154
-
155
137
  trackUsage('willEditAuthenticationProvider');
156
138
 
157
139
  submitMutation.mutate({ providers: { ...data, [providerToEditName]: values } });
158
140
  };
159
141
 
142
+ if (isLoading) {
143
+ return <Page.Loading />;
144
+ }
145
+
160
146
  return (
161
- <Layout>
162
- <SettingsPageTitle
163
- name={formatMessage({
164
- id: getTrad('HeaderNav.link.providers'),
165
- defaultMessage: 'Providers',
166
- })}
167
- />
168
- <Main>
169
- <HeaderLayout
147
+ <Layouts.Root>
148
+ <Page.Title>
149
+ {formatMessage(
150
+ { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },
151
+ {
152
+ name: formatMessage({
153
+ id: getTrad('HeaderNav.link.providers'),
154
+ defaultMessage: 'Providers',
155
+ }),
156
+ }
157
+ )}
158
+ </Page.Title>
159
+ <Page.Main>
160
+ <Layouts.Header
170
161
  title={formatMessage({
171
162
  id: getTrad('HeaderNav.link.providers'),
172
163
  defaultMessage: 'Providers',
173
164
  })}
174
165
  />
175
- {isLoading ? (
176
- <LoadingIndicatorPage />
177
- ) : (
178
- <ContentLayout>
179
- <Table colCount={3} rowCount={providers.length + 1}>
180
- <Thead>
181
- <Tr>
182
- <Th>
183
- <Typography variant="sigma" textColor="neutral600">
184
- {formatMessage({ id: 'global.name', defaultMessage: 'Name' })}
166
+ <Layouts.Content>
167
+ <Table colCount={3} rowCount={providers.length + 1}>
168
+ <Thead>
169
+ <Tr>
170
+ <Th>
171
+ <Typography variant="sigma" textColor="neutral600">
172
+ {formatMessage({ id: 'global.name', defaultMessage: 'Name' })}
173
+ </Typography>
174
+ </Th>
175
+ <Th>
176
+ <Typography variant="sigma" textColor="neutral600">
177
+ {formatMessage({ id: getTrad('Providers.status'), defaultMessage: 'Status' })}
178
+ </Typography>
179
+ </Th>
180
+ <Th>
181
+ <Typography variant="sigma">
182
+ <VisuallyHidden>
183
+ {formatMessage({
184
+ id: 'global.settings',
185
+ defaultMessage: 'Settings',
186
+ })}
187
+ </VisuallyHidden>
188
+ </Typography>
189
+ </Th>
190
+ </Tr>
191
+ </Thead>
192
+ <Tbody>
193
+ {providers.map((provider) => (
194
+ <Tr
195
+ key={provider.name}
196
+ onClick={() => (canUpdate ? handleClickEdit(provider) : undefined)}
197
+ >
198
+ <Td width="45%">
199
+ <Typography fontWeight="semiBold" textColor="neutral800">
200
+ {provider.name}
185
201
  </Typography>
186
- </Th>
187
- <Th>
188
- <Typography variant="sigma" textColor="neutral600">
189
- {formatMessage({ id: getTrad('Providers.status'), defaultMessage: 'Status' })}
202
+ </Td>
203
+ <Td width="65%">
204
+ <Typography
205
+ textColor={provider.enabled ? 'success600' : 'danger600'}
206
+ data-testid={`enable-${provider.name}`}
207
+ >
208
+ {provider.enabled
209
+ ? formatMessage({
210
+ id: 'global.enabled',
211
+ defaultMessage: 'Enabled',
212
+ })
213
+ : formatMessage({
214
+ id: 'global.disabled',
215
+ defaultMessage: 'Disabled',
216
+ })}
190
217
  </Typography>
191
- </Th>
192
- <Th>
193
- <Typography variant="sigma">
194
- <VisuallyHidden>
195
- {formatMessage({
196
- id: 'global.settings',
197
- defaultMessage: 'Settings',
198
- })}
199
- </VisuallyHidden>
200
- </Typography>
201
- </Th>
202
- </Tr>
203
- </Thead>
204
- <Tbody>
205
- {providers.map((provider) => (
206
- <Tr
207
- key={provider.name}
208
- {...onRowClick({
209
- fn: () => handleClickEdit(provider),
210
- condition: canUpdate,
211
- })}
212
- >
213
- <Td width="45%">
214
- <Typography fontWeight="semiBold" textColor="neutral800">
215
- {provider.name}
216
- </Typography>
217
- </Td>
218
- <Td width="65%">
219
- <Typography
220
- textColor={provider.enabled ? 'success600' : 'danger600'}
221
- data-testid={`enable-${provider.name}`}
218
+ </Td>
219
+ <Td onClick={(e) => e.stopPropagation()}>
220
+ {canUpdate && (
221
+ <IconButton
222
+ onClick={() => handleClickEdit(provider)}
223
+ variant="ghost"
224
+ label="Edit"
222
225
  >
223
- {provider.enabled
224
- ? formatMessage({
225
- id: 'global.enabled',
226
- defaultMessage: 'Enabled',
227
- })
228
- : formatMessage({
229
- id: 'global.disabled',
230
- defaultMessage: 'Disabled',
231
- })}
232
- </Typography>
233
- </Td>
234
- <Td {...stopPropagation}>
235
- {canUpdate && (
236
- <IconButton
237
- onClick={() => handleClickEdit(provider)}
238
- noBorder
239
- icon={<Pencil />}
240
- label="Edit"
241
- />
242
- )}
243
- </Td>
244
- </Tr>
245
- ))}
246
- </Tbody>
247
- </Table>
248
- </ContentLayout>
249
- )}
250
- </Main>
226
+ <Pencil />
227
+ </IconButton>
228
+ )}
229
+ </Td>
230
+ </Tr>
231
+ ))}
232
+ </Tbody>
233
+ </Table>
234
+ </Layouts.Content>
235
+ </Page.Main>
251
236
  <FormModal
252
237
  initialData={data[providerToEditName]}
253
238
  isOpen={isOpen}
@@ -264,14 +249,14 @@ export const ProvidersPage = () => {
264
249
  onSubmit={handleSubmit}
265
250
  providerToEditName={providerToEditName}
266
251
  />
267
- </Layout>
252
+ </Layouts.Root>
268
253
  );
269
254
  };
270
255
 
271
256
  const ProtectedProvidersPage = () => (
272
- <CheckPagePermissions permissions={PERMISSIONS.readProviders}>
257
+ <Page.Protect permissions={PERMISSIONS.readProviders}>
273
258
  <ProvidersPage />
274
- </CheckPagePermissions>
259
+ </Page.Protect>
275
260
  );
276
261
 
277
262
  export default ProtectedProvidersPage;
@@ -1,4 +1,4 @@
1
- import { translatedErrors } from '@strapi/helper-plugin';
1
+ import { translatedErrors } from '@strapi/strapi/admin';
2
2
  import * as yup from 'yup';
3
3
 
4
4
  import { getTrad } from '../../../utils';
@@ -52,7 +52,7 @@ const forms = {
52
52
  ],
53
53
  ],
54
54
  schema: yup.object().shape({
55
- enabled: yup.bool().required(translatedErrors.required),
55
+ enabled: yup.bool().required(translatedErrors.required.id),
56
56
  }),
57
57
  },
58
58
  providers: {
@@ -117,20 +117,20 @@ const forms = {
117
117
  ],
118
118
  ],
119
119
  schema: yup.object().shape({
120
- enabled: yup.bool().required(translatedErrors.required),
120
+ enabled: yup.bool().required(translatedErrors.required.id),
121
121
  key: yup.string().when('enabled', {
122
122
  is: true,
123
- then: yup.string().required(translatedErrors.required),
123
+ then: yup.string().required(translatedErrors.required.id),
124
124
  otherwise: yup.string(),
125
125
  }),
126
126
  secret: yup.string().when('enabled', {
127
127
  is: true,
128
- then: yup.string().required(translatedErrors.required),
128
+ then: yup.string().required(translatedErrors.required.id),
129
129
  otherwise: yup.string(),
130
130
  }),
131
131
  callback: yup.string().when('enabled', {
132
132
  is: true,
133
- then: yup.string().required(translatedErrors.required),
133
+ then: yup.string().required(translatedErrors.required.id),
134
134
  otherwise: yup.string(),
135
135
  }),
136
136
  }),
@@ -231,25 +231,25 @@ const forms = {
231
231
  ],
232
232
  ],
233
233
  schema: yup.object().shape({
234
- enabled: yup.bool().required(translatedErrors.required),
234
+ enabled: yup.bool().required(translatedErrors.required.id),
235
235
  key: yup.string().when('enabled', {
236
236
  is: true,
237
- then: yup.string().required(translatedErrors.required),
237
+ then: yup.string().required(translatedErrors.required.id),
238
238
  otherwise: yup.string(),
239
239
  }),
240
240
  secret: yup.string().when('enabled', {
241
241
  is: true,
242
- then: yup.string().required(translatedErrors.required),
242
+ then: yup.string().required(translatedErrors.required.id),
243
243
  otherwise: yup.string(),
244
244
  }),
245
245
  subdomain: yup.string().when('enabled', {
246
246
  is: true,
247
- then: yup.string().required(translatedErrors.required),
247
+ then: yup.string().required(translatedErrors.required.id),
248
248
  otherwise: yup.string(),
249
249
  }),
250
250
  callback: yup.string().when('enabled', {
251
251
  is: true,
252
- then: yup.string().required(translatedErrors.required),
252
+ then: yup.string().required(translatedErrors.required.id),
253
253
  otherwise: yup.string(),
254
254
  }),
255
255
  }),
@@ -1,7 +1,7 @@
1
- import { translatedErrors } from '@strapi/helper-plugin';
1
+ import { translatedErrors } from '@strapi/strapi/admin';
2
2
  import * as yup from 'yup';
3
3
 
4
4
  export const createRoleSchema = yup.object().shape({
5
- name: yup.string().required(translatedErrors.required),
6
- description: yup.string().required(translatedErrors.required),
5
+ name: yup.string().required(translatedErrors.required.id),
6
+ description: yup.string().required(translatedErrors.required.id),
7
7
  });
@@ -1,12 +1,12 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
- import { useNotification, useFetchClient, useAPIErrorHandler } from '@strapi/helper-plugin';
3
+ import { useAPIErrorHandler, useNotification, useFetchClient } from '@strapi/strapi/admin';
4
4
  import { useQueries } from 'react-query';
5
5
 
6
6
  import { cleanPermissions, getTrad } from '../../../utils';
7
7
 
8
8
  export const usePlugins = () => {
9
- const toggleNotification = useNotification();
9
+ const { toggleNotification } = useNotification();
10
10
  const { get } = useFetchClient();
11
11
  const { formatAPIError } = useAPIErrorHandler(getTrad);
12
12
 
@@ -48,7 +48,7 @@ export const usePlugins = () => {
48
48
  useEffect(() => {
49
49
  if (permissionsError) {
50
50
  toggleNotification({
51
- type: 'warning',
51
+ type: 'danger',
52
52
  message: formatAPIError(permissionsError),
53
53
  });
54
54
  }
@@ -57,7 +57,7 @@ export const usePlugins = () => {
57
57
  useEffect(() => {
58
58
  if (routesError) {
59
59
  toggleNotification({
60
- type: 'warning',
60
+ type: 'danger',
61
61
  message: formatAPIError(routesError),
62
62
  });
63
63
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
- import { AnErrorOccurred, CheckPagePermissions } from '@strapi/helper-plugin';
4
- import { Route, Switch } from 'react-router-dom';
3
+ import { Page } from '@strapi/strapi/admin';
4
+ import { Route, Routes } from 'react-router-dom';
5
5
 
6
6
  import { PERMISSIONS } from '../../constants';
7
7
 
@@ -11,22 +11,13 @@ import { ProtectedRolesListPage } from './pages/ListPage';
11
11
 
12
12
  const Roles = () => {
13
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>
14
+ <Page.Protect permissions={PERMISSIONS.accessRoles}>
15
+ <Routes>
16
+ <Route index element={<ProtectedRolesListPage />} />
17
+ <Route path="new" element={<ProtectedRolesCreatePage />} />
18
+ <Route path=":id" element={<ProtectedRolesEditPage />} />
19
+ </Routes>
20
+ </Page.Protect>
30
21
  );
31
22
  };
32
23
 
@@ -2,30 +2,20 @@ import * as React from 'react';
2
2
 
3
3
  import {
4
4
  Button,
5
- ContentLayout,
6
5
  Flex,
7
6
  Grid,
8
- GridItem,
9
- HeaderLayout,
10
7
  Main,
11
8
  Textarea,
12
9
  TextInput,
13
10
  Typography,
11
+ Field,
14
12
  } from '@strapi/design-system';
15
- import {
16
- CheckPagePermissions,
17
- Form,
18
- SettingsPageTitle,
19
- useFetchClient,
20
- useNotification,
21
- useOverlayBlocker,
22
- useTracking,
23
- } from '@strapi/helper-plugin';
24
13
  import { Check } from '@strapi/icons';
25
- import { Formik } from 'formik';
14
+ import { Page, useTracking, useNotification, useFetchClient, Layouts } from '@strapi/strapi/admin';
15
+ import { Formik, Form } from 'formik';
26
16
  import { useIntl } from 'react-intl';
27
17
  import { useMutation } from 'react-query';
28
- import { useHistory } from 'react-router-dom';
18
+ import { useNavigate } from 'react-router-dom';
29
19
 
30
20
  import UsersPermissions from '../../../components/UsersPermissions';
31
21
  import { PERMISSIONS } from '../../../constants';
@@ -35,9 +25,8 @@ import { usePlugins } from '../hooks/usePlugins';
35
25
 
36
26
  export const CreatePage = () => {
37
27
  const { formatMessage } = useIntl();
38
- const toggleNotification = useNotification();
39
- const { goBack } = useHistory();
40
- const { lockApp, unlockApp } = useOverlayBlocker();
28
+ const { toggleNotification } = useNotification();
29
+ const navigate = useNavigate();
41
30
  const { isLoading: isLoadingPlugins, permissions, routes } = usePlugins();
42
31
  const { trackUsage } = useTracking();
43
32
  const permissionsRef = React.useRef();
@@ -45,11 +34,11 @@ export const CreatePage = () => {
45
34
  const mutation = useMutation((body) => post(`/users-permissions/roles`, body), {
46
35
  onError() {
47
36
  toggleNotification({
48
- type: 'warning',
49
- message: {
37
+ type: 'danger',
38
+ message: formatMessage({
50
39
  id: 'notification.error',
51
40
  defaultMessage: 'An error occurred',
52
- },
41
+ }),
53
42
  });
54
43
  },
55
44
 
@@ -58,34 +47,34 @@ export const CreatePage = () => {
58
47
 
59
48
  toggleNotification({
60
49
  type: 'success',
61
- message: {
50
+ message: formatMessage({
62
51
  id: getTrad('Settings.roles.created'),
63
52
  defaultMessage: 'Role created',
64
- },
53
+ }),
65
54
  });
66
55
 
67
56
  // Forcing redirecting since we don't have the id in the response
68
- goBack();
57
+ navigate(-1);
69
58
  },
70
59
  });
71
60
 
72
61
  const handleCreateRoleSubmit = async (data) => {
73
- lockApp();
74
-
75
62
  // TODO: refactor. Child -> parent component communication is evil;
76
63
  // We should either move the provider one level up or move the state
77
64
  // straight into redux.
78
65
  const permissions = permissionsRef.current.getPermissions();
79
66
 
80
67
  await mutation.mutate({ ...data, ...permissions, users: [] });
81
-
82
- unlockApp();
83
68
  };
84
69
 
85
70
  return (
86
71
  <Main>
87
- {/* TODO: This needs to be translated */}
88
- <SettingsPageTitle name="Roles" />
72
+ <Page.Title>
73
+ {formatMessage(
74
+ { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },
75
+ { name: 'Roles' }
76
+ )}
77
+ </Page.Title>
89
78
  <Formik
90
79
  enableReinitialize
91
80
  initialValues={{ name: '', description: '' }}
@@ -94,7 +83,7 @@ export const CreatePage = () => {
94
83
  >
95
84
  {({ handleSubmit, values, handleChange, errors }) => (
96
85
  <Form noValidate onSubmit={handleSubmit}>
97
- <HeaderLayout
86
+ <Layouts.Header
98
87
  primaryAction={
99
88
  !isLoadingPlugins && (
100
89
  <Button type="submit" loading={mutation.isLoading} startIcon={<Check />}>
@@ -114,7 +103,7 @@ export const CreatePage = () => {
114
103
  defaultMessage: 'Define the rights given to the role',
115
104
  })}
116
105
  />
117
- <ContentLayout>
106
+ <Layouts.Content>
118
107
  <Flex
119
108
  background="neutral0"
120
109
  direction="column"
@@ -128,40 +117,37 @@ export const CreatePage = () => {
128
117
  shadow="filterShadow"
129
118
  >
130
119
  <Flex direction="column" alignItems="stretch">
131
- <Typography variant="delta" as="h2">
120
+ <Typography variant="delta" tag="h2">
132
121
  {formatMessage({
133
122
  id: getTrad('EditPage.form.roles'),
134
123
  defaultMessage: 'Role details',
135
124
  })}
136
125
  </Typography>
137
126
 
138
- <Grid gap={4}>
139
- <GridItem col={6}>
140
- <TextInput
127
+ <Grid.Root gap={4}>
128
+ <Grid.Item col={6} direction="column" alignItems="stretch">
129
+ <Field.Root
141
130
  name="name"
142
- value={values.name || ''}
143
- onChange={handleChange}
144
- label={formatMessage({
145
- id: 'global.name',
146
- defaultMessage: 'Name',
147
- })}
148
131
  error={
149
132
  errors?.name
150
133
  ? formatMessage({ id: errors.name, defaultMessage: 'Name is required' })
151
134
  : false
152
135
  }
153
136
  required
154
- />
155
- </GridItem>
156
- <GridItem col={6}>
157
- <Textarea
158
- id="description"
159
- value={values.description || ''}
160
- onChange={handleChange}
161
- label={formatMessage({
162
- id: 'global.description',
163
- defaultMessage: 'Description',
164
- })}
137
+ >
138
+ <Field.Label>
139
+ {formatMessage({
140
+ id: 'global.name',
141
+ defaultMessage: 'Name',
142
+ })}
143
+ </Field.Label>
144
+ <TextInput value={values.name || ''} onChange={handleChange} />
145
+ <Field.Error />
146
+ </Field.Root>
147
+ </Grid.Item>
148
+ <Grid.Item col={6} direction="column" alignItems="stretch">
149
+ <Field.Root
150
+ name="description"
165
151
  error={
166
152
  errors?.description
167
153
  ? formatMessage({
@@ -171,9 +157,18 @@ export const CreatePage = () => {
171
157
  : false
172
158
  }
173
159
  required
174
- />
175
- </GridItem>
176
- </Grid>
160
+ >
161
+ <Field.Label>
162
+ {formatMessage({
163
+ id: 'global.description',
164
+ defaultMessage: 'Description',
165
+ })}
166
+ </Field.Label>
167
+ <Textarea value={values.description || ''} onChange={handleChange} />
168
+ <Field.Error />
169
+ </Field.Root>
170
+ </Grid.Item>
171
+ </Grid.Root>
177
172
  </Flex>
178
173
 
179
174
  {!isLoadingPlugins && (
@@ -184,7 +179,7 @@ export const CreatePage = () => {
184
179
  />
185
180
  )}
186
181
  </Flex>
187
- </ContentLayout>
182
+ </Layouts.Content>
188
183
  </Form>
189
184
  )}
190
185
  </Formik>
@@ -193,7 +188,7 @@ export const CreatePage = () => {
193
188
  };
194
189
 
195
190
  export const ProtectedRolesCreatePage = () => (
196
- <CheckPagePermissions permissions={PERMISSIONS.createRole}>
191
+ <Page.Protect permissions={PERMISSIONS.createRole}>
197
192
  <CreatePage />
198
- </CheckPagePermissions>
193
+ </Page.Protect>
199
194
  );