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


PHP Scalr_Account_User类代码示例

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


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

示例1: handleWork

 function handleWork($farmId)
 {
     try {
         $dbFarm = DBFarm::LoadByID($farmId);
         $governance = new Scalr_Governance($dbFarm->EnvID);
         $settings = $governance->getValue(Scalr_Governance::CATEGORY_GENERAL, Scalr_Governance::GENERAL_LEASE, 'notifications');
         $curDate = new DateTime();
         $td = new DateTime($dbFarm->GetSetting(DBFarm::SETTING_LEASE_TERMINATE_DATE));
         if ($td > $curDate) {
             // only inform user
             $days = $td->diff($curDate)->days;
             $notifications = json_decode($dbFarm->GetSetting(DBFarm::SETTING_LEASE_NOTIFICATION_SEND), true);
             if (is_array($settings)) {
                 foreach ($settings as $n) {
                     if (!$notifications[$n['key']] && $n['period'] >= $days) {
                         $mailer = Scalr::getContainer()->mailer;
                         $tdHuman = Scalr_Util_DateTime::convertDateTime($td, $dbFarm->GetSetting(DBFarm::SETTING_TIMEZONE), 'M j, Y');
                         if ($n['to'] == 'owner') {
                             $user = new Scalr_Account_User();
                             $user->loadById($dbFarm->createdByUserId);
                             if (Scalr::config('scalr.auth_mode') == 'ldap') {
                                 $email = $user->getSetting(Scalr_Account_User::SETTING_LDAP_EMAIL);
                                 if (!$email) {
                                     $email = $user->getEmail();
                                 }
                             } else {
                                 $email = $user->getEmail();
                             }
                             $mailer->addTo($email);
                         } else {
                             foreach (explode(',', $n['emails']) as $email) {
                                 $mailer->addTo(trim($email));
                             }
                         }
                         $mailer->sendTemplate(SCALR_TEMPLATES_PATH . '/emails/farm_lease_terminate.eml', array('{{terminate_date}}' => $tdHuman, '{{farm}}' => $dbFarm->Name, '{{envName}}' => $dbFarm->GetEnvironmentObject()->name, '{{envId}}' => $dbFarm->GetEnvironmentObject()->id));
                         $notifications[$n['key']] = 1;
                         $dbFarm->SetSetting(DBFarm::SETTING_LEASE_NOTIFICATION_SEND, json_encode($notifications));
                         $this->logger->info("Notification was sent by key: " . $n['key'] . " about farm: " . $dbFarm->Name . " by lease manager");
                     }
                 }
             }
         } else {
             // terminate farm
             $event = new FarmTerminatedEvent(0, 1, false, 1);
             Scalr::FireEvent($farmId, $event);
             $this->logger->info("Farm: " . $dbFarm->Name . " was terminated by lease manager");
         }
     } catch (Exception $e) {
         var_dump($e->getMessage());
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:51,代码来源:LeaseManager.php

示例2: getAccountUsersList

 public function getAccountUsersList()
 {
     if ($this->user->canManageAcl()) {
         $result = $this->db->getAll('SELECT account_users.id FROM account_users WHERE account_id = ?', array($this->user->getAccountId()));
         foreach ($result as &$row) {
             $row = Scalr_Account_User::init()->loadById($row['id'])->getUserInfo();
         }
     } else {
         $result = array();
         $teams = $this->user->getTeams();
         if (!empty($teams)) {
             $sql = '
                 SELECT u.id, u.fullname, u.email
                 FROM account_users u
                 INNER JOIN account_team_users tu ON u.id = tu.user_id
                 WHERE account_id= ?';
             $params[] = $this->user->getAccountId();
             foreach ($teams as $team) {
                 $r[] = 'tu.team_id = ?';
                 $params[] = $team['id'];
             }
             $sql .= ' AND (' . implode(' OR ', $r) . ')';
             $result = $this->db->getAll($sql, $params);
         }
     }
     return $result;
 }
开发者ID:scalr,项目名称:scalr,代码行数:27,代码来源:Account2.php

示例3: initializeInstance

 /**
  * @param $type
  * @param $headers
  * @param $server
  * @param $params
  * @param $files
  * @param $userId
  * @param $envId
  * @return Scalr_UI_Request
  * @throws Scalr_Exception_Core
  * @throws Exception
  */
 public static function initializeInstance($type, $headers, $server, $params, $files, $userId, $envId)
 {
     if (self::$_instance) {
         self::$_instance = null;
     }
     $class = get_called_class();
     $instance = new $class($type, $headers, $server, $params, $files);
     if ($userId) {
         try {
             $user = Scalr_Account_User::init();
             $user->loadById($userId);
         } catch (Exception $e) {
             throw new Exception('User account is no longer available.');
         }
         if ($user->status != Scalr_Account_User::STATUS_ACTIVE) {
             throw new Exception('User account has been deactivated. Please contact your account owner.');
         }
         if ($user->getType() != Scalr_Account_User::TYPE_SCALR_ADMIN) {
             $environment = $user->getDefaultEnvironment($envId);
             $user->getPermissions()->setEnvironmentId($environment->id);
         }
         if ($user->getAccountId()) {
             if ($user->getAccount()->status == Scalr_Account::STATUS_INACIVE) {
                 if ($user->getType() == Scalr_Account_User::TYPE_TEAM_USER) {
                     throw new Exception('Scalr account has been deactivated. Please contact scalr team.');
                 }
             } else {
                 if ($user->getAccount()->status == Scalr_Account::STATUS_SUSPENDED) {
                     if ($user->getType() == Scalr_Account_User::TYPE_TEAM_USER) {
                         throw new Exception('Account was suspended. Please contact your account owner to solve this situation.');
                     }
                 }
             }
         }
         $ipWhitelist = $user->getVar(Scalr_Account_User::VAR_SECURITY_IP_WHITELIST);
         if ($ipWhitelist) {
             $ipWhitelist = unserialize($ipWhitelist);
             if (!Scalr_Util_Network::isIpInSubnets($instance->getRemoteAddr(), $ipWhitelist)) {
                 throw new Exception('The IP address isn\'t authorized');
             }
         }
         // check header's variables
         $headerUserId = !is_null($instance->getHeaderVar('UserId')) ? intval($instance->getHeaderVar('UserId')) : null;
         $headerEnvId = !is_null($instance->getHeaderVar('EnvId')) ? intval($instance->getHeaderVar('EnvId')) : null;
         if (!empty($headerUserId) && $headerUserId != $user->getId()) {
             throw new Scalr_Exception_Core('Session expired. Please refresh page.', 1);
         }
         if (!empty($headerEnvId) && !empty($environment) && $headerEnvId != $environment->id) {
             throw new Scalr_Exception_Core('Session expired. Please refresh page.', 1);
         }
         $instance->user = $user;
         $instance->environment = isset($environment) ? $environment : null;
     }
     $container = \Scalr::getContainer();
     $container->request = $instance;
     $container->environment = isset($instance->environment) ? $instance->environment : null;
     self::$_instance = $instance;
     return $instance;
 }
开发者ID:recipe,项目名称:scalr,代码行数:71,代码来源:Request.php

示例4: xRemoveAction

 public function xRemoveAction()
 {
     $user = Scalr_Account_User::init();
     $user->loadById($this->getParam('userId'));
     if ($user->getEmail() == 'admin') {
         throw new Scalr_Exception_InsufficientPermissions();
     }
     $user->delete();
     $this->response->success('User successfully removed');
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:10,代码来源:Users.php

示例5: getUser

 /**
  * Gets an test User instance
  *
  * @return  \Scalr_Account_user Returns user instance
  */
 protected function getUser()
 {
     if (!isset($this->user)) {
         if (empty($this->_testUserId)) {
             $this->_testUserId = \Scalr::config('scalr.phpunit.userid');
         }
         $this->user = \Scalr_Account_User::init();
         $this->user->loadById($this->_testUserId);
     }
     return $this->user;
 }
开发者ID:rickb838,项目名称:scalr,代码行数:16,代码来源:WebTestCase.php

示例6: getUserInfoByAccountId

 protected function getUserInfoByAccountId($accountId)
 {
     if (!isset($this->accountsCache[$accountId])) {
         if ($accountId) {
             try {
                 $acc = new \Scalr_Account();
                 $acc->loadById($accountId);
                 $this->accountsCache[$accountId] = array('id' => $acc->getOwner()->id, 'email' => $acc->getOwner()->getEmail());
             } catch (\Exception $e) {
                 $this->console->error($e->getMessage());
                 return array('id' => 0, 'email' => '');
             }
         } else {
             $user = new \Scalr_Account_User();
             $user->loadByEmail('admin', 0);
             $this->accountsCache[$accountId] = array('id' => $user->id, 'email' => $user->getEmail());
         }
     }
     return $this->accountsCache[$accountId];
 }
开发者ID:mheydt,项目名称:scalr,代码行数:20,代码来源:Update20140204143602.php

示例7: callActionMethod

 public function callActionMethod($method)
 {
     if ($this->request->getRequestType() == Scalr_UI_Request::REQUEST_TYPE_API) {
         $apiMethodCheck = false;
         if (method_exists($this, 'getApiDefinitions')) {
             $api = $this::getApiDefinitions();
             $m = str_replace('Action', '', $method);
             if (in_array($m, $api)) {
                 $apiMethodCheck = true;
             }
         }
         if (!$apiMethodCheck) {
             throw new Scalr_UI_Exception_NotFound();
         }
     }
     if ($this->user) {
         if ($this->user->getType() == Scalr_Account_User::TYPE_TEAM_USER) {
             if (!$this->user->isTeamUserInEnvironment($this->getEnvironmentId(), Scalr_Account_Team::PERMISSIONS_OWNER) && !$this->user->isTeamUserInEnvironment($this->getEnvironmentId(), Scalr_Account_Team::PERMISSIONS_FULL)) {
                 if (method_exists($this, 'getPermissionDefinitions')) {
                     // rules defined for this controller
                     $cls = get_class($this);
                     $clsShort = str_replace('Scalr_UI_Controller_', '', $cls);
                     $methodShort = str_replace('Action', '', $method);
                     $clsPermissions = $cls::getPermissionDefinitions();
                     $permissions = $this->user->getGroupPermissions($this->getEnvironmentId());
                     if (array_key_exists($clsShort, $permissions)) {
                         // rules for user and such controller
                         $perm = $permissions[$clsShort];
                         if (!in_array('FULL', $perm, true)) {
                             // user doesn't has full privilegies
                             if (array_key_exists($methodShort, $clsPermissions)) {
                                 // standalone rule for this method
                                 if (!in_array($clsPermissions[$methodShort], $perm)) {
                                     throw new Scalr_Exception_InsufficientPermissions();
                                 }
                             } else {
                                 // VIEW rule
                                 if (!in_array('VIEW', $perm)) {
                                     throw new Scalr_Exception_InsufficientPermissions();
                                 }
                             }
                         }
                     } else {
                         throw new Scalr_Exception_InsufficientPermissions();
                     }
                 }
             }
         }
     }
     $this->{$method}();
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:51,代码来源:Controller.php

示例8: xRequestResultAction

 public function xRequestResultAction()
 {
     $this->request->defineParams(array('requests' => array('type' => 'json'), 'decision'));
     if (!in_array($this->getParam('decision'), array(FarmLease::STATUS_APPROVE, FarmLease::STATUS_DECLINE))) {
         throw new Scalr_Exception_Core('Wrong status');
     }
     foreach ($this->getParam('requests') as $id) {
         $req = $this->db->GetRow('SELECT * FROM farm_lease_requests WHERE id = ? LIMIT 1', array($id));
         if ($req) {
             $dbFarm = DBFarm::LoadByID($req['farm_id']);
             $this->user->getPermissions()->validate($dbFarm);
             $this->db->Execute('UPDATE farm_lease_requests SET status = ?, answer_comment = ?, answer_user_id = ? WHERE id = ?', array($this->getParam('decision'), $this->getParam('comment'), $this->user->getId(), $id));
             try {
                 $mailer = Scalr::getContainer()->mailer;
                 $user = new Scalr_Account_User();
                 $user->loadById($dbFarm->createdByUserId);
                 if ($this->getContainer()->config('scalr.auth_mode') == 'ldap') {
                     if ($user->getSetting(Scalr_Account_User::SETTING_LDAP_EMAIL)) {
                         $mailer->addTo($user->getSetting(Scalr_Account_User::SETTING_LDAP_EMAIL));
                     } else {
                         $mailer->addTo($user->getEmail());
                     }
                 } else {
                     $mailer->addTo($user->getEmail());
                 }
             } catch (Exception $e) {
                 $mailer = null;
             }
             if ($this->getParam('decision') == FarmLease::STATUS_APPROVE) {
                 if ($req['request_days'] > 0) {
                     $dt = $dbFarm->GetSetting(DBFarm::SETTING_LEASE_TERMINATE_DATE);
                     $dt = new DateTime($dt);
                     $dt->add(new DateInterval('P' . $req['request_days'] . 'D'));
                     $dbFarm->SetSetting(DBFarm::SETTING_LEASE_TERMINATE_DATE, $dt->format('Y-m-d H:i:s'));
                     $dbFarm->SetSetting(DBFarm::SETTING_LEASE_NOTIFICATION_SEND, null);
                     if ($mailer) {
                         $mailer->sendTemplate(SCALR_TEMPLATES_PATH . '/emails/farm_lease_non_standard_approve.eml', array('{{farm_name}}' => $dbFarm->Name, '{{user_name}}' => $this->user->getEmail(), '{{comment}}' => $this->getParam('comment'), '{{date}}' => $dt->format('M j, Y'), '{{envName}}' => $dbFarm->GetEnvironmentObject()->name, '{{envId}}' => $dbFarm->GetEnvironmentObject()->id));
                     }
                 } else {
                     $dbFarm->SetSetting(DBFarm::SETTING_LEASE_STATUS, '');
                     $dbFarm->SetSetting(DBFarm::SETTING_LEASE_TERMINATE_DATE, '');
                     $dbFarm->SetSetting(DBFarm::SETTING_LEASE_NOTIFICATION_SEND, '');
                     if ($mailer) {
                         $mailer->sendTemplate(SCALR_TEMPLATES_PATH . '/emails/farm_lease_non_standard_forever.eml', array('{{farm_name}}' => $dbFarm->Name, '{{user_name}}' => $this->user->getEmail(), '{{comment}}' => $this->getParam('comment'), '{{envName}}' => $dbFarm->GetEnvironmentObject()->name, '{{envId}}' => $dbFarm->GetEnvironmentObject()->id));
                     }
                 }
             } else {
                 $dt = new DateTime($dbFarm->GetSetting(DBFarm::SETTING_LEASE_TERMINATE_DATE));
                 SettingEntity::increase(SettingEntity::LEASE_DECLINED_REQUEST);
                 if ($mailer) {
                     $mailer->sendTemplate(SCALR_TEMPLATES_PATH . '/emails/farm_lease_non_standard_decline.eml', array('{{farm_name}}' => $dbFarm->Name, '{{user_name}}' => $this->user->getEmail(), '{{date}}' => $dt->format('M j, Y'), '{{comment}}' => $this->getParam('comment'), '{{envName}}' => $dbFarm->GetEnvironmentObject()->name, '{{envId}}' => $dbFarm->GetEnvironmentObject()->id));
                 }
             }
         }
     }
     $this->response->success();
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:57,代码来源:Lease.php

示例9: run1

 /**
  * Performs upgrade literally for the stage ONE.
  *
  * Implementation of this method performs update steps needs to be taken
  * to accomplish upgrade successfully.
  *
  * If there are any error during an execution of this scenario it must
  * throw an exception.
  *
  * @param   int  $stage  optional The stage number
  * @throws  \Exception
  */
 protected function run1($stage)
 {
     $dashboards = $this->db->Execute('SELECT user_id, env_id FROM account_user_dashboard');
     foreach ($dashboards as $keys) {
         try {
             $user = new \Scalr_Account_User();
             $user->loadById($keys['user_id']);
             $dash = $user->getDashboard($keys['env_id']);
             if (!(is_array($dash) && isset($dash['configuration']) && is_array($dash['configuration']) && isset($dash['flags']) && is_array($dash['flags']))) {
                 // old configuration, remove it
                 $this->db->Execute('DELETE FROM account_user_dashboard WHERE user_id = ? AND env_id = ?', array($keys['user_id'], $keys['env_id']));
                 continue;
             }
             foreach ($dash['configuration'] as &$column) {
                 foreach ($column as &$widget) {
                     if ($widget['name'] == 'dashboard.monitoring') {
                         $metrics = array('CPUSNMP' => 'cpu', 'LASNMP' => 'la', 'NETSNMP' => 'net', 'ServersNum' => 'snum', 'MEMSNMP' => 'mem');
                         $params = array('farmId' => $widget['params']['farmid'], 'period' => $widget['params']['graph_type'], 'metrics' => $metrics[$widget['params']['watchername']], 'title' => $widget['params']['title'], 'hash' => $this->db->GetOne('SELECT hash FROM farms WHERE id = ?', array($widget['params']['farmid'])));
                         if (stristr($widget['params']['role'], "INSTANCE_")) {
                             $ar = explode('_', $widget['params']['role']);
                             $params['farmRoleId'] = $ar[1];
                             $params['index'] = $ar[2];
                         } else {
                             if ($widget['params']['role'] != 'FARM' && $widget['params']['role'] != 'role') {
                                 $params['farmRoleId'] = $widget['params']['role'];
                             }
                         }
                         $widget['params'] = $params;
                     }
                 }
             }
             $user->setDashboard($keys['env_id'], $dash);
         } catch (\Exception $e) {
             $this->console->warning($e->getMessage());
         }
     }
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:49,代码来源:Update20140306123554.php

示例10: run1

 protected function run1($stage)
 {
     $this->db->Execute('
         ALTER TABLE `timeline_events`
             ADD `account_id` int(11) NULL AFTER `user_id`,
             ADD `env_id` int(11) NULL AFTER `account_id`,
             ADD INDEX `idx_account_id` (`account_id` ASC),
             ADD INDEX `idx_env_id` (`env_id` ASC)
     ');
     $res = $this->db->Execute('SELECT * FROM timeline_events');
     while ($item = $res->FetchRow()) {
         $event = new TimelineEventEntity();
         $event->load($item);
         try {
             $event->accountId = \Scalr_Account_User::init()->loadById($event->userId)->getAccountId();
         } catch (Exception $e) {
             continue;
         }
         $event->save();
     }
 }
开发者ID:mheydt,项目名称:scalr,代码行数:21,代码来源:Update20141002103526.php

示例11: onCloudAdd

 /**
  * 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) {
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:46,代码来源:Notifications.php

示例12: FarmGetDetails

 public function FarmGetDetails($FarmID)
 {
     $response = parent::FarmGetDetails($FarmID);
     try {
         $DBFarm = DBFarm::LoadByID($FarmID);
         if ($DBFarm->EnvID != $this->Environment->id) {
             throw new Exception("N");
         }
     } catch (Exception $e) {
         throw new Exception(sprintf("Farm #%s not found", $FarmID));
     }
     $response->ID = $DBFarm->ID;
     $response->Name = $DBFarm->Name;
     $response->IsLocked = $DBFarm->GetSetting(DBFarm::SETTING_LOCK);
     if ($response->IsLocked == 1) {
         $response->LockComment = $DBFarm->GetSetting(DBFarm::SETTING_LOCK_COMMENT);
         try {
             $response->LockedBy = Scalr_Account_User::init()->loadById($DBFarm->GetSetting(DBFarm::SETTING_LOCK_BY))->fullname;
         } catch (Exception $e) {
         }
     }
     foreach ($response->FarmRoleSet->Item as &$item) {
         $dbFarmRole = DBFarmRole::LoadByID($item->ID);
         $item->IsScalingEnabled = $dbFarmRole->GetSetting(DBFarmRole::SETTING_SCALING_ENABLED);
         $item->{"ScalingAlgorithmSet"} = new stdClass();
         $item->{"ScalingAlgorithmSet"}->Item = array();
         $metrics = $this->DB->GetAll("SELECT metric_id, name, dtlastpolled FROM `farm_role_scaling_metrics`\n                    INNER JOIN scaling_metrics ON scaling_metrics.id = farm_role_scaling_metrics.metric_id WHERE farm_roleid = ?", array($item->ID));
         foreach ($metrics as $metric) {
             $itm = new stdClass();
             $itm->MetricID = $metric['id'];
             $itm->MetricName = $metric['name'];
             $itm->DateLastPolled = $metric['dtlastpolled'];
             $item->{"ScalingAlgorithmSet"}->Item[] = $itm;
         }
     }
     return $response;
 }
开发者ID:rickb838,项目名称:scalr,代码行数:37,代码来源:class.ScalrAPI_2_3_0.php

示例13: prepareFarmSqlQuery

 /**
  * Modify sql query to limit access by only allowable farms
  *
  * @param   string  $query
  * @param   array   $args
  * @param   string  $prefix optional    Prefix for table farms in sql query
  * @param   string  $perm   optional
  * @return  array
  */
 public function prepareFarmSqlQuery($query, $args, $prefix = '', $perm = null)
 {
     $prefix = $prefix ? "{$prefix}." : '';
     if (!$this->isAllowed(Acl::RESOURCE_FARMS, $perm)) {
         $q = [];
         if ($this->isAllowed(Acl::RESOURCE_TEAM_FARMS, $perm)) {
             $t = array_map(function ($t) {
                 return $t['id'];
             }, $this->user->getTeams());
             if (count($t)) {
                 $q[] = "{$prefix}team_id IN(" . join(',', $t) . ")";
             }
         }
         if ($this->isAllowed(Acl::RESOURCE_OWN_FARMS, $perm)) {
             $q[] = "{$prefix}created_by_id = ?";
             $args[] = $this->user->getId();
         }
         if (count($q)) {
             $query .= ' AND (' . join(' OR ', $q) . ')';
         } else {
             $query .= ' AND false';
             // no permissions
         }
     }
     return [$query, $args];
 }
开发者ID:mheydt,项目名称:scalr,代码行数:35,代码来源:Request.php

示例14: getAclRoles

 /**
  * Gets acl roles superposition for the request
  *
  * @return \Scalr\Acl\Role\AccountRoleSuperposition
  */
 protected function getAclRoles()
 {
     if (!$this->aclRoles) {
         $this->aclRoles = $this->user->getAclRolesByEnvironment($this->Environment->id);
     }
     return $this->aclRoles;
 }
开发者ID:rickb838,项目名称:scalr,代码行数:12,代码来源:class.ScalrAPICore.php

示例15: getAuditLoggerConfig

 /**
  * {@inheritdoc}
  * @see \Scalr\LogCollector\AuditLoggerRetrieveConfigurationInterface::getAuditLoggerConfig()
  */
 public function getAuditLoggerConfig()
 {
     $config = new AuditLoggerConfiguration(AuditLogger::REQUEST_TYPE_API);
     $config->user = $this->user;
     $config->accountId = $this->user ? $this->user->getAccountId() : null;
     $config->envId = isset($this->Environment) ? $this->Environment->id : null;
     $config->remoteAddr = $this->getContainer()->request->getRemoteAddr();
     return $config;
 }
开发者ID:scalr,项目名称:scalr,代码行数:13,代码来源:class.ScalrAPICore.php


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