public function onNodeAccess(NodeAccessEvent $event)
    {
        $node     = $event->getNode();
        $account  = $event->getAccount();
        $op       = $event->getOperation();
        $access   = $this->siteManager->getAccess();

        if ('create' === $op) {

            // Drupal gave a wrong input, this may happen
            if (!is_string($node) && !$node instanceof NodeInterface) {
                return $this->deny();
            }
            $type = is_string($node) ? $node : $node->bundle();

            // Locked types
            if (in_array($type, $this->typeHandler->getLockedTypes()) && !$account->hasPermission(Access::PERM_CONTENT_GOD)) {
                return $event->deny();
            }

            if ($this->siteManager->hasContext()) {
                $site = $this->siteManager->getContext();

                // Contributor can only create editorial content
                if ($access->userIsContributor($account, $site) && in_array($type, $this->typeHandler->getEditorialTypes())) {
                    return $event->allow();
                }

                // Webmasters can create anything
                if ($access->userIsWebmaster($account, $site) && in_array($type, $this->typeHandler->getAllTypes())) {
                    return $event->allow();
                }
            } else {

                // All user that may manage global content or manage group
                // content may create content outside of a site context, as
                // long as content is editorial (text and media)
                $canManage =
                    $account->hasPermission(Access::PERM_CONTENT_MANAGE_GLOBAL) ||
                    $account->hasPermission(Access::PERM_CONTENT_MANAGE_CORPORATE)
                ;

                if ($canManage && in_array($type, $this->typeHandler->getEditorialTypes())) {
                    return $event->allow();
                }
            }
        } else if (Permission::DELETE === $op) {
            // Locked types
            if (in_array($node->bundle(), $this->typeHandler->getLockedTypes()) && !$account->hasPermission(Access::PERM_CONTENT_GOD)) {
                return $event->deny();
            }
        }

        return $event->ignore();
    }