HEX
Server: LiteSpeed
System: Linux server111.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: lacammxy (848)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //home/lacammxy/public_html/wp-content/themes/Divi/core/code-snippets/app/lib/capabilities.js
// 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);