@strapi/admin 4.6.0-beta.2 → 4.6.1

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 (228) hide show
  1. package/.browserslistrc +2 -1
  2. package/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
  3. package/admin/src/components/ConfigurationsProvider/index.js +21 -18
  4. package/admin/src/components/ConfigurationsProvider/reducer.js +1 -0
  5. package/admin/src/components/LeftMenu/index.js +62 -53
  6. package/admin/src/components/UnauthenticatedLogo/index.js +1 -1
  7. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +20 -16
  8. package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +5 -5
  9. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +1 -3
  10. package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +6 -5
  11. package/admin/src/content-manager/components/Hint/index.js +4 -17
  12. package/admin/src/content-manager/components/InputUID/index.js +7 -18
  13. package/admin/src/content-manager/components/Inputs/index.js +0 -2
  14. package/admin/src/content-manager/components/PreviewWysiwyg/Wrapper.js +22 -27
  15. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +35 -14
  16. package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +19 -28
  17. package/admin/src/content-manager/components/Wysiwyg/index.js +4 -8
  18. package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +4 -3
  19. package/admin/src/content-manager/hooks/useLazyComponents/index.js +9 -13
  20. package/admin/src/content-manager/hooks/useRelation/useRelation.js +4 -4
  21. package/admin/src/content-manager/pages/App/LeftMenu/index.js +3 -8
  22. package/admin/src/content-manager/pages/App/LeftMenu/utils/index.js +1 -0
  23. package/admin/src/content-manager/pages/App/LeftMenu/utils/matchByTitle.js +24 -0
  24. package/admin/src/content-manager/pages/App/useModels.js +8 -3
  25. package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +3 -2
  26. package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +4 -4
  27. package/admin/src/content-manager/pages/EditSettingsView/utils/api.js +4 -2
  28. package/admin/src/content-manager/pages/EditView/{Informations → Information}/index.js +55 -39
  29. package/admin/src/content-manager/pages/EditView/{Informations → Information}/utils/getUnits.js +0 -0
  30. package/admin/src/content-manager/pages/EditView/index.js +3 -3
  31. package/admin/src/content-manager/pages/ListSettingsView/utils/api.js +4 -2
  32. package/admin/src/content-manager/pages/ListView/index.js +9 -9
  33. package/admin/src/core/store/configureStore.js +22 -4
  34. package/admin/src/core/utils/index.js +0 -1
  35. package/admin/src/hooks/useFetchEnabledPlugins/utils/api.js +3 -2
  36. package/admin/src/hooks/useInjectReducer/index.js +1 -0
  37. package/admin/src/hooks/useInjectReducer/useInjectReducer.js +19 -0
  38. package/admin/src/hooks/useRegenerate/index.js +3 -3
  39. package/admin/src/hooks/useRolesList/index.js +5 -3
  40. package/admin/src/hooks/useSettingsMenu/init.js +2 -25
  41. package/admin/src/hooks/useSettingsMenu/utils/adminLinks.js +4 -0
  42. package/admin/src/hooks/useSettingsMenu/utils/customAdminLinks.js +1 -0
  43. package/admin/src/hooks/useSettingsMenu/utils/defaultAdminLinks.js +21 -0
  44. package/admin/src/index.js +5 -4
  45. package/admin/src/pages/App/index.js +6 -2
  46. package/admin/src/pages/ProfilePage/utils/api.js +5 -3
  47. package/admin/src/pages/SettingsPage/{pages/Users/ListPage → components}/Filters/index.js +0 -0
  48. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +6 -5
  49. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +4 -3
  50. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/CustomizationInfos/index.js +142 -0
  51. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/init.js +3 -0
  52. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/reducer.js +20 -0
  53. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +21 -17
  54. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +68 -42
  55. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +9 -3
  56. package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +6 -3
  57. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +9 -3
  58. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
  59. package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +6 -3
  60. package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +3 -2
  61. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +1 -1
  62. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +3 -2
  63. package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +0 -11
  64. package/admin/src/permissions/defaultPermissions.js +4 -0
  65. package/admin/src/translations/en.json +29 -21
  66. package/admin/src/translations/eu.json +796 -0
  67. package/admin/src/translations/languageNativeNames.js +1 -0
  68. package/admin/src/translations/ru.json +9 -9
  69. package/build/1412.936ed920.chunk.js +159 -0
  70. package/build/1683.c8aa7b7c.chunk.js +268 -0
  71. package/build/2607.2e48dbf8.chunk.js +66 -0
  72. package/build/2743.6d1632f9.chunk.js +45 -0
  73. package/build/3075.dc3894fe.chunk.js +108 -0
  74. package/build/3632.0317b618.chunk.js +138 -0
  75. package/build/4318.f96a9d4d.chunk.js +30 -0
  76. package/build/{3557.e7115160.chunk.js → 4855.bd092921.chunk.js} +131 -91
  77. package/build/{5015.f5e15fdb.chunk.js → 5015.8e3fe50b.chunk.js} +1 -1
  78. package/build/8633.00ccd382.chunk.js +1 -0
  79. package/build/9707.7290fd92.chunk.js +96 -0
  80. package/build/Admin-authenticatedApp.ce646f66.chunk.js +75 -0
  81. package/build/Admin_homePage.b1730882.chunk.js +77 -0
  82. package/build/Admin_marketplace.ea0316c2.chunk.js +26 -0
  83. package/build/Admin_pluginsPage.5c24f963.chunk.js +6 -0
  84. package/build/Admin_profilePage.59af1978.chunk.js +15 -0
  85. package/build/Admin_settingsPage.d1493824.chunk.js +178 -0
  86. package/build/{Upload_ConfigureTheView.9bdf41b5.chunk.js → Upload_ConfigureTheView.3f2b6e6a.chunk.js} +1 -1
  87. package/build/admin-app.25934eaa.chunk.js +112 -0
  88. package/build/admin-edit-roles-page.446b69dc.chunk.js +1 -0
  89. package/build/admin-edit-users.2ed69bfd.chunk.js +10 -0
  90. package/build/admin-users.fc003b10.chunk.js +11 -0
  91. package/build/{api-tokens-create-page.0e686c30.chunk.js → api-tokens-create-page.d248362d.chunk.js} +1 -1
  92. package/build/{api-tokens-edit-page.d6c7487b.chunk.js → api-tokens-edit-page.8516fa20.chunk.js} +1 -1
  93. package/build/api-tokens-list-page.44a79fda.chunk.js +16 -0
  94. package/build/audit-logs-settings-page.c3dce30d.chunk.js +1 -0
  95. package/build/content-manager.35ff9726.chunk.js +1139 -0
  96. package/build/content-type-builder-list-view.79e84b36.chunk.js +193 -0
  97. package/build/{content-type-builder-translation-de-json.29df67b8.chunk.js → content-type-builder-translation-de-json.0979cccb.chunk.js} +1 -1
  98. package/build/{content-type-builder-translation-dk-json.e22d2527.chunk.js → content-type-builder-translation-dk-json.e05583e9.chunk.js} +1 -1
  99. package/build/content-type-builder-translation-en-json.e577d595.chunk.js +1 -0
  100. package/build/{content-type-builder-translation-es-json.1044b252.chunk.js → content-type-builder-translation-es-json.fe4daad8.chunk.js} +1 -1
  101. package/build/{content-type-builder-translation-fr-json.2183e6b3.chunk.js → content-type-builder-translation-fr-json.b1eb52f6.chunk.js} +1 -1
  102. package/build/{content-type-builder-translation-id-json.ba3e8891.chunk.js → content-type-builder-translation-id-json.ee3b36bb.chunk.js} +1 -1
  103. package/build/{content-type-builder-translation-it-json.d4661201.chunk.js → content-type-builder-translation-it-json.13b3c26a.chunk.js} +1 -1
  104. package/build/{content-type-builder-translation-ko-json.57ff7f51.chunk.js → content-type-builder-translation-ko-json.8a274be5.chunk.js} +1 -1
  105. package/build/{content-type-builder-translation-pl-json.a057b51e.chunk.js → content-type-builder-translation-pl-json.24a34349.chunk.js} +1 -1
  106. package/build/{content-type-builder-translation-pt-BR-json.446df9da.chunk.js → content-type-builder-translation-pt-BR-json.97f71a9d.chunk.js} +1 -1
  107. package/build/{content-type-builder-translation-ru-json.8c51843e.chunk.js → content-type-builder-translation-ru-json.54d11230.chunk.js} +1 -1
  108. package/build/{content-type-builder-translation-sv-json.af6ecca1.chunk.js → content-type-builder-translation-sv-json.59f5e1e5.chunk.js} +1 -1
  109. package/build/{content-type-builder-translation-tr-json.da83a07e.chunk.js → content-type-builder-translation-tr-json.cea4d226.chunk.js} +1 -1
  110. package/build/{content-type-builder-translation-zh-json.42f94cb3.chunk.js → content-type-builder-translation-zh-json.faedd610.chunk.js} +1 -1
  111. package/build/content-type-builder.855db321.chunk.js +126 -0
  112. package/build/email-settings-page.d1fcc7a3.chunk.js +10 -0
  113. package/build/en-json.1f137a90.chunk.js +1 -0
  114. package/build/eu-json.fceecd8b.chunk.js +1 -0
  115. package/build/i18n-settings-page.b8d8753e.chunk.js +60 -0
  116. package/build/{i18n-translation-de-json.dc876c08.chunk.js → i18n-translation-de-json.362384a6.chunk.js} +1 -1
  117. package/build/{i18n-translation-dk-json.49aaf933.chunk.js → i18n-translation-dk-json.89401417.chunk.js} +1 -1
  118. package/build/{i18n-translation-en-json.ac9ebc1b.chunk.js → i18n-translation-en-json.60af6722.chunk.js} +1 -1
  119. package/build/{i18n-translation-es-json.57072ed3.chunk.js → i18n-translation-es-json.87b494d1.chunk.js} +1 -1
  120. package/build/{i18n-translation-fr-json.84733f34.chunk.js → i18n-translation-fr-json.57ddc77e.chunk.js} +1 -1
  121. package/build/{i18n-translation-ko-json.fc73fe20.chunk.js → i18n-translation-ko-json.ef4f9471.chunk.js} +1 -1
  122. package/build/{i18n-translation-pl-json.16e5df90.chunk.js → i18n-translation-pl-json.dfac513d.chunk.js} +1 -1
  123. package/build/{i18n-translation-tr-json.cb39c048.chunk.js → i18n-translation-tr-json.10f0600d.chunk.js} +1 -1
  124. package/build/{i18n-translation-zh-Hans-json.2cf82d2d.chunk.js → i18n-translation-zh-Hans-json.757ce62d.chunk.js} +1 -1
  125. package/build/{i18n-translation-zh-json.ed1d272e.chunk.js → i18n-translation-zh-json.bef2dc07.chunk.js} +1 -1
  126. package/build/index.html +1 -1
  127. package/build/main.7b151630.js +4377 -0
  128. package/build/ru-json.aa5cd123.chunk.js +1 -0
  129. package/build/runtime~main.a20d633b.js +2 -0
  130. package/build/sso-settings-page.b85ad080.chunk.js +41 -0
  131. package/build/upload-settings.ef64bbf9.chunk.js +84 -0
  132. package/build/upload.c5730dfa.chunk.js +33 -0
  133. package/build/users-advanced-settings-page.fce9908e.chunk.js +8 -0
  134. package/build/users-email-settings-page.343d0ad2.chunk.js +23 -0
  135. package/build/users-providers-settings-page.e5a9a3f1.chunk.js +99 -0
  136. package/build/users-roles-settings-page.66312f31.chunk.js +30 -0
  137. package/build/webhook-edit-page.73e51e64.chunk.js +75 -0
  138. package/build/webhook-list-page.1134f130.chunk.js +42 -0
  139. package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +17 -0
  140. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/ComboboxFilter/index.js +41 -0
  141. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +1 -3
  142. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionItem.js +0 -0
  143. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/index.js +5 -1
  144. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/PaginationFooter/index.js +0 -0
  145. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/TableRows/index.js +1 -1
  146. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +47 -0
  147. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useFormatTimeStamp.js +0 -0
  148. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/index.js +35 -36
  149. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +10 -9
  150. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +88 -0
  151. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/tableHeaders.js +0 -0
  152. package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +1 -1
  153. package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
  154. package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/index.js +3 -3
  155. package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/utils/schema.js +0 -0
  156. package/ee/admin/pages/SettingsPage/utils/customRoutes.js +28 -16
  157. package/ee/server/bootstrap.js +2 -0
  158. package/ee/server/migrations/audit-logs-table.js +45 -0
  159. package/ee/server/register.js +2 -0
  160. package/ee/server/routes/index.js +94 -10
  161. package/ee/server/services/audit-logs.js +30 -2
  162. package/ee/server/services/passport/sso.js +13 -1
  163. package/ee/server/services/passport.js +1 -4
  164. package/package.json +27 -32
  165. package/server/controllers/admin.js +19 -2
  166. package/server/register.js +7 -7
  167. package/server/services/project-settings.js +10 -6
  168. package/server/services/user.js +3 -1
  169. package/server/validation/project-settings.js +19 -10
  170. package/strapi-server.js +1 -1
  171. package/admin/src/content-manager/components/InputJSON/FieldWrapper.js +0 -40
  172. package/admin/src/content-manager/components/InputJSON/Label.js +0 -35
  173. package/admin/src/content-manager/components/InputJSON/components.js +0 -36
  174. package/admin/src/content-manager/components/InputJSON/index.js +0 -223
  175. package/admin/src/content-manager/components/InputJSON/jsonlint.js +0 -680
  176. package/admin/src/core/store/createReducer.js +0 -5
  177. package/admin/src/core/utils/axiosInstance.js +0 -38
  178. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
  179. package/build/2235.746d3cf7.chunk.js +0 -106
  180. package/build/2598.01c96bd5.chunk.js +0 -159
  181. package/build/2743.692b1f21.chunk.js +0 -42
  182. package/build/4318.87affaf2.chunk.js +0 -30
  183. package/build/4958.1979bbf5.chunk.js +0 -276
  184. package/build/5052.c2eacff2.chunk.js +0 -65
  185. package/build/7295.4e2dfbbb.chunk.js +0 -114
  186. package/build/805.da20168c.chunk.js +0 -138
  187. package/build/8633.6f546066.chunk.js +0 -1
  188. package/build/874.be41e4b3.chunk.js +0 -104
  189. package/build/9707.a07db355.chunk.js +0 -101
  190. package/build/Admin-authenticatedApp.9933974c.chunk.js +0 -75
  191. package/build/Admin_homePage.045bb0c8.chunk.js +0 -77
  192. package/build/Admin_marketplace.bf3ac090.chunk.js +0 -26
  193. package/build/Admin_pluginsPage.d2a9a619.chunk.js +0 -6
  194. package/build/Admin_profilePage.5e830ceb.chunk.js +0 -15
  195. package/build/Admin_settingsPage.53fa00a4.chunk.js +0 -178
  196. package/build/admin-app.8ed108ca.chunk.js +0 -112
  197. package/build/admin-audit-logs.68f833bf.chunk.js +0 -1
  198. package/build/admin-edit-roles-page.32bfe5ea.chunk.js +0 -1
  199. package/build/admin-edit-users.795f155c.chunk.js +0 -10
  200. package/build/admin-users.cbd9bcf7.chunk.js +0 -11
  201. package/build/api-tokens-list-page.a55e427c.chunk.js +0 -16
  202. package/build/codemirror-addon-closebrackets.71aa4bbd.chunk.js +0 -2
  203. package/build/codemirror-addon-lint-js.405f70fb.chunk.js +0 -1
  204. package/build/codemirror-addon-lint.8487ad3d.chunk.js +0 -1
  205. package/build/codemirror-addon-mark-selection.1928c849.chunk.js +0 -1
  206. package/build/codemirror-css.359a2a4b.chunk.js +0 -345
  207. package/build/codemirror-javacript.af237b68.chunk.js +0 -1
  208. package/build/codemirror-theme.2fe63a16.chunk.js +0 -33
  209. package/build/content-manager.ad929a94.chunk.js +0 -1174
  210. package/build/content-type-builder-list-view.3048854d.chunk.js +0 -198
  211. package/build/content-type-builder-translation-en-json.08e28f4e.chunk.js +0 -1
  212. package/build/content-type-builder.4edd1c22.chunk.js +0 -127
  213. package/build/email-settings-page.7c9e6c5e.chunk.js +0 -15
  214. package/build/en-json.d65a13ef.chunk.js +0 -1
  215. package/build/i18n-settings-page.fbccdf12.chunk.js +0 -1
  216. package/build/main.6bbf9950.js +0 -4417
  217. package/build/ru-json.3b411a39.chunk.js +0 -1
  218. package/build/runtime~main.c2bf62af.js +0 -2
  219. package/build/sso-settings-page.4031de9e.chunk.js +0 -41
  220. package/build/upload-settings.657790fd.chunk.js +0 -89
  221. package/build/upload.608a9856.chunk.js +0 -38
  222. package/build/users-advanced-settings-page.e3ab865f.chunk.js +0 -13
  223. package/build/users-email-settings-page.57adf9b7.chunk.js +0 -28
  224. package/build/users-providers-settings-page.7d1fb45c.chunk.js +0 -1
  225. package/build/users-roles-settings-page.ad28ab42.chunk.js +0 -30
  226. package/build/webhook-edit-page.1dd6d040.chunk.js +0 -75
  227. package/build/webhook-list-page.98afa3ea.chunk.js +0 -42
  228. package/ee/server/routes/features-routes.js +0 -66
