示例#1
0
 /**
  * @return array $limits
  */
 public function getLimits()
 {
     $l = array(Scalr_Limits::ACCOUNT_ENVIRONMENTS, Scalr_Limits::ACCOUNT_FARMS, Scalr_Limits::ACCOUNT_SERVERS, Scalr_Limits::ACCOUNT_USERS);
     $limits = array();
     foreach ($l as $limitName) {
         $limit = Scalr_Limits::init()->Load($limitName, $this->id);
         $limits[$limitName] = array('limit' => $limit->getLimitValue(), 'usage' => $limit->getCurrentUsage());
     }
     return $limits;
 }
示例#2
0
文件: Accounts.php 项目: mheydt/scalr
 public function getAccount()
 {
     $account = Scalr_Account::init()->loadById($this->getParam(self::CALL_PARAM_NAME));
     $result = array('id' => $account->id, 'name' => $account->name, 'comments' => $account->comments, 'limitEnv' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $account->id)->getLimitValue(), 'limitFarms' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_FARMS, $account->id)->getLimitValue(), 'limitServers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_SERVERS, $account->id)->getLimitValue(), 'limitUsers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_USERS, $account->id)->getLimitValue());
     if ($this->getContainer()->config->get('scalr.auth_mode') == 'ldap') {
         $result['ownerEmail'] = $account->getOwner()->getEmail();
     }
     $result['ccs'] = [];
     if ($this->getContainer()->analytics->enabled) {
         foreach (AccountCostCenterEntity::findByAccountId($account->id) as $accountCcsEntity) {
             $result['ccs'][] = $accountCcsEntity->ccId;
         }
     }
     return $result;
 }
示例#3
0
文件: Accounts.php 项目: recipe/scalr
 public function getAccount()
 {
     $account = Scalr_Account::init()->loadById($this->getParam(self::CALL_PARAM_NAME));
     $result = array('id' => $account->id, 'name' => $account->name, 'comments' => $account->comments, 'limitEnv' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $account->id)->getLimitValue(), 'limitFarms' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_FARMS, $account->id)->getLimitValue(), 'limitServers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_SERVERS, $account->id)->getLimitValue(), 'limitUsers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_USERS, $account->id)->getLimitValue());
     if ($this->getContainer()->config->get('scalr.auth_mode') == 'ldap') {
         $result['ownerEmail'] = $account->getOwner()->getEmail();
     }
     return $result;
 }
示例#4
0
文件: Billing.php 项目: recipe/scalr
 public function buyEnvironmentsAction()
 {
     $limit = Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $this->user->getAccountId());
     $this->response->page('ui/billing/buyEnvironments.js', array('currentLimit' => $limit->getLimitValue()));
 }
示例#5
0
 public function getAccount()
 {
     $account = Scalr_Account::init()->loadById($this->getParam(self::CALL_PARAM_NAME));
     return array('id' => $account->id, 'name' => $account->name, 'comments' => $account->comments, 'limitEnv' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $account->id)->getLimitValue(), 'limitFarms' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_FARMS, $account->id)->getLimitValue(), 'limitServers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_SERVERS, $account->id)->getLimitValue(), 'limitUsers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_USERS, $account->id)->getLimitValue());
 }