当前位置: 首页>>代码示例>>PHP>>正文


PHP Scalr_Account_User::getList方法代码示例

本文整理汇总了PHP中Scalr_Account_User::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Scalr_Account_User::getList方法的具体用法?PHP Scalr_Account_User::getList怎么用?PHP Scalr_Account_User::getList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scalr_Account_User的用法示例。


在下文中一共展示了Scalr_Account_User::getList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildAction

 public function buildAction()
 {
     $this->request->restrictAccess(Acl::RESOURCE_FARMS, Acl::PERM_FARMS_MANAGE);
     $this->request->defineParams(array('farmId' => array('type' => 'int'), 'roleId' => array('type' => 'int')));
     $farmId = $this->getParam('farmId');
     $roleId = $this->getParam('roleId');
     $moduleParams = array('farmId' => $farmId, 'roleId' => $roleId, 'behaviors' => ROLE_BEHAVIORS::GetName(null, true));
     unset($moduleParams['behaviors'][ROLE_BEHAVIORS::CASSANDRA]);
     unset($moduleParams['behaviors'][ROLE_BEHAVIORS::CUSTOM]);
     unset($moduleParams['behaviors'][ROLE_BEHAVIORS::HAPROXY]);
     //platforms list
     $platforms = self::loadController('Platforms')->getEnabledPlatforms();
     if (empty($platforms)) {
         throw new Exception('Before building new farm you need to configure environment and setup cloud credentials');
     }
     //categories list
     $categories = $this->db->GetAll("SELECT c.id, c.name, COUNT(DISTINCT r.id) AS total\n             FROM role_categories c\n             LEFT JOIN roles r ON c.id = r.cat_id AND r.env_id IN(0, ?) AND r.id IN (\n                SELECT role_id\n                FROM role_images\n                WHERE role_id = r.id\n                AND platform IN ('" . implode("','", array_keys($platforms)) . "')\n             )\n             LEFT JOIN roles_queue q ON r.id = q.role_id\n             WHERE c.env_id IN (0, ?)\n             AND q.id IS NULL\n             GROUP BY c.id\n            ", array($this->environment->id, $this->environment->id));
     $moduleParams['categories'] = array();
     foreach ($categories as $g) {
         $moduleParams['categories'][$g['id']] = $g;
     }
     $moduleParams['farmVpcEc2Enabled'] = $this->getEnvironment()->isPlatformEnabled(SERVER_PLATFORMS::EC2);
     if ($moduleParams['farmVpcEc2Enabled']) {
         $moduleParams['farmVpcEc2Locations'] = self::loadController('Platforms')->getCloudLocations(SERVER_PLATFORMS::EC2, false);
     }
     if ($farmId) {
         $c = self::loadController('Builder', 'Scalr_UI_Controller_Farms');
         $moduleParams['farm'] = $c->getFarm2($farmId);
     } else {
         // TODO: remove hack, do better
         $vars = new Scalr_Scripting_GlobalVariables($this->user->getAccountId(), $this->getEnvironmentId(), Scalr_Scripting_GlobalVariables::SCOPE_FARM);
         $moduleParams['farmVariables'] = $vars->getValues();
     }
     $moduleParams['tabs'] = array('vpcrouter', 'dbmsr', 'mongodb', 'mysql', 'scaling', 'network', 'gce', 'cloudfoundry', 'rabbitmq', 'haproxy', 'proxy', 'rds', 'scripting', 'nimbula', 'ec2', 'security', 'devel', 'storage', 'variables', 'advanced');
     if ($this->user->getAccount()->isFeatureEnabled(Scalr_Limits::FEATURE_CHEF)) {
         $moduleParams['tabs'][] = 'chef';
     }
     //deprecated tabs
     $moduleParams['tabs'][] = 'deployments';
     $moduleParams['tabs'][] = 'ebs';
     $moduleParams['tabs'][] = 'params';
     $moduleParams['tabs'][] = 'servicesconfig';
     $conf = $this->getContainer()->config->get('scalr.load_statistics.connections.plotter');
     $moduleParams['tabParams'] = array('farmId' => $farmId, 'farmHash' => $moduleParams['farm'] ? $moduleParams['farm']['farm']['hash'] : '', 'accountId' => $this->environment->getPlatformConfigValue(Ec2PlatformModule::ACCOUNT_ID), 'remoteAddress' => $this->request->getRemoteAddr(), 'monitoringHostUrl' => "{$conf['scheme']}://{$conf['host']}:{$conf['port']}", 'nginx' => array('server_section' => @file_get_contents("../templates/services/nginx/server_section.tpl"), 'server_section_ssl' => @file_get_contents("../templates/services/nginx/server_section_ssl.tpl")));
     // TODO: Features
     $moduleParams['tabParams']['featureRAID'] = $this->user->getAccount()->isFeatureEnabled(Scalr_Limits::FEATURE_RAID);
     $moduleParams['tabParams']['featureMFS'] = $this->user->getAccount()->isFeatureEnabled(Scalr_Limits::FEATURE_MFS);
     $moduleParams['tabParams']['scalr.dns.global.enabled'] = \Scalr::config('scalr.dns.global.enabled');
     $moduleParams['tabParams']['scalr.instances_connection_policy'] = \Scalr::config('scalr.instances_connection_policy');
     $moduleParams['tabParams']['scalr.scalarizr_update.repos'] = array_keys(\Scalr::config('scalr.scalarizr_update.repos'));
     $moduleParams['tabParams']['scalr.scalarizr_update.default_repo'] = \Scalr::config('scalr.scalarizr_update.default_repo');
     $moduleParams['metrics'] = self::loadController('Metrics', 'Scalr_UI_Controller_Scaling')->getList();
     $moduleParams['timezones_list'] = Scalr_Util_DateTime::getTimezones();
     $moduleParams['timezone_default'] = $this->user->getSetting(Scalr_Account_User::SETTING_UI_TIMEZONE);
     if ($moduleParams['farm']['farm']['ownerEditable']) {
         $moduleParams['usersList'] = Scalr_Account_User::getList($this->user->getAccountId());
     }
     $governance = new Scalr_Governance($this->getEnvironmentId());
     $moduleParams['governance'] = $governance->getValues(true);
     $defaultFarmRoleSecurityGroups = array('default');
     if (\Scalr::config('scalr.aws.security_group_name')) {
         $defaultFarmRoleSecurityGroups[] = \Scalr::config('scalr.aws.security_group_name');
     }
     $moduleParams['roleDefaultSettings'] = array('base.keep_scripting_logs_time' => \Scalr::config('scalr.system.scripting.default_instance_log_rotation_period'), 'security_groups.list' => json_encode($defaultFarmRoleSecurityGroups));
     //cost analytics
     if ($this->getContainer()->analytics->enabled && $this->getEnvironment()->getPlatformConfigValue(Scalr_Environment::SETTING_CC_ID)) {
         $costCenter = $this->getContainer()->analytics->ccs->get($this->getEnvironment()->getPlatformConfigValue(Scalr_Environment::SETTING_CC_ID));
         $projects = [];
         if ($costCenter instanceof CostCentreEntity) {
             $projectsIterator = new SharedProjectsFilterIterator($costCenter->getProjects(), $costCenter->ccId, $this->user, $this->getEnvironment());
             foreach ($projectsIterator as $item) {
                 /* @var $item ProjectEntity */
                 $projects[] = array('projectId' => $item->projectId, 'name' => $item->name);
             }
             $costCentreName = $costCenter->name;
         } else {
             $costCentreName = '';
         }
         $moduleParams['analytics'] = array('costCenterName' => $costCentreName, 'projects' => $projects);
         if ($farmId) {
             $dbFarm = DBFarm::LoadByID($farmId);
             $moduleParams['farm']['farm']['projectId'] = $dbFarm->GetSetting(DBFarm::SETTING_PROJECT_ID);
         }
     }
     $this->response->page('ui/farms/builder.js', $moduleParams, array('ui/farms/builder/selroles.js', 'ui/farms/builder/roleedit.js', 'ui/farms/builder/roleslibrary.js', 'ui/farms/builder/tabs/dbmsr.js', 'ui/farms/builder/tabs/cloudfoundry.js', 'ui/farms/builder/tabs/rabbitmq.js', 'ui/farms/builder/tabs/mongodb.js', 'ui/farms/builder/tabs/haproxy.js', 'ui/farms/builder/tabs/proxy.js', 'ui/farms/builder/tabs/mysql.js', 'ui/farms/builder/tabs/nimbula.js', 'ui/farms/builder/tabs/rds.js', 'ui/farms/builder/tabs/gce.js', 'ui/farms/builder/tabs/scaling.js', 'ui/farms/builder/tabs/scripting.js', 'ui/farms/builder/tabs/advanced.js', 'ui/farms/builder/tabs/ec2.js', 'ui/farms/builder/tabs/security.js', 'ui/farms/builder/tabs/storage.js', 'ui/farms/builder/tabs/variables.js', 'ui/farms/builder/tabs/devel.js', 'ui/farms/builder/tabs/chef.js', 'ui/farms/builder/tabs/vpcrouter.js', 'ui/farms/builder/tabs/network.js', 'ui/farms/builder/tabs/deployments.js', 'ui/farms/builder/tabs/ebs.js', 'ui/farms/builder/tabs/params.js', 'ui/farms/builder/tabs/servicesconfig.js', 'ui/farms/builder/roleslibrary/ec2.js', 'ui/farms/builder/roleslibrary/vpc.js', 'ui/farms/builder/roleslibrary/euca.js', 'ui/farms/builder/roleslibrary/rackspace.js', 'ui/farms/builder/roleslibrary/openstack.js', 'ui/farms/builder/roleslibrary/cloudstack.js', 'ui/farms/builder/roleslibrary/gce.js', 'ui/farms/builder/roleslibrary/mongodb.js', 'ui/farms/builder/roleslibrary/dbmsr.js', 'ui/farms/builder/roleslibrary/proxy.js', 'ui/farms/builder/roleslibrary/haproxy.js', 'ui/farms/builder/roleslibrary/chef.js', 'codemirror/codemirror.js', 'ui/core/variablefield.js', 'ui/scripts/scriptfield.js', 'ux-boxselect.js', 'ui/monitoring/window.js', 'ui/services/chef/chefsettings.js', 'ui/security/groups/sgeditor.js'), array('ui/farms/builder/selroles.css', 'ui/farms/builder/roleedit.css', 'ui/farms/builder/roleslibrary.css', 'codemirror/codemirror.css', 'ui/core/variablefield.css', 'ui/scripts/scriptfield.css', 'ui/farms/builder/tabs/scaling.css'));
 }