@@ -1,17 +1,13 @@
1
1
  'use strict';
2
2
 
3
- // eslint-disable-next-line node/no-extraneous-require
4
3
  const { features } = require('@strapi/strapi/lib/utils/ee');
5
- const featuresRoutes = require('./features-routes');
6
4
 
7
- const getFeaturesRoutes = () => {
8
- return Object.entries(featuresRoutes).flatMap(([featureName, featureRoutes]) => {
9
- if (features.isEnabled(featureName)) {
10
- return featureRoutes;
11
- }
5
+ const enableFeatureMiddleware = (featureName) => (ctx, next) => {
6
+ if (features.isEnabled(featureName)) {
7
+ return next();
8
+ }
12
9
 
13
- return [];
14
- });
10
+ ctx.status = 404;
15
11
  };
16
12
 
17
13
  module.exports = [
@@ -63,5 +59,93 @@ module.exports = [
63
59
  ],
64
60
  },
65
61
  },
66
- ...getFeaturesRoutes(),
62
+
63
+ // SSO
64
+ {
65
+ method: 'GET',
66
+ path: '/providers',
67
+ handler: 'authentication.getProviders',
68
+ config: {
69
+ middlewares: [enableFeatureMiddleware('sso')],
70
+ auth: false,
71
+ },
72
+ },
73
+ {
74
+ method: 'GET',
75
+ path: '/connect/:provider',
76
+ handler: 'authentication.providerLogin',
77
+ config: {
78
+ middlewares: [enableFeatureMiddleware('sso')],
79
+ auth: false,
80
+ },
81
+ },
82
+ {
83
+ method: 'POST',
84
+ path: '/connect/:provider',
85
+ handler: 'authentication.providerLogin',
86
+ config: {
87
+ middlewares: [enableFeatureMiddleware('sso')],
88
+ auth: false,
89
+ },
90
+ },
91
+ {
92
+ method: 'GET',
93
+ path: '/providers/options',
94
+ handler: 'authentication.getProviderLoginOptions',
95
+ config: {
96
+ middlewares: [enableFeatureMiddleware('sso')],
97
+ policies: [
98
+ 'admin::isAuthenticatedAdmin',
99
+ { name: 'admin::hasPermissions', config: { actions: ['admin::provider-login.read'] } },
100
+ ],
101
+ },
102
+ },
103
+ {
104
+ method: 'PUT',
105
+ path: '/providers/options',
106
+ handler: 'authentication.updateProviderLoginOptions',
107
+ config: {
108
+ middlewares: [enableFeatureMiddleware('sso')],
109
+ policies: [
110
+ 'admin::isAuthenticatedAdmin',
111
+ { name: 'admin::hasPermissions', config: { actions: ['admin::provider-login.update'] } },
112
+ ],
113
+ },
114
+ },
115
+
116
+ // Audit logs
117
+ {
118
+ method: 'GET',
119
+ path: '/audit-logs',
120
+ handler: 'auditLogs.findMany',
121
+ config: {
122
+ middlewares: [enableFeatureMiddleware('audit-logs')],
123
+ policies: [
124
+ 'admin::isAuthenticatedAdmin',
125
+ {
126
+ name: 'admin::hasPermissions',
127
+ config: {
128
+ actions: ['admin::audit-logs.read'],
129
+ },
130
+ },
131
+ ],
132
+ },
133
+ },
134
+ {
135
+ method: 'GET',
136
+ path: '/audit-logs/:id',
137
+ handler: 'auditLogs.findOne',
138
+ config: {
139
+ middlewares: [enableFeatureMiddleware('audit-logs')],
140
+ policies: [
141
+ 'admin::isAuthenticatedAdmin',
142
+ {
143
+ name: 'admin::hasPermissions',
144
+ config: {
145
+ actions: ['admin::audit-logs.read'],
146
+ },
147
+ },
148
+ ],
149
+ },
150
+ },
67
151
  ];
