Exemple #1
0
 public function hasAccess()
 {
     $enabledPlatforms = $this->getEnvironment()->getEnabledPlatforms();
     if (!in_array(SERVER_PLATFORMS::AZURE, $enabledPlatforms)) {
         throw new Exception('You need to enable Azure platform for current environment');
     }
     return parent::hasAccess();
 }
 public function hasAccess()
 {
     if (parent::hasAccess()) {
         return $this->user->getType() == Scalr_Account_User::TYPE_ACCOUNT_OWNER || $this->user->isTeamOwner() ? true : false;
     } else {
         return false;
     }
 }
Exemple #3
0
 public function hasAccess()
 {
     if (!parent::hasAccess() || !$this->request->isAllowed(Acl::RESOURCE_AWS_RDS)) {
         return false;
     }
     if (!in_array(SERVER_PLATFORMS::EC2, $this->getEnvironment()->getEnabledPlatforms())) {
         throw new Exception("You need to enable RDS platform for current environment");
     }
     return true;
 }
Exemple #4
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_ENVADMINISTRATION_GOVERNANCE);
 }
Exemple #5
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_OPENSTACK_VOLUMES);
 }
Exemple #6
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_ADMINISTRATION_SCRIPTS);
 }
Exemple #7
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_DEPLOYMENTS_SOURCES);
 }
Exemple #8
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_SECURITY_SSH_KEYS);
 }
Exemple #9
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed([Acl::RESOURCE_FARMS, Acl::RESOURCE_TEAM_FARMS, Acl::RESOURCE_OWN_FARMS], Acl::PERM_FARMS_STATISTICS);
 }
Exemple #10
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_FARMS_ROLES);
 }
Exemple #11
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->user->canManageAcl();
 }
Exemple #12
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_AWS_CLOUDWATCH);
 }
Exemple #13
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_DISCOVERY_SERVERS) && $this->request->isAllowed(Acl::RESOURCE_DISCOVERY_SERVERS, Acl::PERM_DISCOVERY_SERVERS_IMPORT);
 }
Exemple #14
0
 /**
  * Get internal request to the controller's action ignoring checking aliases
  *
  * @param   string   $uri
  * @param   array    $parameters
  * @return  mixed    Returns raw response as it is returned by action
  */
 protected function internalRequest($uri, array $parameters = array())
 {
     $aUri = parse_url($uri);
     call_user_func_array(array($this, 'getRequest'), array_merge(array(Scalr_UI_Request::REQUEST_TYPE_UI, null), func_get_args()));
     $path = explode('/', trim($aUri['path'], '/'));
     $method = array_pop($path) . 'Action';
     $subController = ucfirst(array_pop($path));
     $controller = 'Scalr_UI_Controller' . (count($path) ? '_' . join('_', array_map('ucfirst', $path)) : '');
     $c = \Scalr_UI_Controller::loadController($subController, $controller, true);
     $c->{$method}();
     // TODO: use $c->callActionMethod($method);
     $content = Scalr_UI_Response::getInstance()->getResponse();
     $arr = @json_decode($content, true);
     return $arr === null ? $content : $arr;
 }
Exemple #15
0
 public function checkLifeCycle($widgets)
 {
     $result = array();
     foreach ($widgets as $id => $object) {
         $name = str_replace('dashboard.', '', $object['name']);
         try {
             $widget = Scalr_UI_Controller::loadController($name, 'Scalr_UI_Controller_Dashboard_Widget');
         } catch (Exception $e) {
             continue;
         }
         try {
             $result[$id]['widgetContent'] = $widget->getContent($object['params']);
         } catch (ADODB_Exception $e) {
             \Scalr::logException($e);
             $result[$id]['widgetError'] = 'Database error';
         } catch (Exception $e) {
             $result[$id]['widgetError'] = $e->getMessage();
         }
     }
     return $result;
 }
Exemple #16
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_GCE_PERSISTENT_DISKS);
 }
Exemple #17
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_ANALYTICS_ENVIRONMENT);
 }
Exemple #18
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_CLOUDSTACK_PUBLIC_IPS);
 }
Exemple #19
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_SERVICES_RABBITMQ);
 }
Exemple #20
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(\Scalr\Acl\Acl::RESOURCE_ADMINISTRATION_GLOBAL_VARIABLES);
 }
Exemple #21
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_DB_DATABASE_STATUS);
 }
Exemple #22
0
 public function hasAccess()
 {
     return parent::hasAccess() && ($this->user->isAccountSuperAdmin() || $this->request->isAllowed(Acl::RESOURCE_ENV_CLOUDS_ENVIRONMENT));
 }
