module/User/src/Grid/User/Model/Permissions/Model.php
public function checkResource( $resource, $parent = null )
    {
        if ( null === $resource )
        {
            return null;
        }

        if ( $resource instanceof Acl\Resource\ResourceInterface )
        {
            $resource = $resource->getResourceId();
        }

        $acl = $this->getAcl();

        if ( ! $acl->hasResource( $resource ) )
        {
            if ( null === $parent )
            {
                $parent = $this->getParentId( $resource );
            }
            elseif ( $parent instanceof Acl\Resource\ResourceInterface )
            {
                $parent = $parent->getResourceId();
            }

            $parent = $this->checkResource( $parent );
            $acl->addResource( $resource, $parent );
        }

        return $resource;
    }
public function checkResource( $resource, $parent = null )
    {
        if ( null === $resource )
        {
            return null;
        }

        if ( $resource instanceof Acl\Resource\ResourceInterface )
        {
            $resource = $resource->getResourceId();
        }

        $acl = $this->getAcl();

        if ( ! $acl->hasResource( $resource ) )
        {
            if ( null === $parent )
            {
                $parent = $this->getParentId( $resource );
            }
            elseif ( $parent instanceof Acl\Resource\ResourceInterface )
            {
                $parent = $parent->getResourceId();
            }

            $parent = $this->checkResource( $parent );
            $acl->addResource( $resource, $parent );
        }

        return $resource;
    }
public function checkResource ( $ resource , $ parent = null ) { if ( null === $ resource ) { return null ; } if ( $ resource instanceof Acl \ Resource \ ResourceInterface ) { $ resource = $ resource -> getResourceId ( ) ; } $ acl = $ this -> getAcl ( ) ; if ( ! $ acl -> hasResource ( $ resource ) ) { if ( null === $ parent ) { $ parent = $ this -> getParentId ( $ resource ) ; } elseif ( $ parent instanceof Acl \ Resource \ ResourceInterface ) { $ parent = $ parent -> getResourceId ( ) ; } $ parent = $ this -> checkResource ( $ parent ) ; $ acl -> addResource ( $ resource , $ parent ) ; } return $ resource ; }
Check existence of a resource

@param string|\Zend\Permissions\Acl\Resource\ResourceInterface $resource
@return string
Check existence of a resource