node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
'use strict';
var get = require('lodash/get');
const extendCTBAttributeInitialDataMiddleware = ()=>{
return ({ getState })=>(next)=>(action)=>{
const enhanceAction = ()=>{
// the block here is to catch the error when trying to access the state
// of the ctb when the plugin is not mounted
try {
const store = getState();
const hasi18nEnabled = get(store, [
'content-type-builder_dataManagerProvider',
'modifiedData',
'contentType',
'schema',
'pluginOptions',
'i18n',
'localized'
], false);
if (hasi18nEnabled) {
const pluginOptions = action.options ? {
...action.options.pluginOptions,
i18n: {
localized: true
}
} : {
i18n: {
localized: true
}
};
return next({
...action,
options: {
pluginOptions
}
});
}
return next(action);
} catch (err) {
return next(action);
}
};
if (action.type === 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA' && action.forTarget === 'contentType' && ![
'relation',
'component'
].includes(action.attributeType) && !action.isEditing) {
return enhanceAction();
}
if (action.type === 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA' && action.forTarget === 'contentType' && !action.isEditing) {
return enhanceAction();
}
if ((action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO' || action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA') && action.forTarget === 'contentType') {
return enhanceAction();
}
return next(action);
};
};
exports.extendCTBAttributeInitialDataMiddleware = extendCTBAttributeInitialDataMiddleware;
//# sourceMappingURL=extendCTBAttributeInitialData.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"extendCTBAttributeInitialData.js","sources":["../../../admin/src/middlewares/extendCTBAttributeInitialData.ts"],"sourcesContent":["import get from 'lodash/get';\n\nimport type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBAttributeInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return ({ getState }) =>\n (next) =>\n (action) => {\n const enhanceAction = () => {\n // the block here is to catch the error when trying to access the state\n // of the ctb when the plugin is not mounted\n try {\n const store = getState();\n\n const hasi18nEnabled = get(\n store,\n [\n 'content-type-builder_dataManagerProvider',\n 'modifiedData',\n 'contentType',\n 'schema',\n 'pluginOptions',\n 'i18n',\n 'localized',\n ],\n false\n );\n\n if (hasi18nEnabled) {\n const pluginOptions = action.options\n ? { ...action.options.pluginOptions, i18n: { localized: true } }\n : { i18n: { localized: true } };\n\n return next({\n ...action,\n options: {\n pluginOptions,\n },\n });\n }\n\n return next(action);\n } catch (err) {\n return next(action);\n }\n };\n\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA' &&\n action.forTarget === 'contentType' &&\n !['relation', 'component'].includes(action.attributeType) &&\n !action.isEditing\n ) {\n return enhanceAction();\n }\n\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA' &&\n action.forTarget === 'contentType' &&\n !action.isEditing\n ) {\n return enhanceAction();\n }\n\n if (\n (action.type ===\n 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO' ||\n action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA') &&\n action.forTarget === 'contentType'\n ) {\n return enhanceAction();\n }\n\n return next(action);\n };\n};\n\nexport { extendCTBAttributeInitialDataMiddleware };\n"],"names":["extendCTBAttributeInitialDataMiddleware","getState","next","action","enhanceAction","store","hasi18nEnabled","get","pluginOptions","options","i18n","localized","err","type","forTarget","includes","attributeType","isEditing"],"mappings":";;;;AAKA,MAAMA,uCAGF,GAAA,IAAA;AACF,IAAA,OAAO,CAAC,EAAEC,QAAQ,EAAE,GAClB,CAACC,OACD,CAACC,MAAAA,GAAAA;AACC,gBAAA,MAAMC,aAAgB,GAAA,IAAA;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oFACAV,IAAAA,MAAAA,CAAOU,IAAI,KAAK,gEAA+D,KACjFV,MAAOW,CAAAA,SAAS,KAAK,aACrB,EAAA;oBACA,OAAOV,aAAAA,EAAAA;AACT;AAEA,gBAAA,OAAOF,IAAKC,CAAAA,MAAAA,CAAAA;AACd,aAAA;AACJ;;;;"}

View File

