Checks whether specified account is allowed to manage Cost centers and Projects on hosted scalr account
public static isAllowedAnalyticsOnHostedScalrAccount ( integer $accountId ) : boolean | ||
$accountId | integer | Identifier of the client's account |
return | boolean | Returns true if it is allowed of false otherwise |
/** * Checks whether either it is beta version of interface or not hosted scalr install * * @return boolean Returns true if it is either a beta version of interface or it isn't hosted scalr install */ public function isInterfaceBetaOrNotHostedScalr() { return $this->getHeaderVar('Interface-Beta') || Scalr::isAllowedAnalyticsOnHostedScalrAccount($this->getEnvironment()->clientId); }
/** * Associates cost analytics project with the farm * * It does not perform any actions if cost analytics is disabled * * @param ProjectEntity|string $project The project entity or its identifier * @param bool $ignoreAutomatic optional Should it ignore auto assignment of the default project * @return string Returns identifier of the associated project * @throws InvalidArgumentException * @throws AnalyticsException */ public function setProject($project, $ignoreAutomatic = false) { if (Scalr::getContainer()->analytics->enabled) { if ($project instanceof ProjectEntity) { $projectId = $project->projectId; } else { $projectId = $project; unset($project); } $analytics = Scalr::getContainer()->analytics; if (!$ignoreAutomatic && Scalr::isHostedScalr() && !Scalr::isAllowedAnalyticsOnHostedScalrAccount($this->ClientID)) { //Overrides project with automatic one $projectId = $analytics->usage->autoProject($this->EnvID, $this->ID); } else { if (!empty($projectId)) { //Validates specified project's identifier if (!preg_match('/^[[:xdigit:]-]{36}$/', $projectId)) { throw new InvalidArgumentException(sprintf("Identifier of the cost analytics Project must have valid UUID format. '%s' given.", strip_tags($projectId))); } $project = isset($project) ? $project : $analytics->projects->get($projectId); if (!$project) { throw new AnalyticsException(sprintf("Could not find Project with specified identifier %s.", strip_tags($projectId))); } else { if ($project->ccId !== $this->GetEnvironmentObject()->getPlatformConfigValue(Scalr_Environment::SETTING_CC_ID)) { throw new AnalyticsException(sprintf("Invalid project identifier. Parent Cost center of the Project should correspond to the Environment's cost center.")); } } } else { $projectId = null; } } //Sets project to the farm object only if it has been provided if (isset($projectId)) { $project = isset($project) ? $project : $analytics->projects->get($projectId); $oldProjectId = $this->GetSetting(DBFarm::SETTING_PROJECT_ID); $this->SetSetting(DBFarm::SETTING_PROJECT_ID, $project->projectId); //Server property SERVER_PROPERTIES::FARM_PROJECT_ID should be updated //for all running servers associated with the farm. $this->DB->Execute("\n INSERT `server_properties` (`server_id`, `name`, `value`)\n SELECT s.`server_id`, ? AS `name`, ? AS `value`\n FROM `servers` s\n WHERE s.`farm_id` = ?\n ON DUPLICATE KEY UPDATE `value` = ?\n ", [SERVER_PROPERTIES::FARM_PROJECT_ID, $project->projectId, $this->ID, $project->projectId]); //Cost centre should correspond to Project's CC $this->DB->Execute("\n INSERT `server_properties` (`server_id`, `name`, `value`)\n SELECT s.`server_id`, ? AS `name`, ? AS `value`\n FROM `servers` s\n WHERE s.`farm_id` = ?\n ON DUPLICATE KEY UPDATE `value` = ?\n ", [SERVER_PROPERTIES::ENV_CC_ID, $project->ccId, $this->ID, $project->ccId]); if (empty($oldProjectId)) { $analytics->events->fireAssignProjectEvent($this, $project->projectId); } elseif ($oldProjectId !== $projectId) { $analytics->events->fireReplaceProjectEvent($this, $project->projectId, $oldProjectId); } } } return $projectId; }
/** * Raises onCloudAdd notification event * * @param string $platform A platform name. * @param \Scalr_Environment $environment An environment object which cloud is created in. * @param \Scalr_Account_User $user An user who has created platform. */ public function onCloudAdd($platform, $environment, $user) { $container = \Scalr::getContainer(); $analytics = $container->analytics; //Nothing to do in case analytics is disabled if (!$analytics->enabled) { return; } if (!$environment instanceof \Scalr_Environment) { $environment = \Scalr_Environment::init()->loadById($environment); } $pm = PlatformFactory::NewPlatform($platform); //Check if there are some price for this platform and endpoint url if (($endpointUrl = $pm->hasCloudPrices($environment)) === true) { return; } //Disabled or badly configured environment if ($endpointUrl === false && !in_array($platform, [\SERVER_PLATFORMS::EC2, \SERVER_PLATFORMS::GCE])) { return; } //Send a message to financial admin if there are not any price for this cloud $baseUrl = rtrim($container->config('scalr.endpoint.scheme') . "://" . $container->config('scalr.endpoint.host'), '/'); //Disable notifications for hosted Scalr if (!\Scalr::isAllowedAnalyticsOnHostedScalrAccount($environment->clientId)) { return; } $emails = $this->getFinancialAdminEmails(); //There isn't any financial admin if (empty($emails)) { return; } $emails = array_map(function ($email) { return '<' . trim($email, '<>') . '>'; }, $emails); try { $res = $container->mailer->sendTemplate(SCALR_TEMPLATES_PATH . '/emails/analytics_on_cloud_add.eml.php', ['isPublicCloud' => $platform == \SERVER_PLATFORMS::EC2, 'userEmail' => $user->getEmail(), 'cloudName' => \SERVER_PLATFORMS::GetName($platform), 'linkToPricing' => $baseUrl . '/#/analytics/pricing?platform=' . urlencode($platform) . '&url=' . urlencode($endpointUrl === false ? '' : $analytics->prices->normalizeUrl($endpointUrl))], join(',', $emails)); } catch (\Exception $e) { } }
public function getContext() { $data = array(); if ($this->user) { $data['user'] = array('userId' => $this->user->getId(), 'clientId' => $this->user->getAccountId(), 'userName' => $this->user->getEmail(), 'gravatarHash' => $this->user->getGravatarHash(), 'envId' => $this->getEnvironment() ? $this->getEnvironmentId() : 0, 'envName' => $this->getEnvironment() ? $this->getEnvironment()->name : '', 'envVars' => $this->getEnvironment() ? $this->getEnvironment()->getPlatformConfigValue(Scalr_Environment::SETTING_UI_VARS) : '', 'type' => $this->user->getType()); $envVars = json_decode($data['user']['envVars'], true); $betaMode = $envVars && $envVars['beta'] == 1; if (!$this->user->isAdmin()) { $data['farms'] = $this->db->getAll('SELECT id, name FROM farms WHERE env_id = ? ORDER BY name', array($this->getEnvironmentId())); if ($this->user->getAccountId() != 0) { $data['flags'] = $this->user->getAccount()->getFeaturesList(); $data['user']['userIsTrial'] = $this->user->getAccount()->getSetting(Scalr_Account::SETTING_IS_TRIAL) == '1' ? true : false; } else { $data['flags'] = array(); } $data['flags']['billingExists'] = \Scalr::config('scalr.billing.enabled'); $data['flags']['featureUsersPermissions'] = $this->user->getAccount()->isFeatureEnabled(Scalr_Limits::FEATURE_USERS_PERMISSIONS); $data['flags']['wikiUrl'] = \Scalr::config('scalr.ui.wiki_url'); $data['flags']['supportUrl'] = \Scalr::config('scalr.ui.support_url'); if ($data['flags']['supportUrl'] == '/core/support') { $data['flags']['supportUrl'] .= '?X-Requested-Token=' . Scalr_Session::getInstance()->getToken(); } $data['acl'] = $this->request->getAclRoles()->getAllowedArray(true); if ($this->user->isAccountOwner()) { if (!$this->user->getAccount()->getSetting(Scalr_Account::SETTING_DATE_ENV_CONFIGURED)) { if (count($this->environment->getEnabledPlatforms()) == 0) { $data['flags']['needEnvConfig'] = Scalr_Environment::init()->loadDefault($this->user->getAccountId())->id; } } } $data['environments'] = $this->user->getEnvironments(); if ($this->getEnvironment() && $this->user->isTeamOwner()) { $data['user']['isTeamOwner'] = true; } } $data['platforms'] = array(); $allowedClouds = (array) \Scalr::config('scalr.allowed_clouds'); foreach (SERVER_PLATFORMS::getList() as $platform => $platformName) { if (!in_array($platform, $allowedClouds) || $platform == SERVER_PLATFORMS::UCLOUD && !$this->request->getHeaderVar('Interface-Beta')) { continue; } $data['platforms'][$platform] = array('public' => PlatformFactory::isPublic($platform), 'enabled' => $this->user->isAdmin() ? true : !!$this->environment->isPlatformEnabled($platform), 'name' => $platformName); if (!$this->user->isAdmin()) { if ($platform == SERVER_PLATFORMS::EC2 && $this->environment->status == Scalr_Environment::STATUS_INACTIVE && $this->environment->getPlatformConfigValue('system.auto-disable-reason')) { $data['platforms'][$platform]['config'] = array('autoDisabled' => true); } if (PlatformFactory::isOpenstack($platform) && $data['platforms'][$platform]['enabled']) { $data['platforms'][$platform]['config'] = array(OpenstackPlatformModule::EXT_SECURITYGROUPS_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_SECURITYGROUPS_ENABLED, $this->getEnvironment(), false), OpenstackPlatformModule::EXT_LBAAS_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_LBAAS_ENABLED, $this->getEnvironment(), false), OpenstackPlatformModule::EXT_FLOATING_IPS_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_FLOATING_IPS_ENABLED, $this->getEnvironment(), false), OpenstackPlatformModule::EXT_CINDER_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_CINDER_ENABLED, $this->getEnvironment(), false), OpenstackPlatformModule::EXT_SWIFT_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_SWIFT_ENABLED, $this->getEnvironment(), false)); } } } $data['flags']['uiStorageTime'] = $this->user->getSetting(Scalr_Account_User::SETTING_UI_STORAGE_TIME); $data['flags']['uiStorage'] = $this->user->getVar(Scalr_Account_User::VAR_UI_STORAGE); $data['flags']['allowManageAnalytics'] = (bool) Scalr::isAllowedAnalyticsOnHostedScalrAccount($this->environment->clientId); } if ($this->user) { $data['tags'] = Tag::getAll($this->user->getAccountId()); } $data['flags']['authMode'] = $this->getContainer()->config->get('scalr.auth_mode'); $data['flags']['specialToken'] = Scalr_Session::getInstance()->getToken(); $data['flags']['hostedScalr'] = (bool) Scalr::isHostedScalr(); $data['flags']['analyticsEnabled'] = $this->getContainer()->analytics->enabled; return $data; }
/** * @param int $uiStorageTime optional * @return array */ public function getContext($uiStorageTime = 0) { $data = array(); if ($this->user) { $data['user'] = array('userId' => $this->user->getId(), 'clientId' => $this->user->getAccountId(), 'userName' => $this->user->getEmail(), 'gravatarHash' => $this->user->getGravatarHash(), 'envId' => $this->getEnvironment() ? $this->getEnvironmentId() : 0, 'envName' => $this->getEnvironment() ? $this->getEnvironment()->name : '', 'envVars' => '', 'type' => $this->user->getType(), 'settings' => [Scalr_Account_User::SETTING_UI_TIMEZONE => $this->user->getSetting(Scalr_Account_User::SETTING_UI_TIMEZONE), UserSetting::NAME_UI_ANNOUNCEMENT_TIME => $this->getUser()->getSetting(UserSetting::NAME_UI_ANNOUNCEMENT_TIME)]); if ($this->getEnvironment()) { $data['user']['envVars'] = $this->getEnvironment()->getPlatformConfigValue(Scalr_Environment::SETTING_UI_VARS); } else { if ($this->user->getAccountId()) { $data['user']['envVars'] = $this->user->getAccount()->getSetting(Scalr_Account::SETTING_UI_VARS); } } if ($uiStorageTime > 0 && $uiStorageTime < $this->user->getSetting(Scalr_Account_User::SETTING_UI_STORAGE_TIME) && !Scalr_Session::getInstance()->isVirtual()) { $data['user']['uiStorage'] = $this->user->getVar(Scalr_Account_User::VAR_UI_STORAGE); } $envVars = json_decode($data['user']['envVars'], true); $betaMode = $envVars && $envVars['beta'] == 1; if (!$this->user->isAdmin()) { $data['flags'] = []; if ($this->user->getAccountId() != 0) { $data['user']['userIsTrial'] = $this->user->getAccount()->getSetting(Scalr_Account::SETTING_IS_TRIAL) == '1' ? true : false; } $data['flags']['billingExists'] = \Scalr::config('scalr.billing.enabled'); $data['flags']['showDeprecatedFeatures'] = \Scalr::config('scalr.ui.show_deprecated_features'); $data['acl'] = $this->request->getAclRoles()->getAllowedArray(true); if (!$this->user->isAccountOwner()) { $data['user']['accountOwnerName'] = $this->user->getAccount()->getOwner()->getEmail(); } $data['environments'] = $this->user->getEnvironments(); if ($this->user->isAccountOwner()) { if (!$this->user->getAccount()->getSetting(Scalr_Account::SETTING_DATE_ENV_CONFIGURED)) { $data['flags']['needEnvConfig'] = true; } } if ($this->request->getScope() == 'environment') { $sql = "SELECT id, name FROM farms f WHERE env_id = ? AND " . $this->request->getFarmSqlQuery(); $args = [$this->getEnvironmentId()]; $sql .= " ORDER BY name"; $data['farms'] = $this->db->getAll($sql, $args); if ($this->getEnvironment() && $this->user->isTeamOwner()) { $data['user']['isTeamOwner'] = true; } } } $data['flags']['wikiUrl'] = \Scalr::config('scalr.ui.wiki_url'); $data['flags']['supportUrl'] = \Scalr::config('scalr.ui.support_url'); if ($data['flags']['supportUrl'] == '/core/support') { if ($this->user->isAdmin()) { unset($data['flags']['supportUrl']); } else { $data['flags']['supportUrl'] .= '?X-Requested-Token=' . Scalr_Session::getInstance()->getToken(); } } //OS $data['os'] = []; foreach (Os::find() as $os) { /* @var $os Os */ $data['os'][] = ['id' => $os->id, 'family' => $os->family, 'name' => $os->name, 'generation' => $os->generation, 'version' => $os->version, 'status' => $os->status]; } $data['defaults'] = (new Scalr_Scripting_GlobalVariables($this->user->getAccountId(), $this->getEnvironmentId(true), ScopeInterface::SCOPE_ENVIRONMENT))->getUiDefaults(); $data['platforms'] = []; $allowedClouds = (array) \Scalr::config('scalr.allowed_clouds'); if ($this->user->getAccountId() == 263) { array_push($allowedClouds, SERVER_PLATFORMS::VERIZON); } $platforms = SERVER_PLATFORMS::getList(); if (!($this->request->getHeaderVar('Interface-Beta') || $betaMode)) { $platforms = array_intersect_key($platforms, array_flip($allowedClouds)); } $environment = $this->getEnvironment(); if (!empty($environment)) { $cloudsCredentials = $environment->cloudCredentialsList(array_keys($platforms)); } foreach ($platforms as $platform => $platformName) { if (!in_array($platform, $allowedClouds) && !$this->request->getHeaderVar('Interface-Beta') && !$betaMode) { continue; } $data['platforms'][$platform] = array('public' => PlatformFactory::isPublic($platform), 'enabled' => $this->user->isAdmin() || $this->request->getScope() != 'environment' ? true : isset($cloudsCredentials[$platform]) && $cloudsCredentials[$platform]->isEnabled(), 'name' => $platformName); if (!($this->user->isAdmin() || $this->request->getScope() != 'environment')) { if ($platform == SERVER_PLATFORMS::EC2 && $this->environment->status == Scalr_Environment::STATUS_INACTIVE && $this->environment->getPlatformConfigValue('system.auto-disable-reason')) { $data['platforms'][$platform]['config'] = array('autoDisabled' => true); } if (PlatformFactory::isOpenstack($platform) && $data['platforms'][$platform]['enabled']) { $ccProps = $cloudsCredentials[$platform]->properties; $data['platforms'][$platform]['config'] = [CloudCredentialsProperty::OPENSTACK_EXT_SECURITYGROUPS_ENABLED => $ccProps[CloudCredentialsProperty::OPENSTACK_EXT_SECURITYGROUPS_ENABLED], CloudCredentialsProperty::OPENSTACK_EXT_LBAAS_ENABLED => $ccProps[CloudCredentialsProperty::OPENSTACK_EXT_LBAAS_ENABLED], CloudCredentialsProperty::OPENSTACK_EXT_FLOATING_IPS_ENABLED => $ccProps[CloudCredentialsProperty::OPENSTACK_EXT_FLOATING_IPS_ENABLED], CloudCredentialsProperty::OPENSTACK_EXT_CINDER_ENABLED => $ccProps[CloudCredentialsProperty::OPENSTACK_EXT_CINDER_ENABLED], CloudCredentialsProperty::OPENSTACK_EXT_SWIFT_ENABLED => $ccProps[CloudCredentialsProperty::OPENSTACK_EXT_SWIFT_ENABLED]]; } } } $data['flags']['uiStorageTime'] = $this->user->getSetting(Scalr_Account_User::SETTING_UI_STORAGE_TIME); $data['flags']['uiStorage'] = $this->user->getVar(Scalr_Account_User::VAR_UI_STORAGE); $data['flags']['allowManageAnalytics'] = $this->user->getAccountId() && Scalr::isAllowedAnalyticsOnHostedScalrAccount($this->user->getAccountId()); $data['flags']['hostedScalr'] = (bool) Scalr::isHostedScalr(); $data['flags']['analyticsEnabled'] = $this->getContainer()->analytics->enabled; $data['flags']['apiEnabled'] = (bool) \Scalr::config('scalr.system.api.enabled'); $data['flags']['dnsGlobalEnabled'] = (bool) \Scalr::config('scalr.dns.global.enabled'); $data['flags']['allowBetaEbsTypes'] = SCALR_ID == 'gdp-aws-east'; $data['scope'] = $this->request->getScope(); if ($this->request->getScope() == 'environment') { $governance = new Scalr_Governance($this->getEnvironmentId()); $data['governance'] = $governance->getValues(true); } } if ($this->user) { $data['tags'] = Tag::getAll($this->user->getAccountId()); } $data['flags']['authMode'] = $this->getContainer()->config->get('scalr.auth_mode'); $data['flags']['recaptchaPublicKey'] = $this->getContainer()->config->get('scalr.ui.recaptcha.public_key'); $data['flags']['specialToken'] = Scalr_Session::getInstance()->getToken(); $data['flags']['loginWarning'] = $this->getContainer()->config->get('scalr.ui.login_warning'); return $data; }
public function getContext($uiStorageTime = 0) { $data = array(); if ($this->user) { $data['user'] = array('userId' => $this->user->getId(), 'clientId' => $this->user->getAccountId(), 'userName' => $this->user->getEmail(), 'gravatarHash' => $this->user->getGravatarHash(), 'envId' => $this->getEnvironment() ? $this->getEnvironmentId() : 0, 'envName' => $this->getEnvironment() ? $this->getEnvironment()->name : '', 'envVars' => $this->getEnvironment() ? $this->getEnvironment()->getPlatformConfigValue(Scalr_Environment::SETTING_UI_VARS) : '', 'type' => $this->user->getType(), 'settings' => [Scalr_Account_User::VAR_SSH_CONSOLE_LAUNCHER => $this->user->getVar(Scalr_Account_User::VAR_SSH_CONSOLE_LAUNCHER)]); if ($uiStorageTime > 0 && $uiStorageTime < $this->user->getSetting(Scalr_Account_User::SETTING_UI_STORAGE_TIME) && !Scalr_Session::getInstance()->isVirtual()) { $data['user']['uiStorage'] = $this->user->getVar(Scalr_Account_User::VAR_UI_STORAGE); } $envVars = json_decode($data['user']['envVars'], true); $betaMode = $envVars && $envVars['beta'] == 1; if (!$this->user->isAdmin()) { $data['flags'] = []; if ($this->user->getAccountId() != 0) { $data['user']['userIsTrial'] = $this->user->getAccount()->getSetting(Scalr_Account::SETTING_IS_TRIAL) == '1' ? true : false; } $data['flags']['billingExists'] = \Scalr::config('scalr.billing.enabled'); $data['flags']['showDeprecatedFeatures'] = \Scalr::config('scalr.ui.show_deprecated_features'); $data['flags']['wikiUrl'] = \Scalr::config('scalr.ui.wiki_url'); $data['flags']['supportUrl'] = \Scalr::config('scalr.ui.support_url'); if ($data['flags']['supportUrl'] == '/core/support') { $data['flags']['supportUrl'] .= '?X-Requested-Token=' . Scalr_Session::getInstance()->getToken(); } $data['acl'] = $this->request->getAclRoles()->getAllowedArray(true); if (!$this->user->isAccountOwner()) { $data['user']['accountOwnerName'] = $this->user->getAccount()->getOwner()->getEmail(); } $data['environments'] = $this->user->getEnvironments(); if ($this->user->isAccountOwner()) { if (!$this->user->getAccount()->getSetting(Scalr_Account::SETTING_DATE_ENV_CONFIGURED)) { $data['flags']['needEnvConfig'] = true; } } if ($this->request->getScope() == 'environment') { $sql = 'SELECT id, name FROM farms WHERE env_id = ?'; $args = [$this->getEnvironmentId()]; list($sql, $args) = $this->request->prepareFarmSqlQuery($sql, $args); $sql .= ' ORDER BY name'; $data['farms'] = $this->db->getAll($sql, $args); if ($this->getEnvironment() && $this->user->isTeamOwner()) { $data['user']['isTeamOwner'] = true; } } } //OS $data['os'] = []; foreach (Os::find([['status' => Os::STATUS_ACTIVE]]) as $os) { /* @var $os Os */ $data['os'][] = ['id' => $os->id, 'family' => $os->family, 'name' => $os->name, 'generation' => $os->generation, 'version' => $os->version]; } $data['platforms'] = []; $allowedClouds = (array) \Scalr::config('scalr.allowed_clouds'); foreach (SERVER_PLATFORMS::getList() as $platform => $platformName) { if ($this->user->getAccountId() == 263) { array_push($allowedClouds, SERVER_PLATFORMS::VERIZON); } if (!in_array($platform, $allowedClouds) && !$this->request->getHeaderVar('Interface-Beta')) { continue; } $data['platforms'][$platform] = array('public' => PlatformFactory::isPublic($platform), 'enabled' => $this->user->isAdmin() || $this->request->getScope() != 'environment' ? true : !!$this->environment->isPlatformEnabled($platform), 'name' => $platformName); if (!($this->user->isAdmin() || $this->request->getScope() != 'environment')) { if ($platform == SERVER_PLATFORMS::EC2 && $this->environment->status == Scalr_Environment::STATUS_INACTIVE && $this->environment->getPlatformConfigValue('system.auto-disable-reason')) { $data['platforms'][$platform]['config'] = array('autoDisabled' => true); } if (PlatformFactory::isOpenstack($platform) && $data['platforms'][$platform]['enabled']) { $data['platforms'][$platform]['config'] = array(OpenstackPlatformModule::EXT_SECURITYGROUPS_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_SECURITYGROUPS_ENABLED, $this->getEnvironment(), false), OpenstackPlatformModule::EXT_LBAAS_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_LBAAS_ENABLED, $this->getEnvironment(), false), OpenstackPlatformModule::EXT_FLOATING_IPS_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_FLOATING_IPS_ENABLED, $this->getEnvironment(), false), OpenstackPlatformModule::EXT_CINDER_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_CINDER_ENABLED, $this->getEnvironment(), false), OpenstackPlatformModule::EXT_SWIFT_ENABLED => PlatformFactory::NewPlatform($platform)->getConfigVariable(OpenstackPlatformModule::EXT_SWIFT_ENABLED, $this->getEnvironment(), false)); } } } $data['flags']['uiStorageTime'] = $this->user->getSetting(Scalr_Account_User::SETTING_UI_STORAGE_TIME); $data['flags']['uiStorage'] = $this->user->getVar(Scalr_Account_User::VAR_UI_STORAGE); $data['flags']['allowManageAnalytics'] = (bool) Scalr::isAllowedAnalyticsOnHostedScalrAccount($this->environment->clientId); $data['scope'] = $this->request->getScope(); if ($this->request->getScope() == 'environment') { $governance = new Scalr_Governance($this->getEnvironmentId()); $data['governance'] = $governance->getValues(true); } } if ($this->user) { $data['tags'] = Tag::getAll($this->user->getAccountId()); } $data['flags']['authMode'] = $this->getContainer()->config->get('scalr.auth_mode'); $data['flags']['recaptchaPublicKey'] = $this->getContainer()->config->get('scalr.ui.recaptcha.public_key'); $data['flags']['specialToken'] = Scalr_Session::getInstance()->getToken(); $data['flags']['hostedScalr'] = (bool) Scalr::isHostedScalr(); $data['flags']['analyticsEnabled'] = $this->getContainer()->analytics->enabled; $data['flags']['apiEnabled'] = (bool) \Scalr::config('scalr.system.api.enabled'); return $data; }