strapi-cache 1.8.2-rc.1 → 1.8.2-rc.2

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.
@@ -3,12 +3,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const designSystem = require("@strapi/design-system");
5
5
  const reactIntl = require("react-intl");
6
- const index = require("./index-D_ssKKxu.js");
6
+ const admin = require("@strapi/strapi/admin");
7
+ const index = require("./index-EMYe2zF8.js");
7
8
  const react = require("react");
8
9
  const SettingsPage = () => {
9
10
  const { formatMessage } = reactIntl.useIntl();
10
11
  const [keyToUse, setKeyToUse] = react.useState("");
11
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "20px" }, children: [
12
+ return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: index.pluginPermissions.viewSettings, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "20px" }, children: [
12
13
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h1", children: formatMessage({
13
14
  id: "strapi-cache.name",
14
15
  defaultMessage: "Strapi Cache Settings"
@@ -47,6 +48,6 @@ const SettingsPage = () => {
47
48
  }
48
49
  ),
49
50
  /* @__PURE__ */ jsxRuntime.jsx(index.PurgeModal, { buttonText: "Purge All", isPurgeAll: true, isSettingsPage: true })
50
- ] });
51
+ ] }) });
51
52
  };
52
53
  exports.default = SettingsPage;
@@ -73,12 +73,14 @@ const useCacheConfig = (enabled = true) => {
73
73
  };
74
74
  };
75
75
  const pluginPermissions = {
76
- purge: [{ action: "plugin::strapi-cache.purge-cache", subject: null }]
76
+ purge: [{ action: "plugin::strapi-cache.purge-cache", subject: null }],
77
+ viewSettings: [{ action: "plugin::strapi-cache.view-settings", subject: null }]
77
78
  };
78
79
  const useCachePermissions = () => {
79
80
  const { allowedActions } = useRBAC(pluginPermissions);
80
81
  return {
81
82
  canPurgeCache: allowedActions.canPurgeCache,
83
+ canViewSettings: allowedActions.canViewSettings,
82
84
  allowedActions
83
85
  };
84
86
  };
@@ -371,8 +373,8 @@ const index = {
371
373
  },
372
374
  id: "settings",
373
375
  to: `${PLUGIN_ID}/settings`,
374
- Component: () => import("./index-CkLhx2ik.mjs"),
375
- permissions: []
376
+ Component: () => import("./index-DLoQ9I8J.mjs"),
377
+ permissions: pluginPermissions.viewSettings
376
378
  }
377
379
  ]
378
380
  );
@@ -392,5 +394,6 @@ const index = {
392
394
  };
393
395
  export {
394
396
  PurgeModal as P,
395
- index as i
397
+ index as i,
398
+ pluginPermissions as p
396
399
  };
@@ -1,12 +1,13 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Typography, TextInput } from "@strapi/design-system";
3
3
  import { useIntl } from "react-intl";
4
- import { P as PurgeModal } from "./index-BwuX8jJl.mjs";
4
+ import { Page } from "@strapi/strapi/admin";
5
+ import { p as pluginPermissions, P as PurgeModal } from "./index-BovuTRdq.mjs";
5
6
  import { useState } from "react";