开发者ID:rickb838,项目名称:scalr,代码行数:86,代码来源:Farms.php

示例2: xGetFarmAction

 /**
  * @param int $farmId optional
  * @param int $roleId optional
  * @param string $scalrPageHash optional
  * @param string $scalrPageUiHash optional
  * @throws Scalr_Exception_InsufficientPermissions
  */
 public function xGetFarmAction($farmId = null, $roleId = null, $scalrPageHash = null, $scalrPageUiHash = null)
 {
     if ($scalrPageHash && $scalrPageHash != $this->calcFarmDesignerHash()) {
         $this->response->data(['scalrPageHashMismatch' => true]);
         return;
     }
     if ($scalrPageUiHash && $scalrPageUiHash != $this->response->pageUiHash()) {
         $this->response->data(['scalrPageUiHashMismatch' => true]);
         return;
     }
     $moduleParams = array('farmId' => $farmId, 'roleId' => $roleId, 'behaviors' => ROLE_BEHAVIORS::GetName(null, true));
     unset($moduleParams['behaviors'][ROLE_BEHAVIORS::CASSANDRA]);
     unset($moduleParams['behaviors'][ROLE_BEHAVIORS::CUSTOM]);
     unset($moduleParams['behaviors'][ROLE_BEHAVIORS::HAPROXY]);
     //platforms list
     $platforms = self::loadController('Platforms')->getEnabledPlatforms();
     if (empty($platforms)) {
         throw new Exception('Before building new farm you need to configure environment and setup cloud credentials');
     }
     //categories list
     $categories = $this->db->GetAll("SELECT c.id, c.name, COUNT(DISTINCT r.id) AS total\n             FROM role_categories c\n             LEFT JOIN roles r ON c.id = r.cat_id AND (r.env_id IS NULL OR r.env_id = ?) AND r.id IN (\n                SELECT role_id\n                FROM role_images\n                WHERE role_id = r.id\n                AND platform IN ('" . implode("','", array_keys($platforms)) . "')\n             )\n             WHERE c.env_id IS NULL OR c.env_id = ?\n             GROUP BY c.id\n            ", array($this->environment->id, $this->environment->id));
     $moduleParams['categories'] = array();
     foreach ($categories as $g) {
         $moduleParams['categories'][$g['id']] = $g;
     }
     $moduleParams['farmVpcEc2Enabled'] = $this->getEnvironment()->isPlatformEnabled(SERVER_PLATFORMS::EC2);
     if ($moduleParams['farmVpcEc2Enabled']) {
         $moduleParams['farmVpcEc2Locations'] = self::loadController('Platforms')->getCloudLocations(SERVER_PLATFORMS::EC2, false);
     }
     if ($farmId) {
         $this->request->restrictFarmAccess(DBFarm::LoadByID($farmId), Acl::PERM_FARMS_MANAGE);
         $c = self::loadController('Builder', 'Scalr_UI_Controller_Farms');
         $moduleParams['farm'] = $c->getFarm2($farmId);
     } else {
         $this->request->restrictFarmAccess(null, Acl::PERM_FARMS_MANAGE);
         // TODO: remove hack, do better
         $vars = new Scalr_Scripting_GlobalVariables($this->user->getAccountId(), $this->getEnvironmentId(), ScopeInterface::SCOPE_FARM);
         $moduleParams['farmVariables'] = $vars->getValues();
     }
     $moduleParams['tabs'] = array('vpcrouter', 'dbmsr', 'mongodb', 'mysql', 'scaling', 'network', 'cloudfoundry', 'rabbitmq', 'haproxy', 'proxy', 'scripting', 'ec2', 'openstack', 'gce', 'azure', 'security', 'devel', 'storage', 'variables', 'advanced', 'chef');
     //deprecated tabs
     if (\Scalr::config('scalr.ui.show_deprecated_features')) {
         $moduleParams['tabs'][] = 'deployments';
         $moduleParams['tabs'][] = 'ebs';
         $moduleParams['tabs'][] = 'servicesconfig';
     }
     $conf = $this->getContainer()->config->get('scalr.load_statistics.connections.plotter');
     $moduleParams['tabParams'] = array('farmId' => $farmId, 'farmHash' => $moduleParams['farm'] ? $moduleParams['farm']['farm']['hash'] : '', 'accountId' => $this->environment->cloudCredentials(SERVER_PLATFORMS::EC2)->properties[Entity\CloudCredentialsProperty::AWS_ACCOUNT_ID], 'remoteAddress' => $this->request->getRemoteAddr(), 'monitoringHostUrl' => "{$conf['scheme']}://{$conf['host']}:{$conf['port']}", 'nginx' => array('server_section' => file_get_contents(APPPATH . '/templates/services/nginx/server_section.tpl'), 'server_section_ssl' => file_get_contents(APPPATH . '/templates/services/nginx/server_section_ssl.tpl')));
     $moduleParams['tabParams']['scalr.dns.global.enabled'] = \Scalr::config('scalr.dns.global.enabled');
     $moduleParams['tabParams']['scalr.instances_connection_policy'] = \Scalr::config('scalr.instances_connection_policy');
     $moduleParams['tabParams']['scalr.scalarizr_update.repos'] = array_keys(\Scalr::config('scalr.scalarizr_update.repos'));
     $moduleParams['tabParams']['scalr.scalarizr_update.devel_repos'] = is_array(\Scalr::config('scalr.scalarizr_update.devel_repos')) ? array_keys(\Scalr::config('scalr.scalarizr_update.devel_repos')) : [];
     $moduleParams['tabParams']['scalr.scalarizr_update.default_repo'] = \Scalr::config('scalr.scalarizr_update.default_repo');
     $moduleParams['tabParams']['scalr.aws.ec2.limits.security_groups_per_instance'] = \Scalr::config('scalr.aws.ec2.limits.security_groups_per_instance');
     $moduleParams['metrics'] = Entity\ScalingMetric::getList($this->getEnvironmentId());
     $moduleParams['timezones_list'] = Scalr_Util_DateTime::getTimezones();
     $moduleParams['timezone_default'] = $this->user->getSetting(Scalr_Account_User::SETTING_UI_TIMEZONE);
     if ($moduleParams['farm']['farm']['ownerEditable']) {
         $moduleParams['usersList'] = Scalr_Account_User::getList($this->user->getAccountId());
     }
     $defaultFarmRoleSecurityGroups = array('default');
     if (\Scalr::config('scalr.aws.security_group_name')) {
         $defaultFarmRoleSecurityGroups[] = \Scalr::config('scalr.aws.security_group_name');
     }
     $moduleParams['roleDefaultSettings'] = array('base.keep_scripting_logs_time' => \Scalr::config('scalr.system.scripting.default_instance_log_rotation_period'), 'security_groups.list' => json_encode($defaultFarmRoleSecurityGroups), 'base.abort_init_on_script_fail' => \Scalr::config('scalr.system.scripting.default_abort_init_on_script_fail') ? 1 : 0, 'base.disable_firewall_management' => \Scalr::config('scalr.system.default_disable_firewall_management') ? 1 : 0);
     //cost analytics
     if ($this->getContainer()->analytics->enabled && $this->getEnvironment()->getPlatformConfigValue(Scalr_Environment::SETTING_CC_ID)) {
         $farmCostData = $this->getFarmCostData($farmId);
         $moduleParams['analytics'] = $farmCostData['analytics'];
         if ($farmId) {
             $moduleParams['farm']['farm']['projectId'] = $farmCostData['projectId'];
             $moduleParams['analytics']['farmCostMetering'] = $farmCostData['farmCostMetering'];
         }
     }
     $moduleParams['farmLaunchPermission'] = $farmId ? $moduleParams['farm']['farm']['launchPermission'] : $this->request->isFarmAllowed(null, Acl::PERM_FARMS_LAUNCH_TERMINATE);
     if ($moduleParams['farm']['farm']['teamOwnerEditable'] || !$farmId) {
         if ($this->user->canManageAcl()) {
             $teams = $this->db->getAll('SELECT id, name, description FROM account_teams WHERE account_id = ?', array($this->user->getAccountId()));
         } else {
             $teams = $this->user->getTeams();
             $teamId = $moduleParams['farm']['farm']['teamOwner'];
             $flag = !!$teamId;
             foreach ($teams as $t) {
                 if ($t['id'] == $teamId) {
                     $flag = false;
                     break;
                 }
             }
             if ($flag) {
                 // team is missed in list, add manually
                 $team = $this->db->GetRow('SELECT name, description FROM account_teams WHERE id = ?', [$teamId]);
                 array_unshift($teams, ['id' => $teamId, 'name' => $team ? $team['name'] : '', 'description' => $team ? $team['description'] : '']);
             }
//.........这里部分代码省略.........
开发者ID:mheydt,项目名称:scalr,代码行数:101,代码来源:Farms.php


注:本文中的Scalr_Account_User::getList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。