Returns true if the user is permitted to access the node

@param $action
@param $nodeRef
@param $newData
@param $isRead
@return unknown_type
325246
public function check($action, NodeRef &$nodeRef, &$newData = null, $isRead = false)
    {
        return $this->checkInternal($action, $nodeRef, $newData, false, $isRead);
    }
716723
public function canAccess($controller, $action, $module = null) {
        $module = is_array($module)?null:$module;
        $rights = $this->getRightsFromMap($controller, $action, $module);
        if ('*' == $rights[0]) {
            return true;
        }
        if ('@' == $rights[0]) {
            return !\mpf\WebApp::get()->user()->isGuest();
        }
        $hasRights = false;
        foreach ($rights as $right) {
            $hasRights = $hasRights || \mpf\WebApp::get()->user()->hasRight($right);
        }
        return $hasRights;
    }
682468
public static function hasSecuredAction(AbstractConnector $connector, string $connectorName, string $action)
    {
        //====================================================================//
        // Safety Check - Connector Exists
        if (empty($connector) || empty($action)) {
            return false;
        }
        //====================================================================//
        // Safety Check - Connector Name is Similar
        $profile = $connector->getProfile();
        if (!isset($profile['name']) || (strtolower($connectorName) != strtolower($profile['name']))) {
            return false;
        }
        //====================================================================//
        // Safety Check - Connector Action Exists
        $connectorActions = $connector->getSecuredActions();
        if (!isset($connectorActions[strtolower($action)]) || empty($connectorActions[strtolower($action)])) {
            return false;
        }

        return $connectorActions[strtolower($action)];
    }
1319764
public boolean process(final byte[] newData) {
        if (newData != null) {
            buffer.write(newData);
        }

        boolean done = false;
        while (!done) {
            final int index = buffer.getReaderIndex();
            final State currentState = state;
            state = actions[state.ordinal()].apply(buffer);
            done = state == currentState && buffer.getReaderIndex() == index;
        }

        return state == State.DONE;
    }
262462
public function create(NodeInterface $referenceNode, array $nodeData, $position)
    {
        if (!in_array($position, ['before', 'into', 'after'], true)) {
            throw new \InvalidArgumentException('The position should be one of the following: "before", "into", "after".', 1347133640);
        }
        $nodeType = $this->nodeTypeManager->getNodeType($nodeData['nodeType']);

        if ($nodeType->isOfType('Neos.Neos:Document') && !isset($nodeData['properties']['uriPathSegment']) && isset($nodeData['properties']['title'])) {
            $nodeData['properties']['uriPathSegment'] = $this->nodeUriPathSegmentGenerator->generateUriPathSegment($referenceNode, $nodeData['properties']['title']);
        }

        $proposedNodeName = isset($nodeData['nodeName']) ? $nodeData['nodeName'] : null;
        $nodeData['nodeName'] = $this->nodeService->generateUniqueNodeName($this->getDesignatedParentNode($referenceNode, $position)->getPath(), $proposedNodeName);

        if ($position === 'into') {
            $newNode = $referenceNode->createNode($nodeData['nodeName'], $nodeType);
        } else {
            $parentNode = $referenceNode->getParent();
            $newNode = $parentNode->createNode($nodeData['nodeName'], $nodeType);

            if ($position === 'before') {
                $newNode->moveBefore($referenceNode);
            } else {
                $newNode->moveAfter($referenceNode);
            }
        }

        if (isset($nodeData['properties']) && is_array($nodeData['properties'])) {
            foreach ($nodeData['properties'] as $propertyName => $propertyValue) {
                $newNode->setProperty($propertyName, $propertyValue);
            }
        }

        return $newNode;
    }
438015
public function canAccessAction(string $controllerName, string $action): bool
    {
        if (isset($this->actions[$controllerName][$action])) {
            if (!$this->actions[$controllerName][$action]) {
                return true;
            }

            foreach ($this->actions[$controllerName][$action] as $role) {
                if ($this->hasRoleWithName($role)) {
                    return true;
                }
            }

            return false;
        }

        return $this->canAccessController($controllerName);
    }
801129
private function isChildElementHasStrictKeys(CustomArrayObject $nodeSchema, $nodeData)
    {
        $returnValue = false;

        if (!empty($nodeData) && is_array($nodeData)) {
            $schemaKeys = $nodeSchema->getArrayKeys();
            $dataKeys = count(array_filter(array_keys($nodeData), 'is_string')) ? array_keys($nodeData) : [];
            $returnValue = (bool)array_diff($dataKeys, $schemaKeys);
        }

        return $returnValue;
    }
