mirror of
https://github.com/strapi/strapi.git
synced 2025-07-29 20:10:21 +00:00
Add tests
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
e83e25c298
commit
044c47e732
@ -166,6 +166,7 @@ const LeftMenu = forwardRef(({ version, plugins }, ref) => {
|
|||||||
searchable
|
searchable
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<LeftMenuLinksSection
|
<LeftMenuLinksSection
|
||||||
section="plugins"
|
section="plugins"
|
||||||
name="plugins"
|
name="plugins"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
const generateArrayOfLinks = object => object.map(({ links }) => links).flat();
|
const generateArrayOfLinks = object => object.map(({ links }) => links).flat();
|
||||||
|
|
||||||
const findFirstAllowedEndpoint = menuObject => {
|
const findFirstAllowedEndpoint = menuObject => {
|
||||||
console.log({ menuObject });
|
|
||||||
const arrayOfLinks = generateArrayOfLinks(menuObject);
|
const arrayOfLinks = generateArrayOfLinks(menuObject);
|
||||||
|
|
||||||
const link = arrayOfLinks.find(link => link.isDisplayed === true);
|
const link = arrayOfLinks.find(link => link.isDisplayed === true);
|
||||||
|
@ -1,10 +1,190 @@
|
|||||||
// TODO
|
import findFirstAllowedEndpoint, { generateArrayOfLinks } from '../findFirstAllowedEndpoint';
|
||||||
// import findFirstAllowedEndpoint, { generateArrayOfLinks } from '../findFirstAllowedEndpoint';
|
|
||||||
|
|
||||||
describe('ADMIN | SettingsPage | utils', () => {
|
describe('ADMIN | SettingsPage | utils', () => {
|
||||||
describe('findFirstAllowedEndpoint', () => {
|
describe('findFirstAllowedEndpoint', () => {
|
||||||
it('should', () => {
|
it('should return null if there is no sections', () => {
|
||||||
expect(true).toBe(true);
|
expect(findFirstAllowedEndpoint([])).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return null if all links are hidden', () => {
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
id: 'global',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'global.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'global.test2',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'test.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test2',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
expect(findFirstAllowedEndpoint(data)).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the destination of the first displayed link', () => {
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
id: 'global',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'global.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'global.test2',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'test.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test2',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test3',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test1',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'test1.test',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test2',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test3',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
expect(findFirstAllowedEndpoint(data)).toEqual('test.test2');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('generateArrayOfLinks', () => {
|
||||||
|
it('should return an empty array', () => {
|
||||||
|
expect(generateArrayOfLinks([])).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an array containing all the links', () => {
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
id: 'global',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'global.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'global.test2',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'test.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test2',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test3',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test1',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'test1.test',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test2',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test3',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const expected = [
|
||||||
|
{
|
||||||
|
to: 'global.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'global.test2',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test2',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test3',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test2',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test3',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
expect(generateArrayOfLinks(data)).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import produce from 'immer';
|
import produce from 'immer';
|
||||||
import { set, unset } from 'lodash';
|
import { set } from 'lodash';
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
menu: [],
|
menu: [],
|
||||||
@ -18,11 +18,16 @@ const reducer = (state, action) =>
|
|||||||
['menu', ...checkedPermissions.path.split('.'), 'isDisplayed'],
|
['menu', ...checkedPermissions.path.split('.'), 'isDisplayed'],
|
||||||
checkedPermissions.hasPermission
|
checkedPermissions.hasPermission
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
unset(draftState, ['menu', ...checkedPermissions.path.split('.')]);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Remove the not needed links in each section
|
||||||
|
draftState.menu.forEach((section, sectionIndex) => {
|
||||||
|
draftState.menu[sectionIndex].links = section.links.filter(
|
||||||
|
link => link.isDisplayed === true
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
draftState.isLoading = false;
|
draftState.isLoading = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,91 @@
|
|||||||
describe('ADMIN | SettingsPage | utils', () => {
|
import { SETTINGS_BASE_URL } from '../../../config';
|
||||||
describe('findFirstAllowedEndpoint', () => {
|
import adminPermissions from '../../../permissions';
|
||||||
it('should', () => {
|
import init from '../init';
|
||||||
expect(true).toBe(true);
|
|
||||||
});
|
describe('ADMIN | hooks | useSettingsMenu | init', () => {
|
||||||
|
it('should return the settings menu', () => {
|
||||||
|
const plugins = {
|
||||||
|
upload: {
|
||||||
|
settings: {
|
||||||
|
global: {
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
name: 'media-library',
|
||||||
|
permissions: [
|
||||||
|
{
|
||||||
|
action: 'plugins::upload.settings.read',
|
||||||
|
subject: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
title: { id: 'upload.plugin.name', defaultMessage: 'Media Library' },
|
||||||
|
to: '/settings/media-library',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const initialState = {
|
||||||
|
isLoading: true,
|
||||||
|
menu: [],
|
||||||
|
};
|
||||||
|
const expected = {
|
||||||
|
isLoading: true,
|
||||||
|
menu: [
|
||||||
|
{
|
||||||
|
id: 'global',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
isDisplayed: false,
|
||||||
|
name: 'media-library',
|
||||||
|
permissions: [
|
||||||
|
{
|
||||||
|
action: 'plugins::upload.settings.read',
|
||||||
|
subject: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
title: { id: 'upload.plugin.name', defaultMessage: 'Media Library' },
|
||||||
|
to: '/settings/media-library',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
isDisplayed: false,
|
||||||
|
name: 'webhooks',
|
||||||
|
permissions: [
|
||||||
|
{ action: 'admin::webhooks.create', subject: null },
|
||||||
|
{ action: 'admin::webhooks.read', subject: null },
|
||||||
|
{ action: 'admin::webhooks.update', subject: null },
|
||||||
|
{ action: 'admin::webhooks.delete', subject: null },
|
||||||
|
],
|
||||||
|
title: { id: 'Settings.webhooks.title' },
|
||||||
|
to: '/settings/webhooks',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
title: { id: 'Settings.global' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'permissions',
|
||||||
|
title: 'Settings.permissions',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
title: { id: 'Settings.permissions.menu.link.roles.label' },
|
||||||
|
to: `${SETTINGS_BASE_URL}/roles`,
|
||||||
|
name: 'roles',
|
||||||
|
isDisplayed: false,
|
||||||
|
permissions: adminPermissions.settings.roles.main,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: { id: 'Settings.permissions.menu.link.users.label' },
|
||||||
|
// Init the search params directly
|
||||||
|
to: `${SETTINGS_BASE_URL}/users?pageSize=10&page=1&_sort=firstname%3AASC`,
|
||||||
|
name: 'users',
|
||||||
|
isDisplayed: false,
|
||||||
|
permissions: adminPermissions.settings.users.main,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(init(initialState, plugins)).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,116 @@
|
|||||||
describe('ADMIN | SettingsPage | utils', () => {
|
import reducer from '../reducer';
|
||||||
describe('findFirstAllowedEndpoint', () => {
|
|
||||||
it('should', () => {
|
describe('ADMIN | hooks | useSettingsMenu | reducer', () => {
|
||||||
expect(true).toBe(true);
|
describe('DEFAULT_ACTION', () => {
|
||||||
|
it('should return the state', () => {
|
||||||
|
const initialState = {
|
||||||
|
ok: true,
|
||||||
|
};
|
||||||
|
const expected = {
|
||||||
|
ok: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(reducer(initialState, {})).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('CHECK_PERMISSIONS_SUCCEEDED', () => {
|
||||||
|
it('should set the permissions correctly', () => {
|
||||||
|
const initialState = {
|
||||||
|
isLoading: true,
|
||||||
|
menu: [
|
||||||
|
{
|
||||||
|
id: 'global',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'global.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'global.test2',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'test.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test2',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test3',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test1',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'test1.test',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test2',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test1.test3',
|
||||||
|
isDisplayed: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const action = {
|
||||||
|
type: 'CHECK_PERMISSIONS_SUCCEEDED',
|
||||||
|
data: [
|
||||||
|
{ hasPermission: true, path: '1.links.0' },
|
||||||
|
{ hasPermission: true, path: '1.links.1' },
|
||||||
|
{ hasPermission: true, path: '0.links.1' },
|
||||||
|
{ hasPermission: undefined, path: '2.links.0' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const expected = {
|
||||||
|
isLoading: false,
|
||||||
|
menu: [
|
||||||
|
{
|
||||||
|
id: 'global',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'global.test2',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test',
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'test.test',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: 'test.test2',
|
||||||
|
isDisplayed: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'test1',
|
||||||
|
links: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(reducer(initialState, action)).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -33,6 +33,7 @@ const permissions = {
|
|||||||
read: [
|
read: [
|
||||||
{ action: 'admin::users.read', subject: null },
|
{ action: 'admin::users.read', subject: null },
|
||||||
{ action: 'admin::users.update', subject: null },
|
{ action: 'admin::users.update', subject: null },
|
||||||
|
{ action: 'admin::users.delete', subject: null },
|
||||||
],
|
],
|
||||||
update: [{ action: 'admin::users.update', subject: null }],
|
update: [{ action: 'admin::users.update', subject: null }],
|
||||||
},
|
},
|
||||||
|
@ -248,24 +248,24 @@ const data = {
|
|||||||
// },
|
// },
|
||||||
|
|
||||||
// Admin webhooks
|
// Admin webhooks
|
||||||
{
|
// {
|
||||||
action: 'admin::webhooks.create',
|
// action: 'admin::webhooks.create',
|
||||||
subject: null,
|
// subject: null,
|
||||||
fields: null,
|
// fields: null,
|
||||||
conditions: [],
|
// conditions: [],
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
action: 'admin::webhooks.read',
|
// action: 'admin::webhooks.read',
|
||||||
subject: null,
|
// subject: null,
|
||||||
fields: null,
|
// fields: null,
|
||||||
conditions: [],
|
// conditions: [],
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
action: 'admin::webhooks.update',
|
// action: 'admin::webhooks.update',
|
||||||
subject: null,
|
// subject: null,
|
||||||
fields: null,
|
// fields: null,
|
||||||
conditions: [],
|
// conditions: [],
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// action: 'admin::webhooks.delete',
|
// action: 'admin::webhooks.delete',
|
||||||
// subject: null,
|
// subject: null,
|
||||||
@ -274,30 +274,30 @@ const data = {
|
|||||||
// },
|
// },
|
||||||
|
|
||||||
// // Admin users
|
// // Admin users
|
||||||
{
|
// {
|
||||||
action: 'admin::users.create',
|
// action: 'admin::users.create',
|
||||||
subject: null,
|
// subject: null,
|
||||||
fields: null,
|
// fields: null,
|
||||||
conditions: [],
|
// conditions: [],
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// action: 'admin::users.read',
|
// action: 'admin::users.read',
|
||||||
// subject: null,
|
// subject: null,
|
||||||
// fields: null,
|
// fields: null,
|
||||||
// conditions: [],
|
// conditions: [],
|
||||||
// },
|
// },
|
||||||
{
|
// {
|
||||||
action: 'admin::users.update',
|
// action: 'admin::users.update',
|
||||||
subject: null,
|
// subject: null,
|
||||||
fields: null,
|
// fields: null,
|
||||||
conditions: [],
|
// conditions: [],
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
action: 'admin::users.delete',
|
// action: 'admin::users.delete',
|
||||||
subject: null,
|
// subject: null,
|
||||||
fields: null,
|
// fields: null,
|
||||||
conditions: [],
|
// conditions: [],
|
||||||
},
|
// },
|
||||||
|
|
||||||
// // Admin roles
|
// // Admin roles
|
||||||
// {
|
// {
|
||||||
@ -306,12 +306,12 @@ const data = {
|
|||||||
// fields: null,
|
// fields: null,
|
||||||
// conditions: [],
|
// conditions: [],
|
||||||
// },
|
// },
|
||||||
{
|
// {
|
||||||
action: 'admin::roles.read',
|
// action: 'admin::roles.read',
|
||||||
subject: null,
|
// subject: null,
|
||||||
fields: null,
|
// fields: null,
|
||||||
conditions: [],
|
// conditions: [],
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// action: 'admin::roles.update',
|
// action: 'admin::roles.update',
|
||||||
// subject: null,
|
// subject: null,
|
||||||
@ -416,12 +416,12 @@ const data = {
|
|||||||
// fields: null,
|
// fields: null,
|
||||||
// conditions: [],
|
// conditions: [],
|
||||||
// },
|
// },
|
||||||
{
|
// {
|
||||||
action: 'plugins::upload.settings.read',
|
// action: 'plugins::upload.settings.read',
|
||||||
subject: null,
|
// subject: null,
|
||||||
fields: null,
|
// fields: null,
|
||||||
conditions: null,
|
// conditions: null,
|
||||||
},
|
// },
|
||||||
|
|
||||||
// Users-permissions
|
// Users-permissions
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ const shouldCheckPermissions = permissions =>
|
|||||||
!isEmpty(permissions) && permissions.every(perm => !isEmpty(perm.conditions));
|
!isEmpty(permissions) && permissions.every(perm => !isEmpty(perm.conditions));
|
||||||
|
|
||||||
const hasPermissions = async (userPermissions, permissions) => {
|
const hasPermissions = async (userPermissions, permissions) => {
|
||||||
if (!permissions.length) {
|
if (!permissions || !permissions.length) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import ListWrapper from '../ListWrapper';
|
|||||||
import CardControl from '../CardControl';
|
import CardControl from '../CardControl';
|
||||||
|
|
||||||
const SortableList = ({
|
const SortableList = ({
|
||||||
|
allowedActions,
|
||||||
canSelect,
|
canSelect,
|
||||||
data,
|
data,
|
||||||
moveAsset,
|
moveAsset,
|
||||||
@ -54,7 +55,7 @@ const SortableList = ({
|
|||||||
/>
|
/>
|
||||||
</CardControlsWrapper>
|
</CardControlsWrapper>
|
||||||
)}
|
)}
|
||||||
{!noNavigation && (
|
{!noNavigation && allowedActions.canUpdate && (
|
||||||
<CardControlsWrapper className="card-control-wrapper card-control-wrapper-hidden">
|
<CardControlsWrapper className="card-control-wrapper card-control-wrapper-hidden">
|
||||||
<CardControl
|
<CardControl
|
||||||
small
|
small
|
||||||
@ -75,6 +76,9 @@ const SortableList = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
SortableList.defaultProps = {
|
SortableList.defaultProps = {
|
||||||
|
allowedActions: {
|
||||||
|
canUpdate: false,
|
||||||
|
},
|
||||||
canSelect: true,
|
canSelect: true,
|
||||||
data: [],
|
data: [],
|
||||||
moveAsset: () => {},
|
moveAsset: () => {},
|
||||||
@ -85,6 +89,7 @@ SortableList.defaultProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SortableList.propTypes = {
|
SortableList.propTypes = {
|
||||||
|
allowedActions: PropTypes.object,
|
||||||
canSelect: PropTypes.bool,
|
canSelect: PropTypes.bool,
|
||||||
data: PropTypes.array,
|
data: PropTypes.array,
|
||||||
moveAsset: PropTypes.func,
|
moveAsset: PropTypes.func,
|
||||||
|
@ -13,6 +13,7 @@ import ListWrapper from './ListWrapper';
|
|||||||
|
|
||||||
const SelectedAssets = () => {
|
const SelectedAssets = () => {
|
||||||
const {
|
const {
|
||||||
|
allowedActions,
|
||||||
selectedFiles,
|
selectedFiles,
|
||||||
handleFileSelection,
|
handleFileSelection,
|
||||||
handleGoToEditFile,
|
handleGoToEditFile,
|
||||||
@ -39,6 +40,7 @@ const SelectedAssets = () => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
<ListWrapper>
|
<ListWrapper>
|
||||||
<SortableList
|
<SortableList
|
||||||
|
allowedActions={allowedActions}
|
||||||
data={selectedFiles}
|
data={selectedFiles}
|
||||||
moveAsset={moveAsset}
|
moveAsset={moveAsset}
|
||||||
noNavigation={noNavigation}
|
noNavigation={noNavigation}
|
||||||
|
@ -50,7 +50,7 @@ export default strapi => {
|
|||||||
defaultMessage: 'Media Library',
|
defaultMessage: 'Media Library',
|
||||||
},
|
},
|
||||||
name: 'media-library',
|
name: 'media-library',
|
||||||
to: `${strapi.settingsBaseURL}/upload`,
|
to: `${strapi.settingsBaseURL}/media-library`,
|
||||||
Component: () => (
|
Component: () => (
|
||||||
<CheckPagePermissions permissions={pluginPermissions.settings}>
|
<CheckPagePermissions permissions={pluginPermissions.settings}>
|
||||||
<SettingsPage />
|
<SettingsPage />
|
||||||
|
@ -12,24 +12,27 @@ const pluginPermissions = {
|
|||||||
createRole: [{ action: 'plugins::users-permissions.roles.create', subject: null }],
|
createRole: [{ action: 'plugins::users-permissions.roles.create', subject: null }],
|
||||||
readAdvancedSettings: [
|
readAdvancedSettings: [
|
||||||
{ action: 'plugins::users-permissions.advanced-settings.read', subject: null },
|
{ action: 'plugins::users-permissions.advanced-settings.read', subject: null },
|
||||||
// { action: 'plugins::users-permissions.advanced-settings.update', subject: null },
|
{ action: 'plugins::users-permissions.advanced-settings.update', subject: null },
|
||||||
],
|
],
|
||||||
updateAdvancedSettings: [
|
updateAdvancedSettings: [
|
||||||
{ action: 'plugins::users-permissions.advanced-settings.update', subject: null },
|
{ action: 'plugins::users-permissions.advanced-settings.update', subject: null },
|
||||||
],
|
],
|
||||||
readEmailTemplates: [
|
readEmailTemplates: [
|
||||||
{ action: 'plugins::users-permissions.email-templates.read', subject: null },
|
{ action: 'plugins::users-permissions.email-templates.read', subject: null },
|
||||||
// { action: 'plugins::users-permissions.email-templates.update', subject: null },
|
{ action: 'plugins::users-permissions.email-templates.update', subject: null },
|
||||||
],
|
],
|
||||||
updateEmailTemplates: [
|
updateEmailTemplates: [
|
||||||
{ action: 'plugins::users-permissions.email-templates.update', subject: null },
|
{ action: 'plugins::users-permissions.email-templates.update', subject: null },
|
||||||
],
|
],
|
||||||
readProviders: [
|
readProviders: [
|
||||||
{ action: 'plugins::users-permissions.providers.read', subject: null },
|
{ action: 'plugins::users-permissions.providers.read', subject: null },
|
||||||
// { action: 'plugins::users-permissions.providers.update', subject: null },
|
{ action: 'plugins::users-permissions.providers.update', subject: null },
|
||||||
],
|
],
|
||||||
updateProviders: [{ action: 'plugins::users-permissions.providers.update', subject: null }],
|
updateProviders: [{ action: 'plugins::users-permissions.providers.update', subject: null }],
|
||||||
readRoles: [{ action: 'plugins::users-permissions.roles.read', subject: null }],
|
readRoles: [
|
||||||
|
{ action: 'plugins::users-permissions.roles.read', subject: null },
|
||||||
|
{ action: 'plugins::users-permissions.roles.update', subject: null },
|
||||||
|
],
|
||||||
updateRole: [{ action: 'plugins::users-permissions.roles.update', subject: null }],
|
updateRole: [{ action: 'plugins::users-permissions.roles.update', subject: null }],
|
||||||
deleteRole: [{ action: 'plugins::users-permissions.roles.delete', subject: null }],
|
deleteRole: [{ action: 'plugins::users-permissions.roles.delete', subject: null }],
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user