Exemple #23
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_AWS_ELASTIC_IPS);
 }
Exemple #24
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess();
 }
Exemple #25
0
 public function checkLifeCycle($widgets)
 {
     $result = array();
     foreach ($widgets as $id => $object) {
         $name = str_replace('dashboard.', '', $object['name']);
         try {
             $widget = Scalr_UI_Controller::loadController($name, 'Scalr_UI_Controller_Dashboard_Widget');
         } catch (Exception $e) {
             continue;
         }
         $result[$id] = $widget->getContent($object['params']);
     }
     return $result;
 }
Exemple #26
0
$path = trim(str_replace("?{$_SERVER['QUERY_STRING']}", "", $_SERVER['REQUEST_URI']), '/');
define('SCALR_NOT_CHECK_SESSION', 1);
try {
    $t = microtime(true);
    require "src/prepend.inc.php";
    $pTime = microtime(true) - $t;
    @header("X-Scalr-PTime: {$pTime}");
    $session = Scalr_Session::getInstance();
    try {
        $request = Scalr_UI_Request::initializeInstance(Scalr_UI_Request::REQUEST_TYPE_UI, $session->getUserId(), $session->getEnvironmentId());
    } catch (Exception $e) {
        if ($path == 'guest/logout') {
            // hack
            Scalr_Session::destroy();
            Scalr_UI_Response::getInstance()->setRedirect('/');
            Scalr_UI_Response::getInstance()->sendResponse();
            exit;
        }
        $message = $e->getMessage() . ' <a href="/guest/logout">Click here to login as another user</a>';
        throw new Exception($message);
    }
    if ($session->isAuthenticated()) {
        $session->setEnvironmentId($request->getEnvironment()->id);
    }
    //@session_write_close();
    Scalr_UI_Controller::handleRequest(explode('/', $path), $_REQUEST);
    $totalTime = microtime(true) - $t;
} catch (Exception $e) {
    Scalr_UI_Response::getInstance()->failure($e->getMessage());
    Scalr_UI_Response::getInstance()->sendResponse();
}
Exemple #27
0
 /**
  * {@inheritdoc}
  * @see Scalr_UI_Controller::hasAccess()
  */
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_GCE_SNAPSHOTS);
 }
Exemple #28
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_DB_BACKUPS);
 }
Exemple #29
0
            $possibleCsrf = false;
        }
        if ($possibleCsrf) {
            //Scalr_Session::destroy();
            $response->failure('Your session became invalid. <a href="/guest/logout">Click here to login again</a>', true);
            $response->sendResponse();
        } else {
            $initTime = microtime(true);
            $response->setHeader("X-Scalr-PrependTime", $prependTime - $startTime);
            $response->setHeader("X-Scalr-InitTime", $initTime - $prependTime);
            $response->setHeader("X-Scalr-InitTime1", $time1 - $prependTime);
            $response->setHeader("X-Scalr-InitTime2", $time2 - $prependTime);
            $response->setHeader("X-Scalr-InitTime3", $time3 - $prependTime);
            $response->setHeader("X-Scalr-InitTime4", $time4 - $prependTime);
            $response->setHeader("X-Scalr-InitTime5", $time5 - $prependTime);
            Scalr_UI_Controller::handleRequest(explode('/', $path));
            Scalr_UI_Response::getInstance()->sendResponse();
        }
    } else {
        Scalr_UI_Response::getInstance()->setHeader("X-Scalr-Forbiden", "3: {$_SERVER['HTTP_HOST']}");
        Scalr_UI_Response::getInstance()->setHttpResponseCode(403);
        Scalr_UI_Response::getInstance()->sendResponse();
    }
} catch (ADODB_Exception $e) {
    $logMysqlExcepton($e);
} catch (\Scalr\Exception\MysqlConnectionException $e) {
    $logMysqlExcepton($e);
} catch (\Scalr\Exception\FileNotFoundException $e) {
    Scalr_UI_Response::getInstance()->failure(sprintf("File '%s' not found", $e->getPath()));
    Scalr_UI_Response::getInstance()->setHttpResponseCode(404);
    Scalr_UI_Response::getInstance()->sendResponse();
Exemple #30
0
 public function hasAccess()
 {
     return parent::hasAccess() && $this->request->isAllowed(Acl::RESOURCE_IMAGES_ENVIRONMENT, Acl::PERM_IMAGES_ENVIRONMENT_IMPORT);
 }