@strapi/plugin-users-permissions 0.0.0-next.f4ff842a3cb7b83db540bee67554b704e042b042 → 0.0.0-next.f5312617ca16b870c2bf1adcea2c69b676979e29

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 +23 -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 +79 -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-rL_BoFHz.js → index-BH6NqE8I.js} +47 -51
  64. package/dist/_chunks/index-BH6NqE8I.js.map +1 -0
  65. package/dist/_chunks/index-C3i__jX-.js +281 -0
  66. package/dist/_chunks/index-C3i__jX-.js.map +1 -0
  67. package/dist/_chunks/{index--ch5E4_K.js → index-CFzpNgIL.js} +108 -106
  68. package/dist/_chunks/index-CFzpNgIL.js.map +1 -0
  69. package/dist/_chunks/index-CJUWqtrZ.mjs +344 -0
  70. package/dist/_chunks/index-CJUWqtrZ.mjs.map +1 -0
  71. package/dist/_chunks/index-CcWTKtCY.js +366 -0
  72. package/dist/_chunks/index-CcWTKtCY.js.map +1 -0
  73. package/dist/_chunks/{index-MuQRbm-o.mjs → index-CnX2wiLY.mjs} +239 -256
  74. package/dist/_chunks/index-CnX2wiLY.mjs.map +1 -0
  75. package/dist/_chunks/index-DUWx-KG9-C1E7ADbJ.mjs +11984 -0
  76. package/dist/_chunks/index-DUWx-KG9-C1E7ADbJ.mjs.map +1 -0
  77. package/dist/_chunks/index-DUWx-KG9-fMZ4nmrb.js +12008 -0
  78. package/dist/_chunks/index-DUWx-KG9-fMZ4nmrb.js.map +1 -0
  79. package/dist/_chunks/{index-WCv8yGzw.js → index-DruWuFWL.js} +255 -274
  80. package/dist/_chunks/index-DruWuFWL.js.map +1 -0
  81. package/dist/_chunks/index-PJoz36kJ.mjs +262 -0
  82. package/dist/_chunks/index-PJoz36kJ.mjs.map +1 -0
  83. package/dist/_chunks/{index-iu-7wU8h.mjs → index-R4R0dEOv.mjs} +46 -50
  84. package/dist/_chunks/index-R4R0dEOv.mjs.map +1 -0
  85. package/dist/_chunks/{index-eE2qjbfg.mjs → index-XOcQhJMB.mjs} +105 -103
  86. package/dist/_chunks/index-XOcQhJMB.mjs.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 +27 -28
  160. package/server/bootstrap/index.js +18 -51
  161. package/server/bootstrap/users-permissions-actions.js +6 -0
  162. package/server/content-types/user/index.js +0 -1
  163. package/server/controllers/auth.js +40 -59
  164. package/server/controllers/content-manager-user.js +28 -30
  165. package/server/controllers/role.js +17 -4
  166. package/server/controllers/user.js +8 -9
  167. package/server/controllers/validation/auth.js +81 -25
  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--ch5E4_K.js.map +0 -1
  198. package/dist/_chunks/index-MuQRbm-o.mjs.map +0 -1
  199. package/dist/_chunks/index-UrkRT2rC.js +0 -320
  200. package/dist/_chunks/index-UrkRT2rC.js.map +0 -1
  201. package/dist/_chunks/index-WCv8yGzw.js.map +0 -1
  202. package/dist/_chunks/index-eE2qjbfg.mjs.map +0 -1
  203. package/dist/_chunks/index-iu-7wU8h.mjs.map +0 -1
  204. package/dist/_chunks/index-mCVPA90k.mjs +0 -385
  205. package/dist/_chunks/index-mCVPA90k.mjs.map +0 -1
  206. package/dist/_chunks/index-mNv7pSw-.js +0 -407
  207. package/dist/_chunks/index-mNv7pSw-.js.map +0 -1
  208. package/dist/_chunks/index-rL_BoFHz.js.map +0 -1
  209. package/dist/_chunks/index-xXp5S4OL.mjs +0 -301
  210. package/dist/_chunks/index-xXp5S4OL.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';