122900
public function hasAccess(MenuAction $action, common_user_User $user, array $node){

        $resolvedAction = $this->getResolvedAction($action);
        if(!is_null($resolvedAction) && !is_null($user)){
            if($node['type'] = $resolvedAction['context'] || $resolvedAction['context'] == 'resource') {
                foreach($resolvedAction['required'] as $key){
                    if(!array_key_exists($key, $node)){
                        //missing required key
                        return self::ACCESS_UNDEFINED;
                    }
                }
                try {
                    if(AclProxy::hasAccess($user, $resolvedAction['controller'], $resolvedAction['action'], $node)){
                        return self::ACCESS_GRANTED;
                    }
                    return self::ACCESS_DENIED;
                } catch(\Exception $e){

                    \common_Logger::w('Unable to resolve permission for action ' . $action->getId() . ' : ' . $e->getMessage() );
                }
            }
        }
        return self::ACCESS_UNDEFINED;
    }
375764
private boolean ownerCanReadTable(String ownerId, String table) {
        return _internalAuthorizer.hasPermissionById(ownerId, getReadPermission(table));
    }
346105
private function createParsedDocumentData(
        PositionInterface $position,
        bool $isCollection,
        bool $isNull
    ): DocumentDataInterface {
        return new class (
            $position,
            $isCollection,
            $isNull
        ) implements DocumentDataInterface
        {
            /**
             * @var PositionInterface
             */
            private $position;
            /**
             * @var bool
             */
            private $isCollection;

            /**
             * @var bool
             */
            private $isNull;

            /**
             * @param PositionInterface $position
             * @param bool              $isCollection
             * @param bool              $isNull
             */
            public function __construct(
                PositionInterface $position,
                bool $isCollection,
                bool $isNull
            ) {
                $this->position     = $position;
                $this->isCollection = $isCollection;
                $this->isNull       = $isNull;
            }

            /**
             * @inheritdoc
             */
            public function getPosition(): PositionInterface
            {
                return $this->position;
            }

            /**
             * @inheritdoc
             */
            public function isCollection(): bool
            {
                return $this->isCollection;
            }

            /**
             * @inheritdoc
             */
            public function isNull(): bool
            {
                return $this->isNull;
            }
        };
    }
1072328
private function checkAccess(MenuAction $action, array $resourceNodes, array $attributes = [])
    {
        $collection = new ResourceCollection($resourceNodes);
        $collection->setAttributes($attributes);

        if (!$this->actionManager->hasPermission($action, $collection)) {
            throw new ResourceAccessException($collection->getErrorsForDisplay(), $collection->getResources());
        }
    }
958222
function readableNodeToWeb(nodeStream) {
    return new ReadableStream({
        start(controller) {
            nodeStream.pause();
            nodeStream.on('data', chunk => {
                controller.enqueue(chunk);
                nodeStream.pause();
            });
            nodeStream.on('end', () => controller.close());
            nodeStream.on('error', (e) => controller.error(e));
        },
        pull(controller) {
            nodeStream.resume();
        },
        cancel(reason) {
            nodeStream.pause();
        }
    });
}
1306997
static function publishNewUserGroup( $parentNodeIDs, $newGroupAttributes, $isUtf8Encoding = false )
    {
        $newNodeIDs = array();

        if ( !is_array( $newGroupAttributes ) or
             !isset( $newGroupAttributes[ 'name' ] ) or
             empty( $newGroupAttributes[ 'name' ] ) )
        {
            eZDebug::writeWarning( 'Cannot create user group with empty name.', __METHOD__ );
            return $newNodeIDs;
        }
        if ( !is_array( $parentNodeIDs ) or count( $parentNodeIDs ) < 1 )
        {
            eZDebug::writeWarning( 'No one parent node IDs was passed for publishing new group (group name = "' .
                                   $newGroupAttributes[ 'name' ] . '")',
                                   __METHOD__ );
            return $newNodeIDs;
        }

        $ini = eZINI::instance();
        $userGroupClassID = $ini->variable( "UserSettings", "UserGroupClassID" );
        $userCreatorID = $ini->variable( "UserSettings", "UserCreatorID" );
        $defaultSectionID = $ini->variable( "UserSettings", "DefaultSectionID" );

        $userGroupClass = eZContentClass::fetch( $userGroupClassID );
        $contentObject = $userGroupClass->instantiate( $userCreatorID, $defaultSectionID );

        $contentObject->store();

        $contentObjectID = $contentObject->attribute( 'id' );

        reset( $parentNodeIDs );
        $defaultPlacement = current( $parentNodeIDs );
        array_shift( $parentNodeIDs );

        $nodeAssignment = eZNodeAssignment::create( array( 'contentobject_id' => $contentObjectID,
                                                           'contentobject_version' => 1,
                                                           'parent_node' => $defaultPlacement,
                                                           // parent_remote_id in node assignment holds remote id of the tree node,
                                                           // not of the parent location or of the node assignment itself
                                                           'parent_remote_id' => uniqid( 'LDAP_' ),
                                                           'is_main' => 1 ) );
        $nodeAssignment->store();

        foreach( $parentNodeIDs as $parentNodeID )
        {
            $newNodeAssignment = eZNodeAssignment::create( array( 'contentobject_id' => $contentObjectID,
                                                                  'contentobject_version' => 1,
                                                                  'parent_node' => $parentNodeID,
                                                                  // parent_remote_id in node assignment holds remote id of the tree node,
                                                                  // not of the parent location or of the node assignment itself
                                                                  'parent_remote_id' => uniqid( 'LDAP_' ),
                                                                  'is_main' => 0 ) );
            $newNodeAssignment->store();
        }

        $version = $contentObject->version( 1 );
        $version->setAttribute( 'modified', time() );
        $version->setAttribute( 'status', eZContentObjectVersion::STATUS_DRAFT );
        $version->store();

        $contentObjectAttributes = $version->contentObjectAttributes();

        // find ant set 'name' and 'description' attributes (as standard user group class)
        $nameIdentifier = 'name';
        $descIdentifier = 'description';
        $nameContentAttribute = null;
        $descContentAttribute = null;
        foreach( $contentObjectAttributes as $attribute )
        {
            if ( $attribute->attribute( 'contentclass_attribute_identifier' ) == $nameIdentifier )
            {
                $nameContentAttribute = $attribute;
            }
            else if ( $attribute->attribute( 'contentclass_attribute_identifier' ) == $descIdentifier )
            {
                $descContentAttribute = $attribute;
            }
        }
        if ( $nameContentAttribute )
        {
            if ( $isUtf8Encoding )
                $newGroupAttributes[ 'name' ] = utf8_decode( $newGroupAttributes[ 'name' ] );
            $nameContentAttribute->setAttribute( 'data_text', $newGroupAttributes[ 'name' ] );
            $nameContentAttribute->store();
        }
        if ( $descContentAttribute and
             isset( $newGroupAttributes[ 'description' ] ) )
        {
            if ( $isUtf8Encoding )
                $newGroupAttributes[ 'description' ] = utf8_decode( $newGroupAttributes[ 'description' ] );
            $descContentAttribute->setAttribute( 'data_text', $newGroupAttributes[ 'description' ] );
            $descContentAttribute->store();
        }

        $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
                                                                                     'version' => 1 ) );
        $newNodes = eZContentObjectTreeNode::fetchByContentObjectID( $contentObjectID, true, 1 );
        foreach ( $newNodes as $newNode )
        {
            $newNodeIDs[] = $newNode->attribute( 'node_id' );
        }

        return $newNodeIDs;
    }
