@strapi/admin 4.11.2 → 4.11.4

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 (205) hide show
  1. package/admin/src/components/AuthenticatedApp/index.js +2 -2
  2. package/admin/src/constants.js +90 -0
  3. package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +10 -1
  4. package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +12 -8
  5. package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +5 -6
  6. package/admin/src/content-manager/components/RelationInput/RelationInput.js +99 -178
  7. package/admin/src/content-manager/components/RelationInput/components/Option.js +17 -15
  8. package/admin/src/content-manager/components/RelationInput/components/RelationList.js +2 -2
  9. package/admin/src/content-manager/components/RelationInputDataManager/RelationInputDataManager.js +12 -6
  10. package/admin/src/content-manager/components/RelationInputDataManager/utils/select.js +18 -3
  11. package/admin/src/content-manager/pages/App/index.js +4 -4
  12. package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +9 -5
  13. package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +3 -4
  14. package/admin/src/content-manager/pages/EditView/hooks/useOnce.js +14 -0
  15. package/admin/src/content-manager/pages/EditView/index.js +31 -10
  16. package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/RelationMultiple/index.js +1 -1
  17. package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/utils/hasContent.js +1 -1
  18. package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/ConfirmDialogDelete/index.js +7 -4
  19. package/admin/src/content-manager/pages/ListView/components/ConfirmDialogDeleteAll/index.js +78 -0
  20. package/admin/src/content-manager/pages/ListView/{FieldPicker → components/FieldPicker}/index.js +20 -9
  21. package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/TableRows/index.js +90 -61
  22. package/admin/src/content-manager/pages/ListView/index.js +173 -34
  23. package/admin/src/content-manager/pages/ListView/utils/index.js +0 -2
  24. package/admin/src/content-manager/pages/ListViewLayoutManager/Permissions.js +1 -1
  25. package/admin/src/content-manager/pages/SingleTypeRecursivePath/index.js +4 -4
  26. package/admin/src/hooks/useMenu/index.js +70 -37
  27. package/admin/src/hooks/useMenu/utils/getGeneralLinks.js +5 -2
  28. package/admin/src/hooks/useSettingsMenu/constants.js +0 -7
  29. package/admin/src/hooks/useSettingsMenu/index.js +19 -5
  30. package/admin/src/pages/App/constants.js +1 -0
  31. package/admin/src/pages/App/index.js +23 -2
  32. package/admin/src/pages/App/reducer.js +8 -1
  33. package/admin/src/pages/App/selectors.js +12 -0
  34. package/admin/src/pages/AuthPage/{utils/forms.js → constants.js} +6 -8
  35. package/admin/src/pages/AuthPage/index.js +17 -5
  36. package/admin/src/pages/InstalledPluginsPage/index.js +10 -7
  37. package/admin/src/pages/MarketplacePage/index.js +11 -6
  38. package/admin/src/pages/ProfilePage/index.js +2 -2
  39. package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +15 -1
  40. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +4 -2
  41. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +4 -2
  42. package/admin/src/pages/SettingsPage/pages/ApiTokens/ProtectedCreateView/index.js +5 -2
  43. package/admin/src/pages/SettingsPage/pages/ApiTokens/ProtectedEditView/index.js +5 -2
  44. package/admin/src/pages/SettingsPage/pages/ApiTokens/ProtectedListView/index.js +11 -6
  45. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +130 -107
  46. package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +5 -3
  47. package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
  48. package/admin/src/pages/SettingsPage/pages/Roles/ProtectedEditPage/index.js +8 -9
  49. package/admin/src/pages/SettingsPage/pages/Roles/ProtectedListPage/index.js +11 -6
  50. package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +4 -2
  51. package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +4 -2
  52. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedCreateView/index.js +5 -2
  53. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedEditView/index.js +5 -2
  54. package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedListView/index.js +11 -6
  55. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -2
  56. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/{utils/layout.js → constants.js} +35 -2
  57. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +43 -10
  58. package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +4 -2
  59. package/admin/src/pages/SettingsPage/pages/Users/ProtectedEditPage/index.js +13 -9
  60. package/admin/src/pages/SettingsPage/pages/Users/ProtectedListPage/index.js +11 -6
  61. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js +4 -2
  62. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/utils/makeWebhookValidationSchema.js +11 -5
  63. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +4 -3
  64. package/admin/src/pages/SettingsPage/pages/Webhooks/ProtectedCreateView/index.js +11 -6
  65. package/admin/src/pages/SettingsPage/pages/Webhooks/ProtectedEditView/index.js +11 -6
  66. package/admin/src/pages/SettingsPage/pages/Webhooks/ProtectedListView/index.js +11 -6
  67. package/admin/src/translations/ca.json +1 -0
  68. package/admin/src/translations/en.json +4 -1
  69. package/admin/src/translations/es.json +5 -0
  70. package/admin/src/translations/fr.json +1 -0
  71. package/build/1386.3b2aa6a7.chunk.js +3 -0
  72. package/build/1799.44d2e264.chunk.js +33 -0
  73. package/build/1970.39a2d75e.chunk.js +1 -0
  74. package/build/3269.1ea0f5a6.chunk.js +1 -0
  75. package/build/{3528.969338e2.chunk.js → 3528.4845cf92.chunk.js} +1 -1
  76. package/build/448.829e1344.chunk.js +1 -0
  77. package/build/{5542.64b623c9.chunk.js → 5542.c62d0daf.chunk.js} +1 -1
  78. package/build/5563.86f9aa9c.chunk.js +79 -0
  79. package/build/{5932.9e1f8f92.chunk.js → 5932.6a23b88c.chunk.js} +1 -1
  80. package/build/{7018.0e8a6297.chunk.js → 7018.98feed67.chunk.js} +1 -1
  81. package/build/7259.fb69d4bf.chunk.js +1 -0
  82. package/build/7394.423886bd.chunk.js +1 -0
  83. package/build/{371.6e4e2c1f.chunk.js → 970.89601f27.chunk.js} +24 -24
  84. package/build/Admin-authenticatedApp.cb649fc1.chunk.js +79 -0
  85. package/build/{Admin_InternalErrorPage.4a6f7b20.chunk.js → Admin_InternalErrorPage.8911cb49.chunk.js} +1 -1
  86. package/build/{Admin_homePage.6cd6c25c.chunk.js → Admin_homePage.be30ef4e.chunk.js} +1 -1
  87. package/build/{Admin_marketplace.c82c1d3c.chunk.js → Admin_marketplace.74a58e20.chunk.js} +8 -8
  88. package/build/Admin_pluginsPage.ce464189.chunk.js +6 -0
  89. package/build/{Admin_profilePage.9d70d609.chunk.js → Admin_profilePage.2131eb68.chunk.js} +2 -2
  90. package/build/Admin_settingsPage.4069bb8a.chunk.js +79 -0
  91. package/build/{Upload_ConfigureTheView.34f449d7.chunk.js → Upload_ConfigureTheView.7a1cb9c9.chunk.js} +1 -1
  92. package/build/admin-app.fea867af.chunk.js +61 -0
  93. package/build/admin-edit-roles-page.3fdd6b9d.chunk.js +267 -0
  94. package/build/admin-edit-users.200551e3.chunk.js +10 -0
  95. package/build/admin-roles-list.e17b00d7.chunk.js +23 -0
  96. package/build/admin-users.3b12dca2.chunk.js +11 -0
  97. package/build/api-tokens-create-page.3dd4e921.chunk.js +1 -0
  98. package/build/api-tokens-edit-page.9a1dd2fa.chunk.js +1 -0
  99. package/build/api-tokens-list-page.a103f526.chunk.js +16 -0
  100. package/build/audit-logs-settings-page.f538490f.chunk.js +1 -0
  101. package/build/ca-json.1fed5d8b.chunk.js +1 -0
  102. package/build/content-manager.c40f5ff9.chunk.js +1088 -0
  103. package/build/{content-type-builder-list-view.c28d33a6.chunk.js → content-type-builder-list-view.a200a358.chunk.js} +3 -3
  104. package/build/content-type-builder.bd1bbff1.chunk.js +166 -0
  105. package/build/{email-settings-page.aee46eaa.chunk.js → email-settings-page.45695daa.chunk.js} +2 -2
  106. package/build/en-json.fb9f6ddd.chunk.js +1 -0
  107. package/build/es-json.42096084.chunk.js +1 -0
  108. package/build/fr-json.69789980.chunk.js +1 -0
  109. package/build/{i18n-settings-page.4bc37a3f.chunk.js → i18n-settings-page.29308d0b.chunk.js} +1 -1
  110. package/build/index.html +1 -1
  111. package/build/main.ee36abd9.js +2927 -0
  112. package/build/review-workflows-settings.93808ae0.chunk.js +110 -0
  113. package/build/{runtime~main.2d0ed226.js → runtime~main.efd966f6.js} +2 -2
  114. package/build/sso-settings-page.0cdb96a6.chunk.js +1 -0
  115. package/build/transfer-tokens-create-page.de14cad4.chunk.js +1 -0
  116. package/build/transfer-tokens-edit-page.4f5e39af.chunk.js +1 -0
  117. package/build/transfer-tokens-list-page.7237443d.chunk.js +16 -0
  118. package/build/{upload-settings.a05aa26c.chunk.js → upload-settings.cb6c14c3.chunk.js} +2 -2
  119. package/build/upload.7e629643.chunk.js +26 -0
  120. package/build/users-advanced-settings-page.750b1f76.chunk.js +9 -0
  121. package/build/{users-email-settings-page.0bc87315.chunk.js → users-email-settings-page.e9bcd865.chunk.js} +1 -1
  122. package/build/{users-providers-settings-page.e88f1ac5.chunk.js → users-providers-settings-page.a94253e9.chunk.js} +1 -1
  123. package/build/{users-roles-settings-page.573a5c3e.chunk.js → users-roles-settings-page.1f505119.chunk.js} +5 -5
  124. package/build/webhook-edit-page.77ef4f1a.chunk.js +33 -0
  125. package/build/webhook-list-page.940a40f1.chunk.js +63 -0
  126. package/ee/admin/constants.js +16 -0
  127. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +1 -1
  128. package/ee/admin/hooks/useLicenseLimits/index.js +4 -2
  129. package/ee/admin/hooks/useSettingsMenu/constants.js +0 -5
  130. package/ee/admin/pages/AuthPage/constants.js +12 -0
  131. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +7 -7
  132. package/ee/admin/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +11 -6
  133. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ProtectedPage.js +20 -0
  134. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +68 -73
  135. package/ee/admin/pages/SettingsPage/pages/SingleSignOn/index.js +16 -12
  136. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/{utils/roleSettingsForm.js → constants.js} +14 -8
  137. package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/EventTableEE.js +8 -9
  138. package/ee/server/constants/webhookEvents.js +5 -0
  139. package/ee/server/controllers/workflows/stages/index.js +1 -1
  140. package/ee/server/services/passport.js +1 -1
  141. package/ee/server/services/review-workflows/entity-service-decorator.js +52 -1
  142. package/ee/server/services/review-workflows/review-workflows.js +4 -1
  143. package/package.json +12 -12
  144. package/server/content-types/User.js +10 -0
  145. package/server/services/permission/permissions-manager/sanitize.js +1 -1
  146. package/server/strategies/api-token.js +9 -5
  147. package/server/strategies/data-transfer.js +9 -5
  148. package/admin/src/content-manager/components/DynamicTable/index.js +0 -163
  149. package/admin/src/content-manager/components/RelationInput/components/Relation.js +0 -53
  150. package/admin/src/content-manager/pages/ListView/FieldPicker/utils/getAllAllowedHeader.js +0 -17
  151. package/admin/src/content-manager/pages/ListView/PaginationFooter/index.js +0 -35
  152. package/admin/src/hooks/useMenu/reducer.js +0 -63
  153. package/admin/src/pages/AuthPage/utils/index.js +0 -2
  154. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +0 -8
  155. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/roleSettingsForm.js +0 -3
  156. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/schema.js +0 -11
  157. package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/stepper.js +0 -17
  158. package/admin/src/permissions/customPermissions.js +0 -1
  159. package/admin/src/permissions/defaultPermissions.js +0 -92
  160. package/admin/src/permissions/index.js +0 -8
  161. package/build/1970.d246745e.chunk.js +0 -1
  162. package/build/3562.e0b1a0b3.chunk.js +0 -50
  163. package/build/5563.8a76bb1d.chunk.js +0 -79
  164. package/build/7259.eac09d4b.chunk.js +0 -1
  165. package/build/7447.3dabc92f.chunk.js +0 -35
  166. package/build/9363.6a7a78fc.chunk.js +0 -33
  167. package/build/Admin-authenticatedApp.4e158a8c.chunk.js +0 -79
  168. package/build/Admin_pluginsPage.5d9d4060.chunk.js +0 -6
  169. package/build/Admin_settingsPage.fefeafa0.chunk.js +0 -79
  170. package/build/admin-app.42c7a752.chunk.js +0 -63
  171. package/build/admin-edit-roles-page.6d62ca0b.chunk.js +0 -267
  172. package/build/admin-edit-users.bce64103.chunk.js +0 -10
  173. package/build/admin-roles-list.81ae57e3.chunk.js +0 -23
  174. package/build/admin-users.1ec50325.chunk.js +0 -11
  175. package/build/api-tokens-create-page.65411a36.chunk.js +0 -1
  176. package/build/api-tokens-edit-page.60312cb6.chunk.js +0 -1
  177. package/build/api-tokens-list-page.36a241c1.chunk.js +0 -16
  178. package/build/audit-logs-settings-page.fca8e2a0.chunk.js +0 -1
  179. package/build/ca-json.43e14418.chunk.js +0 -1
  180. package/build/content-manager.d6e60c78.chunk.js +0 -1094
  181. package/build/content-type-builder.dc0c8745.chunk.js +0 -132
  182. package/build/en-json.f5fa476a.chunk.js +0 -1
  183. package/build/es-json.715b6fd8.chunk.js +0 -1
  184. package/build/fr-json.73494bf5.chunk.js +0 -1
  185. package/build/main.9b423e8b.js +0 -2926
  186. package/build/review-workflows-settings.fc0b59ca.chunk.js +0 -61
  187. package/build/sso-settings-page.52f8d7de.chunk.js +0 -1
  188. package/build/transfer-tokens-create-page.9ec277d7.chunk.js +0 -1
  189. package/build/transfer-tokens-edit-page.fa5ade14.chunk.js +0 -1
  190. package/build/transfer-tokens-list-page.ae9900e4.chunk.js +0 -16
  191. package/build/upload.b0efd607.chunk.js +0 -26
  192. package/build/users-advanced-settings-page.d9e11bab.chunk.js +0 -9
  193. package/build/webhook-edit-page.1e8c9382.chunk.js +0 -31
  194. package/build/webhook-list-page.b2bcb3b6.chunk.js +0 -63
  195. package/ee/admin/pages/AuthPage/utils/forms.js +0 -16
  196. package/ee/admin/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel.js +0 -14
  197. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/CellValue.js +0 -0
  198. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/Media/FileWrapper.js +0 -0
  199. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/Media/index.js +0 -0
  200. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/MultipleMedias.js +0 -0
  201. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/RelationSingle/index.js +0 -0
  202. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/RepeatableComponent/index.js +0 -0
  203. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/SingleComponent/index.js +0 -0
  204. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/index.js +0 -0
  205. /package/admin/src/content-manager/{components/DynamicTable → pages/ListView/components}/CellContent/utils/isSingleRelation.js +0 -0