@@ -34,6 +34,9 @@ const secretLabel = {
34
34
  defaultMessage: 'Client Secret',
35
35
  };
36
36
 
37
+ const CALLBACK_REGEX = /^$|^[a-z][a-z0-9+.-]*:\/\/[^\s/$.?#](?:[^\s]*[^\s/$.?#])?$/i;
38
+ const SUBDOMAIN_REGEX = /^(([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+)(:\d+)?(\/\S*)?$/i;
39
+
37
40
  const forms = {
38
41
  email: {
39
42
  form: [
@@ -52,7 +55,7 @@ const forms = {
52
55
  ],
53
56
  ],
54
57
  schema: yup.object().shape({
55
- enabled: yup.bool().required(translatedErrors.required),
58
+ enabled: yup.bool().required(translatedErrors.required.id),
56
59
  }),
57
60
  },
58
61
  providers: {
@@ -117,20 +120,23 @@ const forms = {
117
120
  ],
118
121
  ],
119
122
  schema: yup.object().shape({
120
- enabled: yup.bool().required(translatedErrors.required),
123
+ enabled: yup.bool().required(translatedErrors.required.id),
121
124
  key: yup.string().when('enabled', {
122
125
  is: true,
123
- then: yup.string().required(translatedErrors.required),
126
+ then: yup.string().required(translatedErrors.required.id),
124
127
  otherwise: yup.string(),
125
128
  }),
126
129
  secret: yup.string().when('enabled', {
127
130
  is: true,
128
- then: yup.string().required(translatedErrors.required),
131
+ then: yup.string().required(translatedErrors.required.id),
129
132
  otherwise: yup.string(),
130
133
  }),
131
134
  callback: yup.string().when('enabled', {
132
135
  is: true,
133
- then: yup.string().required(translatedErrors.required),
136
+ then: yup
137
+ .string()
138
+ .matches(CALLBACK_REGEX, translatedErrors.regex.id)
139
+ .required(translatedErrors.required.id),
134
140
  otherwise: yup.string(),
135
141
  }),
136
142
  }),
@@ -231,25 +237,31 @@ const forms = {
231
237
  ],
232
238
  ],
233
239
  schema: yup.object().shape({
234
- enabled: yup.bool().required(translatedErrors.required),
240
+ enabled: yup.bool().required(translatedErrors.required.id),
235
241
  key: yup.string().when('enabled', {
236
242
  is: true,
237
- then: yup.string().required(translatedErrors.required),
243
+ then: yup.string().required(translatedErrors.required.id),
238
244
  otherwise: yup.string(),
239
245
  }),
240
246
  secret: yup.string().when('enabled', {
241
247
  is: true,
242
- then: yup.string().required(translatedErrors.required),
248
+ then: yup.string().required(translatedErrors.required.id),
243
249
  otherwise: yup.string(),
244
250
  }),
245
251
  subdomain: yup.string().when('enabled', {
246
252
  is: true,
247
- then: yup.string().required(translatedErrors.required),
253
+ then: yup
254
+ .string()
255
+ .matches(SUBDOMAIN_REGEX, translatedErrors.regex.id)
256
+ .required(translatedErrors.required.id),
248
257
  otherwise: yup.string(),
249
258
  }),
250
259
  callback: yup.string().when('enabled', {
251
260
  is: true,
252
- then: yup.string().required(translatedErrors.required),
261
+ then: yup
262
+ .string()
263
+ .matches(CALLBACK_REGEX, translatedErrors.regex.id)
264
+ .required(translatedErrors.required.id),
253
265
  otherwise: yup.string(),
254
266
  }),
255
267
  }),
@@ -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