public function execute() { if (!$this->_collabPersonId) { throw new EngineBlock_Corto_Filter_Command_Exception_PreconditionFailed('Missing collabPersonId'); } // In filter stage we need to take a look at the VO context $vo = false; if (isset($this->_request['__']['VoContextImplicit'])) { $vo = $this->_request['__']['VoContextImplicit']; } else { if (isset($this->_request['__'][EngineBlock_Corto_CoreProxy::VO_CONTEXT_PFX])) { $vo = $this->_request['__'][EngineBlock_Corto_CoreProxy::VO_CONTEXT_PFX]; } } if (!$vo) { return; } $this->_adapter->setVirtualOrganisationContext($vo); // If in VO context, validate the user's membership $validator = new EngineBlock_VirtualOrganization_Validator(); $isMember = $validator->isMember($vo, $this->_collabPersonId, $this->_idpMetadata['EntityId']); if (!$isMember) { throw new EngineBlock_Corto_Exception_UserNotMember("User not a member of VO {$vo}"); } $this->_responseAttributes[self::VO_NAME_ATTRIBUTE] = $vo; }
public function execute() { if (!$this->_collabPersonId) { throw new EngineBlock_Corto_Filter_Command_Exception_PreconditionFailed('Missing collabPersonId'); } if (!$this->_spMetadata['ProvideIsMemberOf']) { return; } if (!isset($this->_responseAttributes[self::URN_IS_MEMBER_OF])) { $this->_responseAttributes[self::URN_IS_MEMBER_OF] = array(); } $groups =& $this->_responseAttributes[self::URN_IS_MEMBER_OF]; $voValidator = new EngineBlock_VirtualOrganization_Validator(); $voCollection = new EngineBlock_VirtualOrganization_Collection(); foreach ($voCollection->load() as $vo) { $isMember = $voValidator->isMember($vo->getId(), $this->_collabPersonId, $this->_idpMetadata["EntityId"]); if ($isMember) { $groups[] = self::URN_VO_PREFIX . $vo->getId(); } } }