@@ -2,6 +2,9 @@
2
2
 
3
3
  const localProvider = require('@strapi/provider-audit-logs-local');
4
4
  const { scheduleJob } = require('node-schedule');
5
+ const { features } = require('@strapi/strapi/lib/utils/ee');
6
+
7
+ const DEFAULT_RETENTION_DAYS = 90;
5
8
 
6
9
  const defaultEvents = [
7
10
  'entry.create',
@@ -12,6 +15,9 @@ const defaultEvents = [
12
15
  'media.create',
13
16
  'media.update',
14
17
  'media.delete',
18
+ 'media-folder.create',
19
+ 'media-folder.update',
20
+ 'media-folder.delete',
15
21
  'user.create',
16
22
  'user.update',
17
23
  'user.delete',
@@ -52,6 +58,16 @@ const createAuditLogsService = (strapi) => {
52
58
  const eventMap = getEventMap(defaultEvents);
53
59
 
54
60
  const processEvent = (name, ...args) => {
61
+ const state = strapi.requestContext.get()?.state;
62
+
63
+ // Ignore events with auth strategies different from admin
64
+ const isUsingAdminAuth = state?.auth?.strategy.name === 'admin';
65
+ const user = state?.user;
66
+
67
+ if (!isUsingAdminAuth || !user) {
68
+ return null;
69
+ }
70
+
55
71
  const getPayload = eventMap[name];
56
72
 
57
73
  // Ignore the event if it's not in the map
@@ -59,11 +75,17 @@ const createAuditLogsService = (strapi) => {
59
75
  return null;
60
76
  }
61
77
 
78
+ // Ignore some events based on payload
79
+ const ignoredUids = ['plugin::upload.file', 'plugin::upload.folder'];
80
+ if (ignoredUids.includes(args[0]?.uid)) {
81
+ return null;
82
+ }
83
+
62
84
  return {
63
85
  action: name,
64
86
  date: new Date().toISOString(),
65
87
  payload: getPayload(...args) || {},
66
- userId: strapi.requestContext.get()?.state?.user?.id,
88
+ userId: user.id,
67
89
  };
68
90
  };
69
91
 
@@ -77,9 +99,15 @@ const createAuditLogsService = (strapi) => {
77
99
 
78
100
  return {
79
101
  async register() {
102
+ const retentionDays =
103
+ features.get('audit-logs')?.options.retentionDays ?? DEFAULT_RETENTION_DAYS;
80
104
  this._provider = await localProvider.register({ strapi });
81
105
  this._eventHubUnsubscribe = strapi.eventHub.subscribe(handleEvent.bind(this));
82
- this._deleteExpiredJob = scheduleJob('0 0 * * *', this._provider.deleteExpiredEvents);
106
+ this._deleteExpiredJob = scheduleJob('0 0 * * *', () => {
107
+ const expirationDate = new Date(Date.now() - retentionDays * 24 * 60 * 60 * 1000);
108
+ this._provider.deleteExpiredEvents(expirationDate);
109
+ });
110
+
83
111
  return this;
84
112
  },
85
113
 
@@ -1,13 +1,25 @@
1
1
  'use strict';
2
2
 
3
+ const ee = require('@strapi/strapi/ee');
3
4
  const { authEventsMapper } = require('../../../../server/services/passport');
4
5
  const createProviderRegistry = require('./provider-registry');
5
6
 
6
7
  const providerRegistry = createProviderRegistry();
8
+ const errorMessage = 'SSO is disabled. Its functionnalities cannot be accessed.';
7
9
 
8
- const getStrategyCallbackURL = (providerName) => `/admin/connect/${providerName}`;
10
+ const getStrategyCallbackURL = (providerName) => {
11
+ if (!ee.features.isEnabled('sso')) {
12
+ throw new Error(errorMessage);
13
+ }
14
+
15
+ return `/admin/connect/${providerName}`;
16
+ };
9
17
 
10
18
  const syncProviderRegistryWithConfig = () => {
19
+ if (!ee.features.isEnabled('sso')) {
20
+ throw new Error(errorMessage);
21
+ }
22
+
11
23
  const { providers = [] } = strapi.config.get('admin.auth', {});
12
24
 
13
25
  providerRegistry.registerMany(providers);
@@ -25,8 +25,5 @@ const getPassportStrategies = () => {
25
25
 
26
26
  module.exports = {
27
27
  getPassportStrategies,
28
+ ...sso,
28
29
  };
29
-
30
- if (features.isEnabled('sso')) {
31
- Object.assign(module.exports, sso);
32
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/admin",
3
- "version": "4.6.0-beta.2",
3
+ "version": "4.6.1",
4
4
  "description": "Strapi Admin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,30 +38,25 @@
38
38
  "test:front:ce:cov": "cross-env IS_EE=false jest --config ./jest.config.front.js --coverage"
39
39
  },
40
40
  "dependencies": {
41
- "@babel/core": "7.18.10",
42
- "@babel/plugin-transform-runtime": "7.18.10",
43
- "@babel/preset-env": "7.18.10",
44
- "@babel/preset-react": "7.18.6",
45
- "@babel/runtime": "7.18.9",
41
+ "@babel/core": "^7.20.12",
42
+ "@babel/plugin-transform-runtime": "^7.19.6",
43
+ "@babel/preset-env": "^7.20.2",
44
+ "@babel/preset-react": "^7.18.6",
45
+ "@babel/runtime": "^7.20.13",
46
46
  "@casl/ability": "^5.4.3",
47
47
  "@fingerprintjs/fingerprintjs": "3.3.6",
48
- "@fortawesome/fontawesome-free": "^5.15.3",
49
- "@fortawesome/fontawesome-svg-core": "6.2.0",
50
- "@fortawesome/free-brands-svg-icons": "^5.15.3",
51
- "@fortawesome/free-solid-svg-icons": "^5.15.3",
52
- "@fortawesome/react-fontawesome": "^0.2.0",
53
48
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
54
- "@strapi/babel-plugin-switch-ee-ce": "4.6.0-beta.2",
55
- "@strapi/data-transfer": "4.6.0-beta.2",
56
- "@strapi/design-system": "0.0.0-jsoninput.0",
57
- "@strapi/helper-plugin": "4.6.0-beta.2",
58
- "@strapi/icons": "1.4.2",
59
- "@strapi/permissions": "4.6.0-beta.2",
60
- "@strapi/provider-audit-logs-local": "4.6.0-beta.2",
61
- "@strapi/typescript-utils": "4.6.0-beta.2",
62
- "@strapi/utils": "4.6.0-beta.2",
49
+ "@strapi/babel-plugin-switch-ee-ce": "4.6.1",
50
+ "@strapi/data-transfer": "4.6.1",
51
+ "@strapi/design-system": "1.6.3",
52
+ "@strapi/helper-plugin": "4.6.1",
53
+ "@strapi/icons": "1.6.3",
54
+ "@strapi/permissions": "4.6.1",
55
+ "@strapi/provider-audit-logs-local": "4.6.1",
56
+ "@strapi/typescript-utils": "4.6.1",
57
+ "@strapi/utils": "4.6.1",
63
58
  "axios": "1.2.2",
64
- "babel-loader": "8.2.5",
59
+ "babel-loader": "^9.1.2",
65
60
  "babel-plugin-styled-components": "2.0.2",
66
61
  "bcryptjs": "2.4.3",
67
62
  "browserslist-to-esbuild": "1.2.0",
@@ -69,10 +64,10 @@
69
64
  "chokidar": "^3.5.1",
70
65
  "codemirror": "^5.65.11",
71
66
  "cross-env": "^7.0.3",
72
- "css-loader": "6.7.2",
67
+ "css-loader": "^6.7.3",
73
68
  "date-fns": "2.29.3",
74
69
  "dotenv": "8.5.1",
75
- "esbuild-loader": "^2.20.0",
70
+ "esbuild-loader": "^2.21.0",
76
71
  "execa": "^1.0.0",
77
72
  "fast-deep-equal": "3.1.3",
78
73
  "find-root": "1.1.0",
@@ -82,9 +77,9 @@
82
77
  "highlight.js": "^10.4.1",
83
78
  "history": "^4.9.0",
84
79
  "hoist-non-react-statics": "^3.3.0",
85
- "html-loader": "3.1.2",
80
+ "html-loader": "^4.2.0",
86
81
  "html-webpack-plugin": "5.5.0",
87
- "immer": "9.0.15",
82
+ "immer": "9.0.19",
88
83
  "invariant": "^2.2.4",
89
84
  "js-cookie": "2.2.1",
90
85
  "jsonwebtoken": "9.0.0",
@@ -104,7 +99,7 @@
104
99
  "markdown-it-sub": "^1.0.0",
105
100
  "markdown-it-sup": "1.0.0",
106
101
  "match-sorter": "^4.0.2",
107
- "mini-css-extract-plugin": "2.4.4",
102
+ "mini-css-extract-plugin": "2.7.2",
108
103
  "msw": "0.49.1",
109
104
  "node-polyfill-webpack-plugin": "2.0.1",
110
105
  "node-schedule": "2.1.0",
@@ -120,7 +115,7 @@
120
115
  "react-error-boundary": "3.1.4",
121
116
  "react-fast-compare": "^3.2.0",
122
117
  "react-helmet": "^6.1.0",
123
- "react-intl": "5.25.1",
118
+ "react-intl": "6.2.7",
124
119
  "react-is": "^17.0.2",
125
120
  "react-query": "3.24.3",
126
121
  "react-redux": "7.2.8",
@@ -137,9 +132,9 @@
137
132
  "style-loader": "3.3.1",
138
133
  "styled-components": "5.3.3",
139
134
  "typescript": "4.6.2",
140
- "webpack": "^5.74.0",
141
- "webpack-cli": "^4.10.0",
142
- "webpack-dev-server": "^4.9.3",
135
+ "webpack": "^5.75.0",
136
+ "webpack-cli": "^5.0.1",
137
+ "webpack-dev-server": "^4.11.1",
143
138
  "webpackbar": "^5.0.2",
144
139
  "yup": "^0.32.9"
145
140
  },
@@ -152,7 +147,7 @@
152
147
  "glob": "8.0.3",
153
148
  "react-test-renderer": "^17.0.2",
154
149
  "speed-measure-webpack-plugin": "1.5.0",
155
- "webpack-bundle-analyzer": "^4.6.1"
150
+ "webpack-bundle-analyzer": "^4.7.0"
156
151
  },
157
152
  "peerDependencies": {
158
153
  "@strapi/strapi": "^4.3.4"
@@ -170,5 +165,5 @@
170
165
  }
171
166
  }
172
167
  },
173
- "gitHead": "b852090f931cd21868c4016f24db2f9fdfc7a7ab"
168
+ "gitHead": "17a7845e3d453ea2e7911bda6ec25ed196dd5f16"
174
169
  }
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('path');
4
+
5
+ const { map, values, sumBy, pipe, flatMap, propEq } = require('lodash/fp');
4
6
  const execa = require('execa');
5
7
  const _ = require('lodash');
6
8
  const { exists } = require('fs-extra');
@@ -37,7 +39,7 @@ module.exports = {
37
39
  async getProjectType() {
38
40
  // FIXME
39
41
  try {
40
- return { data: { isEE: strapi.EE, features: ee.features.getEnabled() } };
42
+ return { data: { isEE: strapi.EE, features: ee.features.list() } };
41
43
  } catch (err) {
42
44
  return { data: { isEE: false, features: [] } };
43
45
  }
@@ -46,7 +48,7 @@ module.exports = {
46
48
  async init() {
47
49
  let uuid = strapi.config.get('uuid', false);
48
50
  const hasAdmin = await getService('user').exists();
49
- const { menuLogo } = await getService('project-settings').getProjectSettings();
51
+ const { menuLogo, authLogo } = await getService('project-settings').getProjectSettings();
50
52
  // set to null if telemetryDisabled flag not avaialble in package.json
51
53
  const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled', null);
52
54
 
@@ -59,6 +61,7 @@ module.exports = {
59
61
  uuid,
60
62
  hasAdmin,
61
63
  menuLogo: menuLogo ? menuLogo.url : null,
64
+ authLogo: authLogo ? authLogo.url : null,
62
65
  },
63
66
  };
64
67
  },
@@ -96,11 +99,25 @@ module.exports = {
96
99
  );
97
100
  const isHostedOnStrapiCloud = env('STRAPI_HOSTING', null) === 'strapi.cloud';
98
101
 
102
+ const numberOfAllContentTypes = _.size(strapi.contentTypes);
103
+ const numberOfComponents = _.size(strapi.components);
104
+
105
+ const getNumberOfDynamicZones = () => {
106
+ return pipe(
107
+ map('attributes'),
108
+ flatMap(values),
109
+ sumBy(propEq('type', 'dynamiczone'))
110
+ )(strapi.contentTypes);
111
+ };
112
+
99
113
  return {
100
114
  data: {
101
115
  useTypescriptOnServer,
102
116
  useTypescriptOnAdmin,
103
117
  isHostedOnStrapiCloud,
118
+ numberOfAllContentTypes, // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.
119
+ numberOfComponents,
120
+ numberOfDynamicZones: getNumberOfDynamicZones(),
104
121
  },
105
122
  };
106
123
  },
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { register: registerDataTransferRoute } = require('@strapi/data-transfer/lib/strapi');
3
+ // const { register: registerDataTransferRoute } = require('@strapi/data-transfer/lib/strapi');
4
4
 
5
5
  const registerAdminPanelRoute = require('./routes/serve-admin-panel');
6
6
  const adminAuthStrategy = require('./strategies/admin');
@@ -17,10 +17,10 @@ module.exports = ({ strapi }) => {
17
17
  registerAdminPanelRoute({ strapi });
18
18
  }
19
19
 
20
- if (
21
- process.env.STRAPI_EXPERIMENTAL === 'true' &&
22
- process.env.STRAPI_DISABLE_REMOTE_DATA_TRANSFER !== 'true'
23
- ) {
24
- registerDataTransferRoute(strapi);
25
- }
20
+ // if (
21
+ // process.env.STRAPI_EXPERIMENTAL === 'true' &&
22
+ // process.env.STRAPI_DISABLE_REMOTE_DATA_TRANSFER !== 'true'
23
+ // ) {
24
+ // registerDataTransferRoute(strapi);
25
+ // }
26
26
  };
@@ -3,10 +3,7 @@
3
3
  const fs = require('fs');
4
4
  const { pick } = require('lodash');
5
5
 
6
- const PROJECT_SETTINGS_FILE_INPUTS = ['menuLogo'];
7
- const DEFAULT_PROJECT_SETTINGS = {
8
- menuLogo: null,
9
- };
6
+ const PROJECT_SETTINGS_FILE_INPUTS = ['menuLogo', 'authLogo'];
10
7
 
11
8
  const parseFilesData = async (files) => {
12
9
  const formatedFilesData = {};
@@ -52,8 +49,15 @@ const parseFilesData = async (files) => {
52
49
 
53
50
  const getProjectSettings = async () => {
54
51
  const store = strapi.store({ type: 'core', name: 'admin' });
52
+
53
+ // Returns an object with file inputs names as key and null as value
54
+ const defaultProjectSettings = PROJECT_SETTINGS_FILE_INPUTS.reduce((prev, cur) => {
55
+ prev[cur] = null;
56
+ return prev;
57
+ }, {});
58
+
55
59
  const projectSettings = {
56
- ...DEFAULT_PROJECT_SETTINGS,
60
+ ...defaultProjectSettings,
57
61
  ...(await store.get({ key: 'project-settings' })),
58
62
  };
59
63
 
@@ -133,7 +137,7 @@ const updateProjectSettings = async (newSettings) => {
133
137
  }
134
138
 
135
139
  // If the user input is undefined reuse previous setting (do not update field)
136
- if (!newSettings[inputName]) {
140
+ if (!newSettings[inputName] && previousSettings) {
137
141
  newSettings[inputName] = previousSettings[inputName];
138
142
  return;
139
143
  }
@@ -98,7 +98,9 @@ const updateById = async (id, attributes) => {
98
98
  populate: ['roles'],
99
99
  });
100
100
 
101
- strapi.eventHub.emit('user.update', { user: sanitizeUser(updatedUser) });
101
+ if (updatedUser) {
102
+ strapi.eventHub.emit('user.update', { user: sanitizeUser(updatedUser) });
103
+ }
102
104
 
103
105
  return updatedUser;
104
106
  };
@@ -10,26 +10,35 @@ const ALLOWED_IMAGE_FILE_TYPES = ['image/jpeg', 'image/png', 'image/svg+xml'];
10
10
  const updateProjectSettings = yup
11
11
  .object({
12
12
  menuLogo: yup.string(),
13
+ authLogo: yup.string(),
13
14
  })
14
15
  .noUnknown();
15
16
 
17
+ const updateProjectSettingsLogo = yup.object({
18
+ name: yup.string(),
19
+ type: yup.string().oneOf(ALLOWED_IMAGE_FILE_TYPES),
20
+ size: yup.number().max(MAX_IMAGE_FILE_SIZE),
21
+ });
22
+
16
23
  const updateProjectSettingsFiles = yup
17
24
  .object({
18
- menuLogo: yup.object({
19
- name: yup.string(),
20
- type: yup.string().oneOf(ALLOWED_IMAGE_FILE_TYPES),
21
- size: yup.number().max(MAX_IMAGE_FILE_SIZE),
22
- }),
25
+ menuLogo: updateProjectSettingsLogo,
26
+ authLogo: updateProjectSettingsLogo,
23
27
  })
24
28
  .noUnknown();
25
29
 
26
- const updateProjectSettingsImagesDimensions = yup.object({
27
- menuLogo: yup.object({
28
- width: yup.number().max(MAX_IMAGE_WIDTH),
29
- height: yup.number().max(MAX_IMAGE_HEIGHT),
30
- }),
30
+ const logoDimensions = yup.object({
31
+ width: yup.number().max(MAX_IMAGE_WIDTH),
32
+ height: yup.number().max(MAX_IMAGE_HEIGHT),
31
33
  });
32
34
 
35
+ const updateProjectSettingsImagesDimensions = yup
36
+ .object({
37
+ menuLogo: logoDimensions,
38
+ authLogo: logoDimensions,
39
+ })
40
+ .noUnknown();
41
+
33
42
  module.exports = {
34
43
  validateUpdateProjectSettings: validateYupSchemaSync(updateProjectSettings),
35
44
  validateUpdateProjectSettingsFiles: validateYupSchemaSync(updateProjectSettingsFiles),
package/strapi-server.js CHANGED
@@ -8,7 +8,7 @@ const mergeRoutes = (a, b, key) => {
8
8
  return _.isArray(a) && _.isArray(b) && key === 'routes' ? a.concat(b) : undefined;
9
9
  };
10
10
 
11
- if (process.env.STRAPI_DISABLE_EE !== 'true' && strapi.EE) {
11
+ if (strapi.EE) {
12
12
  const eeAdmin = require('./ee/strapi-server');
13
13
 
14
14
  module.exports = _.mergeWith({}, admin, eeAdmin, mergeRoutes);
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { useIntl } from 'react-intl';
4
- import { Field } from '@strapi/design-system/Field';
5
-
6
- const FieldWrapper = ({ name, hint, error, children, required }) => {
7
- const { formatMessage } = useIntl();
8
- const errorMessage = error ? formatMessage({ id: error, defaultMessage: error }) : '';
9
-
10
- return (
11
- <Field
12
- name={name}
13
- hint={hint && formatMessage(hint)}
14
- error={errorMessage}
15
- id={name}
16
- required={required}
17
- >
18
- {children}
19
- </Field>
20
- );
21
- };
22
-
23
- FieldWrapper.defaultProps = {
24
- hint: undefined,
25
- error: '',
26
- required: false,
27
- };
28
-
29
- FieldWrapper.propTypes = {
30
- name: PropTypes.string.isRequired,
31
- hint: PropTypes.shape({
32
- id: PropTypes.string,
33
- defaultMessage: PropTypes.string,
34
- }),
35
- error: PropTypes.string,
36
- children: PropTypes.node.isRequired,
37
- required: PropTypes.bool,
38
- };
39
-
40
- export default FieldWrapper;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { useIntl } from 'react-intl';
4
- import { FieldLabel } from '@strapi/design-system/Field';
5
-
6
- const Label = ({ intlLabel, labelAction, name }) => {
7
- const { formatMessage } = useIntl();
8
- const label = intlLabel?.id
9
- ? formatMessage(
10
- { id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
11
- { ...intlLabel.values }
12
- )
13
- : name;
14
-
15
- return <FieldLabel action={labelAction}>{label}</FieldLabel>;
16
- };
17
-
18
- Label.defaultProps = {
19
- id: undefined,
20
- intlLabel: undefined,
21
- labelAction: undefined,
22
- };
23
-
24
- Label.propTypes = {
25
- id: PropTypes.string,
26
- intlLabel: PropTypes.shape({
27
- id: PropTypes.string.isRequired,
28
- defaultMessage: PropTypes.string.isRequired,
29
- values: PropTypes.object,
30
- }),
31
- labelAction: PropTypes.element,
32
- name: PropTypes.string.isRequired,
33
- };
34
-
35
- export default Label;
@@ -1,36 +0,0 @@
1
- import styled from 'styled-components';
2
- import { Box } from '@strapi/design-system/Box';
3
-
4
- /* eslint-disable */
5
- /* stylelint-disable */
6
- const EditorWrapper = styled.div`
7
- cursor: ${({ disabled }) => (disabled ? 'not-allowed !important' : 'auto')};
8
- /* BASICS */
9
-
10
- .colored {
11
- background-color: yellow;
12
- color: black !important;
13
- }
14
-
15
- > div {
16
- border-radius: 3px;
17
- > div:last-of-type {
18
- min-height: 253px;
19
- max-height: 506px;
20
- }
21
- }
22
-
23
- .CodeMirror {
24
- /* Set height, width, borders, and global font properties here */
25
- font-size: ${14 / 16}rem;
26
- direction: ltr;
27
- z-index: 0;
28
- }
29
- `;
30
-
31
- const StyledBox = styled(Box)`
32
- border-radius: ${({ theme }) => theme.borderRadius};
33
- border: 1px solid ${({ theme, error }) => (error ? theme.colors.danger600 : 'transparent')};
34
- `;
35
-
36
- export { EditorWrapper, StyledBox };