@@ -0,0 +1,59 @@
import get from 'lodash/get';
const extendCTBAttributeInitialDataMiddleware = ()=>{
return ({ getState })=>(next)=>(action)=>{
const enhanceAction = ()=>{
// the block here is to catch the error when trying to access the state
// of the ctb when the plugin is not mounted
try {
const store = getState();
const hasi18nEnabled = get(store, [
'content-type-builder_dataManagerProvider',
'modifiedData',
'contentType',
'schema',
'pluginOptions',
'i18n',
'localized'
], false);
if (hasi18nEnabled) {
const pluginOptions = action.options ? {
...action.options.pluginOptions,
i18n: {
localized: true
}
} : {
i18n: {
localized: true
}
};
return next({
...action,
options: {
pluginOptions
}
});
}
return next(action);
} catch (err) {
return next(action);
}
};
if (action.type === 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA' && action.forTarget === 'contentType' && ![
'relation',
'component'
].includes(action.attributeType) && !action.isEditing) {
return enhanceAction();
}
if (action.type === 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA' && action.forTarget === 'contentType' && !action.isEditing) {
return enhanceAction();
}
if ((action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO' || action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA') && action.forTarget === 'contentType') {
return enhanceAction();
}
return next(action);
};
};
export { extendCTBAttributeInitialDataMiddleware };
//# sourceMappingURL=extendCTBAttributeInitialData.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"extendCTBAttributeInitialData.mjs","sources":["../../../admin/src/middlewares/extendCTBAttributeInitialData.ts"],"sourcesContent":["import get from 'lodash/get';\n\nimport type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBAttributeInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return ({ getState }) =>\n (next) =>\n (action) => {\n const enhanceAction = () => {\n // the block here is to catch the error when trying to access the state\n // of the ctb when the plugin is not mounted\n try {\n const store = getState();\n\n const hasi18nEnabled = get(\n store,\n [\n 'content-type-builder_dataManagerProvider',\n 'modifiedData',\n 'contentType',\n 'schema',\n 'pluginOptions',\n 'i18n',\n 'localized',\n ],\n false\n );\n\n if (hasi18nEnabled) {\n const pluginOptions = action.options\n ? { ...action.options.pluginOptions, i18n: { localized: true } }\n : { i18n: { localized: true } };\n\n return next({\n ...action,\n options: {\n pluginOptions,\n },\n });\n }\n\n return next(action);\n } catch (err) {\n return next(action);\n }\n };\n\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_ATTRIBUTE_DATA_SCHEMA' &&\n action.forTarget === 'contentType' &&\n !['relation', 'component'].includes(action.attributeType) &&\n !action.isEditing\n ) {\n return enhanceAction();\n }\n\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_CUSTOM_FIELD_DATA_SCHEMA' &&\n action.forTarget === 'contentType' &&\n !action.isEditing\n ) {\n return enhanceAction();\n }\n\n if (\n (action.type ===\n 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO' ||\n action.type === 'ContentTypeBuilder/FormModal/RESET_PROPS_AND_SAVE_CURRENT_DATA') &&\n action.forTarget === 'contentType'\n ) {\n return enhanceAction();\n }\n\n return next(action);\n };\n};\n\nexport { extendCTBAttributeInitialDataMiddleware };\n"],"names":["extendCTBAttributeInitialDataMiddleware","getState","next","action","enhanceAction","store","hasi18nEnabled","get","pluginOptions","options","i18n","localized","err","type","forTarget","includes","attributeType","isEditing"],"mappings":";;AAKA,MAAMA,uCAGF,GAAA,IAAA;AACF,IAAA,OAAO,CAAC,EAAEC,QAAQ,EA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ACA,OAAOb,aAAAA,EAAAA;AACT;AAEA,gBAAA,IACE,CAACD,MAAOU,CAAAA,IAAI,KACV,oFACAV,IAAAA,MAAAA,CAAOU,IAAI,KAAK,gEAA+D,KACjFV,MAAOW,CAAAA,SAAS,KAAK,aACrB,EAAA;oBACA,OAAOV,aAAAA,EAAAA;AACT;AAEA,gBAAA,OAAOF,IAAKC,CAAAA,MAAAA,CAAAA;AACd,aAAA;AACJ;;;;"}

