/** * @return accessControlScope */ public function getAccessControlScope() { if ($this->accessControl === null) { throw new Exception("No scope because access control is null"); } return $this->accessControl->getScope(); }
public function getFieldValue(accessControl $accessControl) { $scope = $accessControl->getScope(); kApiCache::addExtraField(kApiCache::ECF_COUNTRY, kApiCache::COND_MATCH, $this->getStringValues($scope)); $ip = $scope->getIp(); $ipGeo = kGeoCoderManager::getGeoCoder($this->getGeoCoderType()); return $ipGeo->getCountry($ip); }
public function getFieldValue(accessControl $accessControl) { $scope = $accessControl->getScope(); $metadata = MetadataPeer::retrieveByObject($this->profileId, MetadataObjectType::ENTRY, $scope->getEntryId()); if ($metadata) { return kMetadataManager::parseMetadataValues($metadata, $this->xPath); } return null; }
/** * @return bool */ public function shouldDisableCache() { if (!$this->isInContext()) { return false; } if (!is_array($this->conditions)) { return true; } foreach ($this->conditions as $condition) { if ($condition->shouldDisableCache($this->accessControl->getScope())) { return true; } } return false; }
protected function internalFulfilled(accessControl $accessControl) { $scope = $accessControl->getScope(); $referrer = $scope->getReferrer(); if (!$this->globalWhitelistDomainsAppended && strpos($referrer, "kwidget") === false && kConf::hasParam("global_whitelisted_domains")) { $ks = $scope->getKs(); if (!$ks || !in_array($ks->partner_id, kConf::get('global_whitelisted_domains_exclude'))) { $this->globalWhitelistDomainsAppended = true; $globalWhitelistedDomains = kConf::get("global_whitelisted_domains"); if (!is_array($globalWhitelistedDomains)) { $globalWhitelistedDomains = explode(',', $globalWhitelistedDomains); } foreach ($globalWhitelistedDomains as $globalWhitelistedDomain) { $this->values[] = new kStringValue($globalWhitelistedDomain); } } } kApiCache::addExtraField(kApiCache::ECF_REFERRER, kApiCache::COND_SITE_MATCH, $this->getStringValues($scope)); return parent::internalFulfilled($accessControl); }
/** * @param accessControl $accessControl */ public function __construct(accessControl $accessControl = null) { $scope = null; if ($accessControl) { $this->accessControl = $accessControl; $scope = $accessControl->getScope(); } parent::__construct($scope); $contexts = array(ContextType::PLAY, ContextType::DOWNLOAD); $partnerId = $accessControl ? $accessControl->getPartnerId() : kCurrentContext::$ks_partner_id; $partner = PartnerPeer::retrieveByPK($partnerId); if ($partner) { if ($partner->getRestrictThumbnailByKs()) { $contexts[] = ContextType::THUMBNAIL; } if ($partner->getShouldApplyAccessControlOnEntryMetadata()) { $contexts[] = ContextType::METADATA; } } $this->setContexts($contexts); }
protected function internalFulfilled(accessControl $accessControl) { $scope = $accessControl->getScope(); if (!$scope->getKs() || !$scope->getKs() instanceof ks) { return false; } if ($scope->getKs()->isAdmin()) { return true; } KalturaLog::debug(print_r($this->privileges, true)); foreach ($this->privileges as $privilege) { if (is_object($privilege)) { $privilege = $privilege->getValue(); } KalturaLog::debug("Checking privilege [{$privilege}] with entry [" . $scope->getEntryId() . "]"); if ($scope->getKs()->verifyPrivileges($privilege, $scope->getEntryId())) { KalturaLog::debug("Privilege [{$privilege}] verified"); return true; } } KalturaLog::debug("No privilege verified"); return false; }
public function getFieldValue(accessControl $accessControl) { $this->field->setScope($accessControl->getScope()); return $this->field->getValue(); }
public function getFieldValue(accessControl $accessControl) { $scope = $accessControl->getScope(); kApiCache::addExtraField(kApiCache::ECF_USER_AGENT, kApiCache::COND_REGEX, $this->getStringValues($scope)); return $scope->getUserAgent(); }
public function getFieldValue(accessControl $accessControl) { $scope = $accessControl->getScope(); kApiCache::addExtraField(kApiCache::ECF_IP, kApiCache::COND_IP_RANGE, $this->getStringValues($scope)); return $scope->getIp(); }