Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
spawns
/
wp-content1
/
themes
/
Divi
/
core
/
code-snippets
/
app
/
lib
:
capabilities.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
// External dependencies. import { every, get, isArray, isEmpty, } from 'lodash'; // Internal dependencies. import config from './config'; const isAllowedActionPure = (capabilities, action, restrictByDefault = false) => { if (isEmpty(action)) { return true; } const defaultValue = restrictByDefault ? 'off' : 'on'; if (isArray(action)) { return every(action, action => 'on' === get(capabilities, action, defaultValue)); } return 'on' === get(capabilities, action, defaultValue); }; export const isAllowedAction = (...args) => isAllowedActionPure(config.capabilities, ...args);