View File

@@ -0,0 +1,40 @@
'use strict';
const extendCTBInitialDataMiddleware = ()=>{
return ()=>(next)=>(action)=>{
if (action.type === 'ContentTypeBuilder/FormModal/SET_DATA_TO_EDIT' && action.modalType === 'contentType') {
const i18n = {
localized: false
};
const pluginOptions = action.data.pluginOptions ? {
...action.data.pluginOptions,
i18n
} : {
i18n
};
const data = {
...action.data,
pluginOptions
};
if (action.actionType === 'create') {
return next({
...action,
data
});
}
// Override the action if the pluginOption config does not contain i18n
// In this case we need to set the proper initialData shape
if (!action.data.pluginOptions?.i18n?.localized) {
return next({
...action,
data
});
}
}
// action is not the one we want to override
return next(action);
};
};
exports.extendCTBInitialDataMiddleware = extendCTBInitialDataMiddleware;
//# sourceMappingURL=extendCTBInitialData.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"extendCTBInitialData.js","sources":["../../../admin/src/middlewares/extendCTBInitialData.ts"],"sourcesContent":["import type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return () => (next) => (action) => {\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_DATA_TO_EDIT' &&\n action.modalType === 'contentType'\n ) {\n const i18n = { localized: false };\n\n const pluginOptions = action.data.pluginOptions\n ? { ...action.data.pluginOptions, i18n }\n : { i18n };\n\n const data = { ...action.data, pluginOptions };\n\n if (action.actionType === 'create') {\n return next({ ...action, data });\n }\n\n // Override the action if the pluginOption config does not contain i18n\n // In this case we need to set the proper initialData shape\n if (!action.data.pluginOptions?.i18n?.localized) {\n return next({ ...action, data });\n }\n }\n\n // action is not the one we want to override\n return next(action);\n };\n};\n\nexport { extendCTBInitialDataMiddleware };\n"],"names":["extendCTBInitialDataMiddleware","next","action","type","modalType","i18n","localized","pluginOptions","data","actionType"],"mappings":";;AAGA,MAAMA,8BAGF,GAAA,IAAA;IACF,OAAO,IAAM,CAACC,IAAAA,GAAS,CAACC,MAAAA,GAAAA;AACtB,gBAAA,IACEA,OAAOC,IAAI,KAAK,mDAChBD,MAAOE,CAAAA,SAAS,KAAK,aACrB,EAAA;AACA,oBAAA,MAAMC,IAAO,GAAA;wBAAEC,SAAW,EAAA;AAAM,qBAAA;AAEhC,oBAAA,MAAMC,aAAgBL,GAAAA,MAAAA,CAAOM,IAAI,CAACD,aAAa,GAC3C;wBAAE,GAAGL,MAAAA,CAAOM,IAAI,CAACD,aAAa;AAAEF,wBAAAA;qBAChC,GAAA;AAAEA,wBAAAA;AAAK,qBAAA;AAEX,oBAAA,MAAMG,IAAO,GAAA;AAAE,wBAAA,GAAGN,OAAOM,IAAI;AAAED,wBAAAA;AAAc,qBAAA;oBAE7C,IAAIL,MAAAA,CAAOO,UAAU,KAAK,QAAU,EAAA;AAClC,wBAAA,OAAOR,IAAK,CAAA;AAAE,4BAAA,GAAGC,MAAM;AAAEM,4BAAAA;AAAK,yBAAA,CAAA;AAChC;;;AAIA,oBAAA,IAAI,CAACN,MAAOM,CAAAA,IAAI,CAACD,aAAa,EAAEF,MAAMC,SAAW,EAAA;AAC/C,wBAAA,OAAOL,IAAK,CAAA;AAAE,4BAAA,GAAGC,MAAM;AAAEM,4BAAAA;AAAK,yBAAA,CAAA;AAChC;AACF;;AAGA,gBAAA,OAAOP,IAAKC,CAAAA,MAAAA,CAAAA;AACd,aAAA;AACF;;;;"}