6
7
  const SettingsPage = () => {
7
8
  const { formatMessage } = useIntl();
8
9
  const [keyToUse, setKeyToUse] = useState("");
9
- return /* @__PURE__ */ jsxs("div", { style: { padding: "20px" }, children: [
10
+ return /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions.viewSettings, children: /* @__PURE__ */ jsxs("div", { style: { padding: "20px" }, children: [
10
11
  /* @__PURE__ */ jsx(Typography, { variant: "alpha", as: "h1", children: formatMessage({
11
12
  id: "strapi-cache.name",
12
13
  defaultMessage: "Strapi Cache Settings"
@@ -45,7 +46,7 @@ const SettingsPage = () => {
45
46
  }
46
47
  ),
47
48
  /* @__PURE__ */ jsx(PurgeModal, { buttonText: "Purge All", isPurgeAll: true, isSettingsPage: true })
48
- ] });
49
+ ] }) });
49
50
  };
50
51
  export {
51
52
  SettingsPage as default
@@ -74,12 +74,14 @@ const useCacheConfig = (enabled = true) => {
74
74
  };
75
75
  };
76
76
  const pluginPermissions = {
77
- purge: [{ action: "plugin::strapi-cache.purge-cache", subject: null }]
77
+ purge: [{ action: "plugin::strapi-cache.purge-cache", subject: null }],
78
+ viewSettings: [{ action: "plugin::strapi-cache.view-settings", subject: null }]
78
79
  };
79
80
  const useCachePermissions = () => {
80
81
  const { allowedActions } = admin.useRBAC(pluginPermissions);
81
82
  return {
82
83
  canPurgeCache: allowedActions.canPurgeCache,
84
+ canViewSettings: allowedActions.canViewSettings,
83
85
  allowedActions
84
86
  };
85
87
  };
@@ -372,8 +374,8 @@ const index = {
372
374
  },
373
375
  id: "settings",
374
376
  to: `${PLUGIN_ID}/settings`,
375
- Component: () => Promise.resolve().then(() => require("./index-B_MAAg0W.js")),
376
- permissions: []
377
+ Component: () => Promise.resolve().then(() => require("./index-Bdo3ZcJs.js")),
378
+ permissions: pluginPermissions.viewSettings
377
379
  }
378
380
  ]
379
381
  );
@@ -393,3 +395,4 @@ const index = {
393
395
  };
394
396
  exports.PurgeModal = PurgeModal;
395
397
  exports.index = index;
398
+ exports.pluginPermissions = pluginPermissions;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-D_ssKKxu.js");
2
+ const index = require("../_chunks/index-EMYe2zF8.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-BwuX8jJl.mjs";
1
+ import { i } from "../_chunks/index-BovuTRdq.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -1,4 +1,5 @@
1
1
  export declare const useCachePermissions: () => {
2
2
  canPurgeCache: boolean;
3
+ canViewSettings: boolean;
3
4
  allowedActions: import("@strapi/strapi/admin").AllowedActions;
4
5
  };
@@ -3,4 +3,8 @@ export declare const pluginPermissions: {
3
3
  action: string;
4
4
  subject: null;
5
5
  }[];
6
+ viewSettings: {
7
+ action: string;
8
+ subject: null;
9
+ }[];
6
10
  };
@@ -92,6 +92,12 @@ const actions = [
92
92
  displayName: "Purge Cache",
93
93
  uid: "purge-cache",
94
94
  pluginName: "strapi-cache"
95
+ },
96
+ {
97
+ section: "plugins",
98
+ displayName: "View settings",
99
+ uid: "view-settings",
100
+ pluginName: "strapi-cache"
95
101
  }
96
102
  ];
97
103
  const bootstrap = ({ strapi: strapi2 }) => {
@@ -708,7 +714,10 @@ const purgeRoute = [
708
714
  {
709
715
  name: "plugin::content-manager.hasPermissions",
710
716
  config: {
711
- actions: ["plugin::strapi-cache.purge-cache"]
717
+ actions: [
718
+ "plugin::strapi-cache.purge-cache",
719
+ "plugin::strapi-cache.view-settings"
720
+ ]
712
721
  }
713
722
  }
714
723
  ]
@@ -88,6 +88,12 @@ const actions = [
88
88
  displayName: "Purge Cache",
89
89
  uid: "purge-cache",
90
90
  pluginName: "strapi-cache"
91
+ },
92
+ {
93
+ section: "plugins",
94
+ displayName: "View settings",
95
+ uid: "view-settings",
96
+ pluginName: "strapi-cache"
91
97
  }
92
98
  ];
93
99
  const bootstrap = ({ strapi: strapi2 }) => {
@@ -704,7 +710,10 @@ const purgeRoute = [
704
710
  {
705
711
  name: "plugin::content-manager.hasPermissions",
706
712
  config: {
707
- actions: ["plugin::strapi-cache.purge-cache"]
713
+ actions: [
714
+ "plugin::strapi-cache.purge-cache",
715
+ "plugin::strapi-cache.view-settings"
716
+ ]
708
717
  }
709
718
  }
710
719
  ]
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.8.2-rc.1",
2
+ "version": "1.8.2-rc.2",
3
3
  "keywords": [
4
4
  "strapi cache",
5
5
  "strapi rest cache",