361700
public function indexNodeTranslation(NodeTranslation $nodeTranslation, $add = false)
    {
        // Retrieve the public NodeVersion
        $publicNodeVersion = $nodeTranslation->getPublicNodeVersion();
        if (is_null($publicNodeVersion)) {
            return false;
        }

        $refPage = $this->getNodeRefPage($publicNodeVersion);
        if ($refPage->isStructureNode()) {
            return true;
        }

        // Only index online NodeTranslations
        if (!$nodeTranslation->isOnline()) {
            return false;
        }

        $node = $nodeTranslation->getNode();
        if ($this->isIndexable($refPage)) {
            // Retrieve the referenced entity from the public NodeVersion
            $page = $publicNodeVersion->getRef($this->em);

            $this->addPageToIndex($nodeTranslation, $node, $publicNodeVersion, $page);
            if ($add) {
                $this->searchProvider->addDocuments($this->documents);
                $this->documents = [];
            }
        }

        return true; // return true even if the page itself should not be indexed. This makes sure its children are being processed (i.e. structured nodes)
    }
1235109
public static function hasAccess($action, $controller, $extension, $parameters = array()) {
        $user = common_session_SessionManager::getSession()->getUser();
        try {
            $resolver  = ActionResolver::getByControllerName($controller, $extension);
            $className = $resolver->getController();
        } catch (ResolverException $e) {
            return false;
        }
        return AclProxy::hasAccess($user, $className, $action, $parameters);
    }
574036
@Override
    public boolean isReadable(Class<?> type, Type genericType,
            Annotation[] annotations, MediaType mediaType) {
        return ODataEntity.isODataEntityType(type);
    }
1365374
protected function ensureStreamDoesNotExist(PbjxEvent $pbjxEvent, NodeRef $nodeRef): void
    {
        $pbjx = $pbjxEvent::getPbjx();
        $message = $pbjxEvent->getMessage();

        $streamId = $this->createStreamId($nodeRef);
        $slice = $pbjx->getEventStore()->getStreamSlice(
            $streamId,
            null,
            1,
            true,
            true,
            $this->createEventStoreContext($message, $streamId)
        );

        if ($slice->count()) {
            throw new NodeAlreadyExists(
                sprintf(
                    'The [%s] with id [%s] already exists so [%s] cannot continue.',
                    $nodeRef->getLabel(),
                    $nodeRef->getId(),
                    $message->generateMessageRef()
                )
            );
        }
    }