View File

@@ -0,0 +1,38 @@
const extendCTBInitialDataMiddleware = ()=>{
return ()=>(next)=>(action)=>{
if (action.type === 'ContentTypeBuilder/FormModal/SET_DATA_TO_EDIT' && action.modalType === 'contentType') {
const i18n = {
localized: false
};
const pluginOptions = action.data.pluginOptions ? {
...action.data.pluginOptions,
i18n
} : {
i18n
};
const data = {
...action.data,
pluginOptions
};
if (action.actionType === 'create') {
return next({
...action,
data
});
}
// Override the action if the pluginOption config does not contain i18n
// In this case we need to set the proper initialData shape
if (!action.data.pluginOptions?.i18n?.localized) {
return next({
...action,
data
});
}
}
// action is not the one we want to override
return next(action);
};
};
export { extendCTBInitialDataMiddleware };
//# sourceMappingURL=extendCTBInitialData.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"extendCTBInitialData.mjs","sources":["../../../admin/src/middlewares/extendCTBInitialData.ts"],"sourcesContent":["import type { Middleware } from '@reduxjs/toolkit';\nimport type { Store } from '@strapi/admin/strapi-admin';\n\nconst extendCTBInitialDataMiddleware: () => Middleware<\n object,\n ReturnType<Store['getState']>\n> = () => {\n return () => (next) => (action) => {\n if (\n action.type === 'ContentTypeBuilder/FormModal/SET_DATA_TO_EDIT' &&\n action.modalType === 'contentType'\n ) {\n const i18n = { localized: false };\n\n const pluginOptions = action.data.pluginOptions\n ? { ...action.data.pluginOptions, i18n }\n : { i18n };\n\n const data = { ...action.data, pluginOptions };\n\n if (action.actionType === 'create') {\n return next({ ...action, data });\n }\n\n // Override the action if the pluginOption config does not contain i18n\n // In this case we need to set the proper initialData shape\n if (!action.data.pluginOptions?.i18n?.localized) {\n return next({ ...action, data });\n }\n }\n\n // action is not the one we want to override\n return next(action);\n };\n};\n\nexport { extendCTBInitialDataMiddleware };\n"],"names":["extendCTBInitialDataMiddleware","next","action","type","modalType","i18n","localized","pluginOptions","data","actionType"],"mappings":"AAGA,MAAMA,8BAGF,GAAA,IAAA;IACF,OAAO,IAAM,CAACC,IAAAA,GAAS,CAACC,MAAAA,GAAAA;AACtB,gBAAA,IACEA,OAAOC,IAAI,KAAK,mDAChBD,MAAOE,CAAAA,SAAS,KAAK,aACrB,EAAA;AACA,oBAAA,MAAMC,IAAO,GAAA;wBAAEC,SAAW,EAAA;AAAM,qBAAA;AAEhC,oBAAA,MAAMC,aAAgBL,GAAAA,MAAAA,CAAOM,IAAI,CAACD,aAAa,GAC3C;wBAAE,GAAGL,MAAAA,CAAOM,IAAI,CAACD,aAAa;AAAEF,wBAAAA;qBAChC,GAAA;AAAEA,wBAAAA;AAAK,qBAAA;AAEX,oBAAA,MAAMG,IAAO,GAAA;AAAE,wBAAA,GAAGN,OAAOM,IAAI;AAAED,wBAAAA;AAAc,qBAAA;oBAE7C,IAAIL,MAAAA,CAAOO,UAAU,KAAK,QAAU,EAAA;AAClC,wBAAA,OAAOR,IAAK,CAAA;AAAE,4BAAA,GAAGC,MAAM;AAAEM,4BAAAA;AAAK,yBAAA,CAAA;AAChC;;;AAIA,oBAAA,IAAI,CAACN,MAAOM,CAAAA,IAAI,CAACD,aAAa,EAAEF,MAAMC,SAAW,EAAA;AAC/C,wBAAA,OAAOL,IAAK,CAAA;AAAE,4BAAA,GAAGC,MAAM;AAAEM,4BAAAA;AAAK,yBAAA,CAAA;AAChC;AACF;;AAGA,gBAAA,OAAOP,IAAKC,CAAAA,MAAAA,CAAAA;AACd,aAAA;AACF;;;;"}