@@ -26,25 +26,25 @@ import {
26
26
  import { Check } from '@strapi/icons';
27
27
  import isEqual from 'lodash/isEqual';
28
28
  import { useIntl } from 'react-intl';
29
+ import { useSelector } from 'react-redux';
29
30
 
30
31
  import { useRolesList, useSettingsForm } from '../../../../../../admin/src/hooks';
31
- import adminPermissions from '../../../../../../admin/src/permissions';
32
+ import { selectAdminPermissions } from '../../../../../../admin/src/pages/App/selectors';
32
33
  import { getRequestUrl } from '../../../../../../admin/src/utils';
33
34
 
34
35
  import schema from './utils/schema';
35
36
 
36
- const ssoPermissions = {
37
- ...adminPermissions.settings.sso,
38
- readRoles: adminPermissions.settings.roles.read,
39
- };
40
-
41
37
  export const SingleSignOn = () => {
42
38
  const { formatMessage } = useIntl();
39
+ const permissions = useSelector(selectAdminPermissions);
43
40
 
44
41
  const {
45
42
  isLoading: isLoadingForPermissions,
46
43
  allowedActions: { canUpdate, canReadRoles },
47
- } = useRBAC(ssoPermissions);
44
+ } = useRBAC({
45
+ ...permissions.settings.sso,
46
+ readRoles: permissions.settings.roles.read,
47
+ });
48
48
 
49
49
  const [
50
50
  { formErrors, initialData, isLoading, modifiedData, showHeaderButtonLoader },
@@ -247,10 +247,14 @@ export const SingleSignOn = () => {
247
247
  );
248
248
  };
249
249
 
250
- const ProtectedSSO = () => (
251
- <CheckPagePermissions permissions={ssoPermissions.main}>
252
- <SingleSignOn />
253
- </CheckPagePermissions>
254
- );
250
+ const ProtectedSSO = () => {
251
+ const permissions = useSelector(selectAdminPermissions);
252
+
253
+ return (
254
+ <CheckPagePermissions permissions={permissions.settings.sso.main}>
255
+ <SingleSignOn />
256
+ </CheckPagePermissions>
257
+ );
258
+ };
255
259
 
256
260
  export default ProtectedSSO;
@@ -1,6 +1,14 @@
1
- const form = window.strapi.features.isEnabled(window.strapi.features.SSO)
2
- ? [
3
- [
1
+ export const FORM_INITIAL_VALUES = {
2
+ ...(window.strapi.features.isEnabled(window.strapi.features.SSO)
3
+ ? {
4
+ useSSORegistration: true,
5
+ }
6
+ : {}),
7
+ };
8
+
9
+ export const ROLE_LAYOUT = [
10
+ ...(window.strapi.features.isEnabled(window.strapi.features.SSO)
11
+ ? [
4
12
  {
5
13
  intlLabel: {
6
14
  id: 'Settings.permissions.users.form.sso',
@@ -17,8 +25,6 @@ const form = window.strapi.features.isEnabled(window.strapi.features.SSO)
17
25
  xs: 12,
18
26
  },
19
27
  },
20
- ],
21
- ]
22
- : [];
23
-
24
- export default form;
28
+ ]
29
+ : []),
30
+ ];
@@ -2,22 +2,21 @@ import React from 'react';
2
2
 
3
3
  import EventTable from '../../../../../../../../../admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events';
4
4
 
5
- // const events = {
6
- // 'review-workflows': ['workflows.updateEntryStage'],
7
- // };
5
+ const events = {
6
+ 'review-workflows': ['review-workflows.updateEntryStage'],
7
+ };
8
8
 
9
- // TODO: extend this to support review workflow events once the BE logic is ready
10
- // const getHeaders = () => {
11
- // return [{ id: 'review-workflows.updateEntryStage', defaultMessage: 'Stage Change' }];
12
- // };
9
+ const getHeaders = () => {
10
+ return [{ id: 'review-workflows.updateEntryStage', defaultMessage: 'Stage Change' }];
11
+ };
13
12
 
14
13
  export function EventTableEE() {
15
14
  return (
16
15
  <EventTable.Root>
17
16
  <EventTable.Headers />
18
17
  <EventTable.Body />
19
- {/* <EventTable.Headers getHeaders={getHeaders} />
20
- <EventTable.Body providedEvents={events} /> */}
18
+ <EventTable.Headers getHeaders={getHeaders} />
19
+ <EventTable.Body providedEvents={events} />
21
20
  </EventTable.Root>
22
21
  );
23
22
  }
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ WORKFLOW_UPDATE_STAGE: 'review-workflows.updateEntryStage',
5
+ };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { ApplicationError } = require('@strapi/utils/lib/errors');
3
+ const { ApplicationError } = require('@strapi/utils').errors;
4
4
  const { getService } = require('../../../utils');
