mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 19:04:38 +00:00
22 lines
566 B
JavaScript
22 lines
566 B
JavaScript
import { get, isEmpty } from 'lodash';
|
|
|
|
const getSettingsMenuLinksPermissions = menu =>
|
|
menu.reduce((acc, current) => {
|
|
const links = get(current, 'links', []);
|
|
|
|
const permissions = links.reduce((acc, current) => {
|
|
// console.log({ c: current });
|
|
let currentPermissions = get(current, 'permissions', null);
|
|
|
|
if (isEmpty(currentPermissions)) {
|
|
return [...acc, null];
|
|
}
|
|
|
|
return [...acc, ...currentPermissions];
|
|
}, []);
|
|
|
|
return [...acc, ...permissions];
|
|
}, []);
|
|
|
|
export default getSettingsMenuLinksPermissions;
|