View File

@@ -0,0 +1,49 @@
'use strict';
var qs = require('qs');
var reactRouterDom = require('react-router-dom');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var qs__namespace = /*#__PURE__*/_interopNamespaceDefault(qs);
const localeMiddleware = (ctx)=>(next)=>(permissions)=>{
const match = reactRouterDom.matchPath('/content-manager/:collectionType/:model?/:id', ctx.pathname);
if (!match) {
return next(permissions);
}
const search = qs__namespace.parse(ctx.search);
if (typeof search !== 'object') {
return next(permissions);
}
if (!('plugins' in search && typeof search.plugins === 'object')) {
return next(permissions);
}
if (!('i18n' in search.plugins && typeof search.plugins.i18n === 'object' && !Array.isArray(search.plugins.i18n))) {
return next(permissions);
}
const { locale } = search.plugins.i18n;
if (typeof locale !== 'string') {
return next(permissions);
}
const revisedPermissions = permissions.filter((permission)=>!permission.properties?.locales || permission.properties.locales.includes(locale));
return next(revisedPermissions);
};
exports.localeMiddleware = localeMiddleware;
//# sourceMappingURL=rbac-middleware.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"rbac-middleware.js","sources":["../../../admin/src/middlewares/rbac-middleware.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport * as qs from 'qs';\nimport { matchPath } from 'react-router-dom';\n\nimport type { RBACMiddleware } from '@strapi/admin/strapi-admin';\n\nconst localeMiddleware: RBACMiddleware = (ctx) => (next) => (permissions) => {\n const match = matchPath('/content-manager/:collectionType/:model?/:id', ctx.pathname);\n\n if (!match) {\n return next(permissions);\n }\n\n const search = qs.parse(ctx.search);\n\n if (typeof search !== 'object') {\n return next(permissions);\n }\n\n if (!('plugins' in search && typeof search.plugins === 'object')) {\n return next(permissions);\n }\n\n if (\n !(\n 'i18n' in search.plugins &&\n typeof search.plugins.i18n === 'object' &&\n !Array.isArray(search.plugins.i18n)\n )\n ) {\n return next(permissions);\n }\n\n const { locale } = search.plugins.i18n;\n\n if (typeof locale !== 'string') {\n return next(permissions);\n }\n\n const revisedPermissions = permissions.filter(\n (permission) =>\n !permission.properties?.locales || permission.properties.locales.includes(locale)\n );\n\n return next(revisedPermissions);\n};\n\nexport { localeMiddleware };\n"],"names":["localeMiddleware","ctx","next","permissions","match","matchPath","pathname","search","qs","parse","plugins","i18n","Array","isArray","locale","revisedPermissions","filter","permission","properties","locales","includes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAMA,gBAAmC,GAAA,CAACC,GAAQ,GAAA,CAACC,OAAS,CAACC,WAAAA,GAAAA;AAC3D,YAAA,MAAMC,KAAQC,GAAAA,wBAAAA,CAAU,8CAAgDJ,EAAAA,GAAAA,CAAIK,QAAQ,CAAA;AAEpF,YAAA,IAAI,CAACF,KAAO,EAAA;AACV,gBAAA,OAAOF,IAAKC,CAAAA,WAAAA,CAAAA;AACd;AAEA,YAAA,MAAMI,MAASC,GAAAA,aAAAA,CAAGC,KAAK,CAACR,IAAIM,MAAM,CAAA;YAElC,IAAI,OAAOA,WAAW,QAAU,EAAA;AAC9B,gBAAA,OAAOL,IAAKC,CAAAA,WAAAA,CAAAA;AACd;YAEA,IAAI,EAAE,SAAaI,IAAAA,MAAAA,IAAU,OAAOA,MAAOG,CAAAA,OAAO,KAAK,QAAO,CAAI,EAAA;AAChE,gBAAA,OAAOR,IAAKC,CAAAA,WAAAA,CAAAA;AACd;YAEA,IACE,EACE,MAAUI,IAAAA,MAAAA,CAAOG,OAAO,IACxB,OAAOH,MAAOG,CAAAA,OAAO,CAACC,IAAI,KAAK,QAC/B,IAAA,CAACC,MAAMC,OAAO,CAACN,OAAOG,OAAO,CAACC,IAAI,CAAA,CAEpC,EAAA;AACA,gBAAA,OAAOT,IAAKC,CAAAA,WAAAA,CAAAA;AACd;AAEA,YAAA,MAAM,EAAEW,MAAM,EAAE,GAAGP,MAAOG,CAAAA,OAAO,CAACC,IAAI;YAEtC,IAAI,OAAOG,WAAW,QAAU,EAAA;AAC9B,gBAAA,OAAOZ,IAAKC,CAAAA,WAAAA,CAAAA;AACd;AAEA,YAAA,MAAMY,qBAAqBZ,WAAYa,CAAAA,MAAM,CAC3C,CAACC,aACC,CAACA,UAAAA,CAAWC,UAAU,EAAEC,WAAWF,UAAWC,CAAAA,UAAU,CAACC,OAAO,CAACC,QAAQ,CAACN,MAAAA,CAAAA,CAAAA;AAG9E,YAAA,OAAOZ,IAAKa,CAAAA,kBAAAA,CAAAA;AACd;;;;"}