5
5
  const { hasReviewWorkflow } = require('../../../utils/review-workflows');
6
6
  const {
@@ -3,7 +3,7 @@
3
3
  // eslint-disable-next-line node/no-extraneous-require
4
4
  const { features } = require('@strapi/strapi/lib/utils/ee');
5
5
 
6
- const { UnauthorizedError } = require('@strapi/utils/lib/errors');
6
+ const { UnauthorizedError } = require('@strapi/utils').errors;
7
7
  const createLocalStrategy = require('../../../server/services/passport/local-strategy');
8
8
  const sso = require('./passport/sso');
9
9
  const { isSsoLocked } = require('../utils/sso-lock');
@@ -2,6 +2,7 @@
2
2
 
3
3
  const { isNil, isNull } = require('lodash/fp');
4
4
  const { ENTITY_STAGE_ATTRIBUTE } = require('../../constants/workflows');
5
+ const { WORKFLOW_UPDATE_STAGE } = require('../../constants/webhookEvents');
5
6
  const { hasReviewWorkflow, getDefaultWorkflow } = require('../../utils/review-workflows');
6
7
 
7
8
  /**
@@ -17,6 +18,25 @@ const getDataWithStage = async (data) => {
17
18
  return data;
18
19
  };
19
20
 
21
+ /**
22
+ * Get the stage information of an entity
23
+ * @param {String} uid
24
+ * @param {Number} id
25
+ * @returns {Object}
26
+ */
27
+ const getEntityStage = async (uid, id) => {
28
+ const entity = await strapi.entityService.findOne(uid, id, {
29
+ populate: {
30
+ [ENTITY_STAGE_ATTRIBUTE]: {
31
+ populate: {
32
+ workflow: true,
33
+ },
34
+ },
35
+ },
36
+ });
37
+ return entity?.[ENTITY_STAGE_ATTRIBUTE] ?? {};
38
+ };
39
+
20
40
  /**
21
41
  * Decorates the entity service with RW business logic
22
42
  * @param {object} service - entity service
@@ -43,9 +63,40 @@ const decorator = (service) => ({
43
63
  const data = { ...opts.data };
44
64
  if (isNull(data[ENTITY_STAGE_ATTRIBUTE])) {
45
65
  delete data[ENTITY_STAGE_ATTRIBUTE];
66
+ return service.update.call(this, uid, entityId, { ...opts, data });
67
+ }
68
+
69
+ const previousStage = await getEntityStage(uid, entityId);
70
+
71
+ const updatedEntity = await service.update.call(this, uid, entityId, { ...opts, data });
72
+ const updatedStage = updatedEntity[ENTITY_STAGE_ATTRIBUTE];
73
+
74
+ if (previousStage?.id && previousStage.id !== updatedStage.id) {
75
+ const model = strapi.getModel(uid);
76
+
77
+ strapi.eventHub.emit(WORKFLOW_UPDATE_STAGE, {
78
+ model: model.modelName,
79
+ uid: model.uid,
80
+ entity: {
81
+ id: entityId,
82
+ },
83
+ workflow: {
84
+ id: previousStage.workflow.id,
85
+ stages: {
86
+ from: {
87
+ id: previousStage.id,
88
+ name: previousStage.name,
89
+ },
90
+ to: {
91
+ id: updatedStage.id,
92
+ name: updatedStage.name,
93
+ },
94
+ },
95
+ },
96
+ });
46
97
  }
47
98
 
48
- return service.update.call(this, uid, entityId, { ...opts, data });
99
+ return updatedEntity;
49
100
  },
50
101
  });
51
102
 
@@ -11,6 +11,7 @@ const { ENTITY_STAGE_ATTRIBUTE } = require('../../constants/workflows');
11
11
 
12
12
  const { getDefaultWorkflow } = require('../../utils/review-workflows');
13
13
  const { persistTables, removePersistedTablesWithSuffix } = require('../../utils/persisted-tables');
14
+ const webhookEvents = require('../../constants/webhookEvents');
14
15
 
15
16
  async function initDefaultWorkflow({ workflowsService, stagesService, strapi }) {
16
17
  const wfCount = await workflowsService.count();
@@ -109,7 +110,9 @@ function persistStagesJoinTables({ strapi }) {
109
110
  }
110
111
 
111
112
  const registerWebhookEvents = async ({ strapi }) =>
112
- strapi.webhookStore.addAllowedEvent('WORKFLOW_UPDATE_STAGE', 'workflow.updateEntryStage');
113
+ Object.entries(webhookEvents).forEach(([eventKey, event]) =>
114
+ strapi.webhookStore.addAllowedEvent(eventKey, event)
115
+ );
113
116
 
114
117
  module.exports = ({ strapi }) => {
115
118
  const workflowsService = getService('workflows', { strapi });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/admin",
3
- "version": "4.11.2",
3
+ "version": "4.11.4",
4
4
  "description": "Strapi Admin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,15 +48,15 @@
48
48
  "@casl/ability": "^5.4.3",
49
49
  "@fingerprintjs/fingerprintjs": "3.4.1",
50
50
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
51
- "@strapi/babel-plugin-switch-ee-ce": "4.11.2",
52
- "@strapi/data-transfer": "4.11.2",
53
- "@strapi/design-system": "1.8.0",
54
- "@strapi/helper-plugin": "4.11.2",
55
- "@strapi/icons": "1.8.0",
56
- "@strapi/permissions": "4.11.2",
57
- "@strapi/provider-audit-logs-local": "4.11.2",
58
- "@strapi/typescript-utils": "4.11.2",
59
- "@strapi/utils": "4.11.2",
51
+ "@strapi/babel-plugin-switch-ee-ce": "4.11.4",
52
+ "@strapi/data-transfer": "4.11.4",
53
+ "@strapi/design-system": "1.8.1",
54
+ "@strapi/helper-plugin": "4.11.4",
55
+ "@strapi/icons": "1.8.1",
56
+ "@strapi/permissions": "4.11.4",
57
+ "@strapi/provider-audit-logs-local": "4.11.4",
58
+ "@strapi/typescript-utils": "4.11.4",
59
+ "@strapi/utils": "4.11.4",
60
60
  "axios": "1.4.0",
61
61
  "babel-loader": "^9.1.2",
62
62
  "babel-plugin-styled-components": "2.1.1",
@@ -145,7 +145,7 @@
145
145
  "glob": "8.0.3",
146
146
  "msw": "1.2.1",
147
147
  "speed-measure-webpack-plugin": "1.5.0",
148
- "webpack-bundle-analyzer": "^4.8.0"
148
+ "webpack-bundle-analyzer": "^4.9.0"
149
149
  },
150
150
  "peerDependencies": {
151
151
  "@strapi/strapi": "^4.3.4"
@@ -163,5 +163,5 @@
163
163
  }
164
164
  }
165
165
  },
166
- "gitHead": "6f7c815c2bbe41dda7d77136eb8df736c028ff67"
166
+ "gitHead": "8d325a695386ab9b578b360bf768cfa25173050f"
167
167
  }
@@ -99,4 +99,14 @@ module.exports = {
99
99
  searchable: false,
100
100
  },
101
101
  },
102
+ config: {
103
+ attributes: {
104
+ resetPasswordToken: {
105
+ hidden: true,
106
+ },
107
+ registrationToken: {
108
+ hidden: true,
109
+ },
110
+ },
111
+ },
102
112
  };
@@ -20,7 +20,7 @@ const {
20
20
  } = require('lodash/fp');
21
21
 
22
22
  const { contentTypes, traverseEntity, sanitize, pipeAsync, traverse } = require('@strapi/utils');
23
- const { removePassword } = require('@strapi/utils/lib/sanitize/visitors');
23
+ const { removePassword } = require('@strapi/utils').sanitize.visitors;
24
24
  const { ADMIN_USER_ALLOWED_FIELDS } = require('../../../domain/user');
25
25
 
26
26
  const {
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const { castArray, isNil } = require('lodash/fp');
4
+ const { differenceInHours, parseISO } = require('date-fns');
4
5
  const { UnauthorizedError, ForbiddenError } = require('@strapi/utils').errors;
5
6
  const constants = require('../services/constants');
6
7
  const { getService } = require('../utils');
@@ -53,11 +54,14 @@ const authenticate = async (ctx) => {
53
54
  }
54
55
  }
55
56
 
56
- // update lastUsedAt
57
- await strapi.query('admin::api-token').update({
58
- where: { id: apiToken.id },
59
- data: { lastUsedAt: currentDate },
60
- });
57
+ // update lastUsedAt if the token has not been used in the last hour
58
+ const hoursSinceLastUsed = differenceInHours(currentDate, parseISO(apiToken.lastUsedAt));
59
+ if (hoursSinceLastUsed >= 1) {
60
+ await strapi.query('admin::api-token').update({
61
+ where: { id: apiToken.id },
62
+ data: { lastUsedAt: currentDate },
63
+ });
64
+ }
61
65
 
62
66
  if (apiToken.type === constants.API_TOKEN_TYPE.CUSTOM) {
63
67
  const ability = await strapi.contentAPI.permissions.engine.generateAbility(
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const { differenceInHours, parseISO } = require('date-fns');
3
4
  const {
4
5
  errors: { UnauthorizedError, ForbiddenError },
5
6
  } = require('@strapi/utils');
@@ -52,11 +53,14 @@ const authenticate = async (ctx) => {
52
53
  }
53
54
  }
54
55
 
55
- // Update token metadata
56
- await strapi.query('admin::transfer-token').update({
57
- where: { id: transferToken.id },
58
- data: { lastUsedAt: currentDate },
59
- });
56
+ // Update token metadata if the token has not been used in the last hour
57
+ const hoursSinceLastUsed = differenceInHours(currentDate, parseISO(transferToken.lastUsedAt));
58
+ if (hoursSinceLastUsed >= 1) {
59
+ await strapi.query('admin::api-token').update({
60
+ where: { id: transferToken.id },
61
+ data: { lastUsedAt: currentDate },
62
+ });
63
+ }
60
64
 
61
65
  // Generate an ability based on the token permissions
62
66
  const ability = await getService('transfer').permission.engine.generateAbility(
@@ -1,163 +0,0 @@
1
- import React, { useMemo } from 'react';
2
-
3
- import { DynamicTable as Table, useStrapiApp } from '@strapi/helper-plugin';
4
- import getReviewWorkflowsColumn from 'ee_else_ce/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn';
5
- import PropTypes from 'prop-types';
6
- import { useIntl } from 'react-intl';
7
- import { useSelector } from 'react-redux';
8
-
9
- import { INJECT_COLUMN_IN_TABLE } from '../../../exposedHooks';
10
- import { selectDisplayedHeaders } from '../../pages/ListView/selectors';
11
- import { getTrad } from '../../utils';
12
-
13
- import BulkActionsBar from './BulkActionsBar';
14
- import { PublicationState } from './CellContent/PublicationState/PublicationState';
15
- import ConfirmDialogDelete from './ConfirmDialogDelete';
16
- import TableRows from './TableRows';
17
-
18
- const DynamicTable = ({
19
- canCreate,
20
- canDelete,
21
- canPublish,
22
- contentTypeName,
23
- action,
24
- isBulkable,
25
- isLoading,
26
- onConfirmDelete,
27
- onConfirmDeleteAll,
28
- onConfirmPublishAll,
29
- onConfirmUnpublishAll,
30
- layout,
31
- rows,
32
- }) => {
33
- const { runHookWaterfall } = useStrapiApp();
34
- const hasDraftAndPublish = layout.contentType.options?.draftAndPublish ?? false;
35
- const { formatMessage } = useIntl();
36
- const displayedHeaders = useSelector(selectDisplayedHeaders);
37
-
38
- const tableHeaders = useMemo(() => {
39
- const headers = runHookWaterfall(INJECT_COLUMN_IN_TABLE, {
40
- displayedHeaders,
41
- layout,
42
- });
43
-
44
- const formattedHeaders = headers.displayedHeaders.map((header) => {
45
- const { fieldSchema, metadatas, name } = header;
46
-
47
- return {
48
- ...header,
49
- metadatas: {
50
- ...metadatas,
51
- label: formatMessage({
52
- id: getTrad(`containers.ListPage.table-headers.${name}`),
53
- defaultMessage: metadatas.label,
54
- }),
55
- },
56
- name: fieldSchema.type === 'relation' ? `${name}.${metadatas.mainField.name}` : name,
57
- };
58
- });
59
-
60
- if (hasDraftAndPublish) {
61
- formattedHeaders.push({
62
- key: '__published_at_temp_key__',
63
- name: 'publishedAt',
64
- fieldSchema: {
65
- type: 'custom',
66
- },
67
- metadatas: {
68
- label: formatMessage({
69
- id: getTrad(`containers.ListPage.table-headers.publishedAt`),
70
- defaultMessage: 'publishedAt',
71
- }),
72
- searchable: false,
73
- sortable: true,
74
- },
75
- cellFormatter({ publishedAt }) {
76
- return <PublicationState isPublished={!!publishedAt} />;
77
- },
78
- });
79
- }
80
-
81
- // this should not exist. Ideally we would use registerHook() similar to what has been done
82
- // in the i18n plugin. In order to do that review-workflows should have been a plugin. In
83
- // a future iteration we need to find a better pattern.
84
-
85
- // In CE this will return null - in EE a column definition including the custom formatting component.
86
- const reviewWorkflowColumn = getReviewWorkflowsColumn(layout);
87
-
88
- if (reviewWorkflowColumn) {
89
- formattedHeaders.push(reviewWorkflowColumn);
90
- }
91
-
92
- return formattedHeaders;
93
- }, [runHookWaterfall, displayedHeaders, layout, hasDraftAndPublish, formatMessage]);
94
-
95
- return (
96
- <Table
97
- components={{ ConfirmDialogDelete }}
98
- contentType={contentTypeName}
99
- action={action}
100
- isLoading={isLoading}
101
- headers={tableHeaders}
102
- onConfirmDelete={onConfirmDelete}
103
- onOpenDeleteAllModalTrackedEvent="willBulkDeleteEntries"
104
- rows={rows}
105
- withBulkActions
106
- withMainAction={(canDelete || canPublish) && isBulkable}
107
- renderBulkActionsBar={({ selectedEntries, clearSelectedEntries }) => (
108
- <BulkActionsBar
109
- showPublish={canPublish && hasDraftAndPublish}
110
- showDelete={canDelete}
111
- onConfirmDeleteAll={onConfirmDeleteAll}
112
- onConfirmPublishAll={onConfirmPublishAll}
113
- onConfirmUnpublishAll={onConfirmUnpublishAll}
114
- selectedEntries={selectedEntries}
115
- clearSelectedEntries={clearSelectedEntries}
116
- />
117
- )}
118
- >
119
- <TableRows
120
- canCreate={canCreate}
121
- canDelete={canDelete}
122
- contentType={layout.contentType}
123
- headers={tableHeaders}
124
- rows={rows}
125
- withBulkActions
126
- withMainAction={canDelete && isBulkable}
127
- />
128
- </Table>
129
- );
130
- };
131
-
132
- DynamicTable.defaultProps = {
133
- action: undefined,
134
- };
135
-
136
- DynamicTable.propTypes = {
137
- canCreate: PropTypes.bool.isRequired,
138
- canDelete: PropTypes.bool.isRequired,
139
- canPublish: PropTypes.bool.isRequired,
140
- contentTypeName: PropTypes.string.isRequired,
141
- action: PropTypes.node,
142
- isBulkable: PropTypes.bool.isRequired,
143
- isLoading: PropTypes.bool.isRequired,
144
- layout: PropTypes.exact({
145
- components: PropTypes.object.isRequired,
146
- contentType: PropTypes.shape({
147
- attributes: PropTypes.object.isRequired,
148
- metadatas: PropTypes.object.isRequired,
149
- layouts: PropTypes.shape({
150
- list: PropTypes.array.isRequired,
151
- }).isRequired,
152
- options: PropTypes.object.isRequired,
153
- settings: PropTypes.object.isRequired,
154
- }).isRequired,
155
- }).isRequired,
156
- onConfirmDelete: PropTypes.func.isRequired,
157
- onConfirmDeleteAll: PropTypes.func.isRequired,
158
- onConfirmPublishAll: PropTypes.func.isRequired,
159
- onConfirmUnpublishAll: PropTypes.func.isRequired,
160
- rows: PropTypes.array.isRequired,
161
- };
162
-
163
- export default DynamicTable;
@@ -1,53 +0,0 @@
1
- import React from 'react';
2
-
3
- import { Flex } from '@strapi/design-system';
4
- import PropTypes from 'prop-types';
5
-
6
- export const Relation = ({
7
- children,
8
- loadMore,
9
- search,
10
- totalNumberOfRelations,
11
- size,
12
- ...props
13
- }) => {
14
- return (
15
- <>
16
- <Flex
17
- paddingBottom={totalNumberOfRelations > 0 ? 3 : 0}
18
- gap={2}
19
- justifyContent="space-between"
20
- alignItems="end"
21
- wrap="wrap"
22
- >
23
- <Flex
24
- direction="column"
25
- alignItems="stretch"
26
- basis={size <= 6 ? '100%' : '70%'}
27
- gap={1}
28
- {...props}
29
- >
30
- {search}
31
- </Flex>
32
-
33
- {loadMore}
34
- </Flex>
35
-
36
- {children}
37
- </>
38
- );
39
- };
40
-
41
- Relation.defaultProps = {
42
- search: undefined,
43
- loadMore: undefined,
44
- totalNumberOfRelations: 0,
45
- };
46
-
47
- Relation.propTypes = {
48
- children: PropTypes.node.isRequired,
49
- search: PropTypes.node,
50
- loadMore: PropTypes.node,
51
- size: PropTypes.number.isRequired,
52
- totalNumberOfRelations: PropTypes.number,
53
- };
@@ -1,17 +0,0 @@
1
- import { checkIfAttributeIsDisplayable } from '../../../../utils';
2
-
3
- const getAllAllowedHeaders = (attributes) => {
4
- const allowedAttributes = Object.keys(attributes).reduce((acc, current) => {
5
- const attribute = attributes[current];
6
-
7
- if (checkIfAttributeIsDisplayable(attribute)) {
8
- acc.push(current);
9
- }
10
-
11
- return acc;
12
- }, []);
13
-
14
- return allowedAttributes.sort();
15
- };
16
-
17
- export default getAllAllowedHeaders;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
-
3
- import { Box, Flex } from '@strapi/design-system';
4
- import { PageSizeURLQuery, PaginationURLQuery } from '@strapi/helper-plugin';
5
- import PropTypes from 'prop-types';
6
-
7
- const PaginationFooter = ({ pagination }) => {
8
- return (
9
- <Box paddingTop={4}>
10
- <Flex alignItems="flex-end" justifyContent="space-between">
11
- <PageSizeURLQuery trackedEvent="willChangeNumberOfEntriesPerPage" />
12
- <PaginationURLQuery pagination={pagination} />
13
- </Flex>
14
- </Box>
15
- );
16
- };
17
-
18
- PaginationFooter.defaultProps = {
19
- pagination: {
20
- pageCount: 0,
21
- pageSize: 10,
22
- total: 0,
23
- },
24
- };
25
-
26
- PaginationFooter.propTypes = {
27
- pagination: PropTypes.shape({
28
- page: PropTypes.number,
29
- pageCount: PropTypes.number,
30
- pageSize: PropTypes.number,
31
- total: PropTypes.number,
32
- }),
33
- };
34
-
35
- export default PaginationFooter;