<commit_before><?php

class EngineBlock_Corto_Filter_Command_ValidateVoMembership extends EngineBlock_Corto_Filter_Command_Abstract
{
    const VO_NAME_ATTRIBUTE         = 'urn:oid:1.3.6.1.4.1.1076.172.16.31.10.2';

    /**
     * This command may modify the response attributes
     *
     * @return array
     */
    public function getResponseAttributes()
    {
        return $this->_responseAttributes;
    }

    public function execute()
    {
        // @todo determine if we need to go to PEP/PDP
        if ($this->requirePep())
        {
            EngineBlock_ApplicationSingleton::getLog()->debug("Executing PEP decision.");

            $validator = $this->_getValidator();
            $isMember = $validator->isMember(
                $this->_collabPersonId,
                $this->_identityProvider->entityId,
                $this->_serviceProvider->entityId,
                $this->_responseAttributes
            );
            if (!$isMember) {
                $message = "PDP: Access denied.";
                if ($validator->getMessage())
                {
                    $message = $validator->getMessage();
                }
                throw new EngineBlock_Corto_Exception_UserNotMember($message);
            }
        }
    }

    /**
     * @return EngineBlock_VirtualOrganization_Validator
     */
    protected function _getValidator()
    {
        return new EngineBlock_VirtualOrganization_Validator();
    }

    /**
     * @todo Metadata field from SP check !!!!
     *   coin:policy_enforcement_decision_required
     *
     * @return bool
     */
    private function requirePep()
    {
        return true;
    }

}
<commit_msg>Only PDP request when using mock SP.<commit_after><?php

class EngineBlock_Corto_Filter_Command_ValidateVoMembership extends EngineBlock_Corto_Filter_Command_Abstract
{
    const VO_NAME_ATTRIBUTE         = 'urn:oid:1.3.6.1.4.1.1076.20.100.10.10.2';

    /**
     * This command may modify the response attributes
     *
     * @return array
     */
    public function getResponseAttributes()
    {
        return $this->_responseAttributes;
    }

    public function execute()
    {
        // @todo determine if we need to go to PEP/PDP
        if ($this->requirePep())
        {
            EngineBlock_ApplicationSingleton::getLog()->debug("Executing PEP decision.");

            $validator = $this->_getValidator();
            $isMember = $validator->isMember(
                $this->_collabPersonId,
                $this->_identityProvider->entityId,
                $this->_serviceProvider->entityId,
                $this->_responseAttributes
            );
            if (!$isMember) {
                $message = "PDP: Access denied.";
                if ($validator->getMessage())
                {
                    $message = $validator->getMessage();
                }
                throw new EngineBlock_Corto_Exception_UserNotMember($message);
            }
        }
    }

    /**
     * @return EngineBlock_VirtualOrganization_Validator
     */
    protected function _getValidator()
    {
        return new EngineBlock_VirtualOrganization_Validator();
    }

    /**
     * @todo Metadata field from SP check !!!!
     *   coin:policy_enforcement_decision_required
     *
     * @return bool
     */
    private function requirePep()
    {
        if ($this->_serviceProvider == "http://mock-sp") {
            return true;
        }
        return false;
    }

}

{'fraction_non_alphanumeric': 0.10512672811059907, 'fraction_numerical': 0.01152073732718894, 'mean_word_length': 1.8607907742998353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6647284', 'n_tokens_mistral': 963, 'n_tokens_neox': 932, 'n_words': 175}