View File

@@ -0,0 +1,28 @@
import * as qs from 'qs';
import { matchPath } from 'react-router-dom';
const localeMiddleware = (ctx)=>(next)=>(permissions)=>{
const match = matchPath('/content-manager/:collectionType/:model?/:id', ctx.pathname);
if (!match) {
return next(permissions);
}
const search = qs.parse(ctx.search);
if (typeof search !== 'object') {
return next(permissions);
}
if (!('plugins' in search && typeof search.plugins === 'object')) {
return next(permissions);
}
if (!('i18n' in search.plugins && typeof search.plugins.i18n === 'object' && !Array.isArray(search.plugins.i18n))) {
return next(permissions);
}
const { locale } = search.plugins.i18n;
if (typeof locale !== 'string') {
return next(permissions);
}
const revisedPermissions = permissions.filter((permission)=>!permission.properties?.locales || permission.properties.locales.includes(locale));
return next(revisedPermissions);
};
export { localeMiddleware };
//# sourceMappingURL=rbac-middleware.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"rbac-middleware.mjs","sources":["../../../admin/src/middlewares/rbac-middleware.ts"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport * as qs from 'qs';\nimport { matchPath } from 'react-router-dom';\n\nimport type { RBACMiddleware } from '@strapi/admin/strapi-admin';\n\nconst localeMiddleware: RBACMiddleware = (ctx) => (next) => (permissions) => {\n const match = matchPath('/content-manager/:collectionType/:model?/:id', ctx.pathname);\n\n if (!match) {\n return next(permissions);\n }\n\n const search = qs.parse(ctx.search);\n\n if (typeof search !== 'object') {\n return next(permissions);\n }\n\n if (!('plugins' in search && typeof search.plugins === 'object')) {\n return next(permissions);\n }\n\n if (\n !(\n 'i18n' in search.plugins &&\n typeof search.plugins.i18n === 'object' &&\n !Array.isArray(search.plugins.i18n)\n )\n ) {\n return next(permissions);\n }\n\n const { locale } = search.plugins.i18n;\n\n if (typeof locale !== 'string') {\n return next(permissions);\n }\n\n const revisedPermissions = permissions.filter(\n (permission) =>\n !permission.properties?.locales || permission.properties.locales.includes(locale)\n );\n\n return next(revisedPermissions);\n};\n\nexport { localeMiddleware };\n"],"names":["localeMiddleware","ctx","next","permissions","match","matchPath","pathname","search","qs","parse","plugins","i18n","Array","isArray","locale","revisedPermissions","filter","permission","properties","locales","includes"],"mappings":";;;AAMA,MAAMA,gB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