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


PHP App::getUserLogged方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->_watcherService = WatcherService::getInstance();
     $this->_txId = uniqid('test-', true);
     $user = \App::getUserLogged();
     $this->_watcher = new WatcherModel();
     $this->_watcher->scope = 'user';
     $this->_watcher->scopeId = $user->id;
     $this->_watcher->owner = $user->id;
     $this->_watcher->namespace = 'connectivity';
     $this->_watcher->entityType = 'transaction';
     $this->_watcher->entityIds = array($this->_txId);
     $this->_watcher->transport = 'popbox';
     $this->_watcher->priority = WatcherModel::PRIORITY_LOW;
     $this->_watcher->status = WatcherModel::STATUS_ACTIVE;
     $this->_watcher->expire = strtotime(\App::config('watchers.expire', "+1 day"));
     $this->_watcher->remove = strtotime(\App::config('watchers.autoremove', "+6 months"));
     $this->_watcher->tags = array('context_' . $user->getOrganizationId());
     $this->_watcher->maxEvents = 1;
     $this->_watcher->maxEventStackSize = 1;
     $this->_watcher->params = new StructConfigModel();
     $this->_watcher->hiddenParams = new StructConfigModel();
     $this->_event = new EventModel();
     $this->_event->namespace = 'connectivity';
     $this->_event->entityType = 'transaction';
     $this->_event->entityId = $this->_txId;
     $this->_event->created = time();
     $this->_event->modified = time();
     $this->_event->pushEventData = true;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:30,代码来源:PublishAsyncTest.php

示例2: setUp

 public function setUp()
 {
     $this->_asyncService = AsyncService::getInstance();
     $this->_transactionIds = array('eeruqw2131saw222sawdd1', 'shduah892189hwhsaskjdh', 'shdshausd21271hudias12');
     $this->_data = array('data' => '{tested}');
     $this->_user = array('user' => \App::getUserLogged()->getId(), 'organization' => \App::getUserLogged()->getOrganizationId(), 'authType' => \App_Controller_Plugin_Auth::AUTH_TYPE_AUTH_TOKEN);
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:7,代码来源:AsyncServiceTest.php

示例3: _checkValue

 protected function _checkValue($value, $comparedValue)
 {
     switch ($comparedValue) {
         case self::IS_NULL:
             $comparedValue = NULL;
             break;
         case self::USER_ID:
             $comparedValue = \App::getUserLogged()->id;
             break;
         case self::USER_ORG_ID:
             $comparedValue = \App::getUserLogged()->organizationId;
             break;
     }
     switch ($this->getOperator()) {
         case self::EQUAL:
             $result = $value == $comparedValue;
             break;
         case self::STRICT_EQUAL:
             $result = $value === $comparedValue;
             break;
         case self::GREATER_THAN:
             $result = $value > $comparedValue;
             break;
         case self::LESS_THAN:
             $result = $value < $comparedValue;
             break;
         case self::CONTAINS:
             if (is_array($value)) {
                 $result = in_array($comparedValue, $value);
             } else {
                 if (is_string($value) && is_string($comparedValue)) {
                     $result = !(strpos($value, $comparedValue) === false);
                 } else {
                     throw new App_ListFilter_Rule_Condition_Exception('Values are no possible to compare with CONTAINS operator.');
                 }
             }
             break;
         case self::IN:
             if (is_array($comparedValue)) {
                 $result = in_array($value, $comparedValue);
             } else {
                 if (is_string($value) && is_string($comparedValue)) {
                     $result = !(strpos($comparedValue, $value) === false);
                 } else {
                     throw new App_ListFilter_Rule_Condition_Exception('Values are no possible to compare with IN operator.');
                 }
             }
             break;
     }
     /*
      * Logic table
      * | Inv | res |
      * |  1  |  1  | 0
      * |  1  |  0  | 1
      * |  0  |  1  | 1
      * |  0  |  0  | 0
      */
     return $this->getInverted() != $result;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:59,代码来源:Comparation.php

示例4: isValid

 /**
  * Validate element value
  *
  * @param  array   $data
  * @param  mixed   $context
  * @return boolean
  */
 public function isValid($value, $context = array())
 {
     $currentUser = \App::getUserLogged();
     if (isset($context['id']) && $currentUser->getId() === $context['id'] && $currentUser->monetaryDataAccess !== $value) {
         $this->_messages = array(self::NOT_ALLOWED_CHANGE_MONETARY_ACCESS_ITSELF => $this->_templateMessages[self::NOT_ALLOWED_CHANGE_MONETARY_ACCESS_ITSELF]);
         return false;
     }
     return true;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:16,代码来源:MonetaryDataAccess.php

示例5: indexAction

 /**
  * Lists all permissions
  */
 public function indexAction()
 {
     if (($namespace = $this->_getParam('namespace')) || ($namespace = $this->getRequest()->getHeader('Realm'))) {
     }
     if (!($roleId = $this->_getParam('roleId'))) {
         $roleId = \App::getUserLogged()->getRoleId();
     }
     $this->view->permissions = \Core\Service\PermissionService::getInstance()->load($roleId, $namespace);
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:12,代码来源:PermissionController.php

示例6: dispatchLoopStartup

 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $byPassMethods = array(App_Controller_Plugin_Auth::AUTH_TYPE_LOST_PASSWORD, App_Controller_Plugin_Auth::AUTH_TYPE_ASYNC, App_Controller_Plugin_Auth::AUTH_TYPE_EXTERNAL, App_Controller_Plugin_Auth::AUTH_TYPE_THIRD_PARTY);
     //Bypass some auth methods
     if ($identity['authType'] && in_array($identity['authType'], $byPassMethods)) {
         return;
     }
     $user = App::getUserLogged();
     $org = App::getOrgUserLogged();
     App_ListFilter::addDefaultExtraData('user', $user->getUserName());
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:13,代码来源:DependencyInjector.php

示例7: getSupplementaryService

 public function getSupplementaryService($context)
 {
     $user = \App::getUserLogged();
     $org = $user->getOrganization();
     if (!$org->supplementaryServicesId) {
         $orgService = OrgService::getInstance();
         $org = $orgService->getParentByType($org, OrgCustomerModel::ORG_TYPE);
     }
     if ($org) {
         $item = SupplServicesService::getInstance()->load($org->supplementaryServicesId);
         return $item;
     }
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:13,代码来源:MsisdnAvailable.php

示例8: _preCreate

 protected function _preCreate($item)
 {
     if (!$item instanceof WatcherModel) {
         throw new InvalidArgumentException("Watcher model expected");
     }
     if ($item->scope === 'token' && Zend_Auth::getInstance()->hasIdentity()) {
         $ident = Zend_Auth::getInstance()->getIdentity();
         $item->scopeId = $ident['token'];
         if (!isset($item->remove)) {
             $item->remove = strtotime('+1 day');
             if (!isset($item->expire)) {
                 $item->expire = $item->remove;
             }
         }
     }
     $item->owner = \App::getUserLogged()->id;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:17,代码来源:WatcherController.php

示例9: testWhitelist

 public function testWhitelist()
 {
     //TODO: If execute only this test class, the test pass successfull,
     //We have to investigate why it doesn't pass when it is executed in group
     $this->markTestSkipped("Execution in test group doesn't work.");
     $boot = $this->_helper->getFrontController()->getParam('bootstrap');
     $acl = $boot->getResource('acl');
     $acl->allow(\App::getUserLogged()->getRoleId(), $this->_sim->getResourceId(), 'test2_field_default', new App_Acl_Assert_NotAllowed());
     $acl->allow(\App::getUserLogged()->getRoleId(), $this->_sim->getResourceId(), 'test2_field_icc');
     $acl->allow(\App::getUserLogged()->getRoleId(), $this->_sim->getResourceId(), 'test2_field_locationManual');
     $acl->allow(\App::getUserLogged()->getRoleId(), $this->_sim->getResourceId(), 'test2_field_locationManual:longitude');
     $this->_helper->direct('test2_field', $this->_sim);
     $this->assertNotNull($this->_sim->locationManual, "locationManual not null");
     $this->assertNotNull($this->_sim->icc, "Icc not null");
     $this->assertNotNull($this->_sim->locationManual->longitude, "Latitude not null");
     $this->assertNull($this->_sim->id, "Id is null");
     $this->assertNull($this->_sim->locationManual->latitude, "locationManual.longitude is null");
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:18,代码来源:FilterNotAllowedFieldsTest.php

示例10: setupHttpClient

 public function setupHttpClient(Zend_Http_Client $httpClient)
 {
     $httpClient->setHeaders('M2M-ApiKey', $this->getApiKey());
     if ($this->_useSession) {
         $user = \App::getUserLogged();
         if (in_array($user->authType, array(App_Controller_Plugin_Auth::AUTH_TYPE_AUTH_TOKEN, App_Controller_Plugin_Auth::AUTH_TYPE_REGULAR))) {
             \App::log()->debug("M2M-Session: " . $user->authToken);
             \App::log()->debug("M2M-Organization: " . $user->organizationId);
             $httpClient->setHeaders('M2M-Session', $user->authToken);
             $httpClient->setHeaders('M2M-Organization', $user->organizationId);
         } elseif ($user->authType == App_Controller_Plugin_Auth::AUTH_TYPE_EXTERNAL) {
             \App::log()->debug("M2M-UGW-Certificate: " . $user->id);
             \App::log()->debug("M2M-Organization: " . $user->organizationId);
             $httpClient->setHeaders('M2M-UGW-Certificate', $user->id);
             $httpClient->setHeaders('M2M-Organization', $user->organizationId);
         }
     }
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:18,代码来源:PybeApiKey.php

示例11: isValid

 /**
  * Validate element value
  *
  * If a translation adapter is registered, any error messages will be
  * translated according to the current locale, using the given error code;
  * if no matching translation is found, the original message will be
  * utilized.
  *
  * Note: The *filtered* value is validated.
  *
  * @param  array   $data
  * @param  mixed   $context
  * @return boolean
  */
 public function isValid($data, $context = null, $removeNotPresentFields = false)
 {
     if (!$data instanceof UserModel) {
         $this->_messages = array();
         $this->_messages[self::NOT_USER] = $this->_messageTemplatesUser[self::NOT_USER];
         return false;
     }
     if (!parent::isValid($data, $context, $removeNotPresentFields)) {
         return false;
     }
     //Check if a user organization status is actived
     /**
      * @var $data \Application\Model\UserModel
      */
     $org = $data->getOrganization();
     if (!is_null($org) && $org->getStatus() === \Application\Model\OrgModelAbstract::ORG_STATUS_DEACTIVATED) {
         $this->_messages[] = "Organization disabled";
         return false;
     }
     if (null !== $data->getId()) {
         /**
          * @var $user \Application\Model\UserModel
          */
         $user = UserMapper::getInstance()->findOneById($data->getId());
         // Validate if user try to change non-editable values.
         $fields = array('userName', 'organizationId');
         if ($data->getId() === \App::getUserLogged()->getId()) {
             $fields[] = 'role';
         }
         $fixedFieldsValidator = new \App_Validate_NotEditableFields($fields);
         if (!$fixedFieldsValidator->isValid($data->exportData(), $user->exportData())) {
             $this->_messages = $fixedFieldsValidator->getMessages();
             return false;
         }
     }
     return true;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:51,代码来源:UserValidate.php

示例12: meAction

 public function meAction()
 {
     $this->view->user = \App::getUserLogged();
     $this->_helper->filterNotAllowedFields('read_field', $this->view->user);
     if ($this->getRequest()->getParam('organization', false)) {
         $this->view->organization = $this->view->user->getOrganization();
         $this->_helper->filterNotAllowedFields('read_field', $this->view->organization);
         $orgService = OrgService::getInstance();
         $orgService->getOrgConfig($this->view->organization);
         $sp = $orgService->getParentByType($this->view->organization, OrgServiceProviderModel::ORG_TYPE);
         if ($sp && isset($sp->isEnabler)) {
             $this->view->organization->alwaysOnRoaming = !$sp->isEnabler;
         }
         if ($this->view->organization instanceof OrgCustomerModel && isset($this->view->organization->supplementaryServicesId)) {
             try {
                 $supplService = SupplServicesService::getInstance()->load($this->view->organization->supplementaryServicesId);
                 if ($supplService) {
                     try {
                         $this->_helper->allowed('read', $supplService);
                         $this->_helper->filterNotAllowedFields('read_field', $supplService);
                         $this->view->supplService = $supplService;
                     } catch (PermissionException $e) {
                     }
                 }
             } catch (\Exception $e) {
                 \App::log()->warn($e);
             }
         }
     }
     if (($namespace = $this->_getParam('permissions')) || ($namespace = $this->getRequest()->getHeader('Realm'))) {
         if ($namespace == 1) {
             $namespace = null;
         }
         $this->view->permissions = \Core\Service\PermissionService::getInstance()->load(\App::getUserLogged()->getRoleId(), $namespace);
     }
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:36,代码来源:UserController.php

示例13: initUserAccount

 /**
  * User dependencies injection
  */
 public static function initUserAccount()
 {
     $ident = \Zend_Auth::getInstance()->getIdentity();
     // Transaction injection
     \App::get("trackingtoken");
     ProtoAbstractMapper::$accountingTransactionPrefix = 'Testing-';
     // User injection
     ProtoAbstractMapper::$accountingUserId = $ident['id'];
     ProtoAbstractMapper::$language = 'en';
     $user = \App::getUserLogged(null, true);
     $allowed = Zend_Controller_Action_HelperBroker::getStaticHelper('allowed');
     $allowed->setUser($user);
     AbstractMapper::$organizationId = $user->organizationId;
     // Org injection
     if (!empty($ident['orgId'])) {
         $org = OrgService::getInstance()->load($ident['orgId']);
         if (!$org) {
             $org = OrgModelFactory::factory(array('id' => $ident['orgId'], 'type' => OrganizationMapper::getTypeByOrgId($ident['orgId'])));
         }
         \App::getOrgUserLogged($org);
         AbstractMapper::$organizationId = $ident['orgId'];
     }
     WatcherMapper::getInstance()->destroySingleton();
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:27,代码来源:TestHelper.php

示例14: direct

 public function direct(SimModel $sim)
 {
     $allowed = Zend_Controller_Action_HelperBroker::getStaticHelper("allowed");
     $allowed->direct('read', $sim);
     /*
      * TODO Needs refactor. It should be done by filterNotAllowedFields
      */
     $user = \App::getUserLogged();
     if (!$user->monetaryDataAccess) {
         $sim->setExpenseMonthly(null);
         $sim->setExpenseDetail(null);
     }
     /*
      * TODO Needs refactor. It should be done by filterNotAllowedFields
      */
     try {
         $allowed->direct('read_time_and_consumption', $sim);
     } catch (\Application\Exceptions\ForbiddenException $e) {
         $sim->setTimeAndConsumption(null);
     }
     $filter = Zend_Controller_Action_HelperBroker::getStaticHelper("filterNotAllowedFields");
     $filter->direct("read_field", $sim);
     return $this;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:24,代码来源:CheckSimReadPermissions.php

示例15: postAction

 /**
  * Create a new user
  */
 public function postAction()
 {
     // Avoid setting custom id
     $data = $this->_helper->requestData(true);
     $data = $this->_helper->filter($data)->blacklist(array('id'));
     if (empty($data['customerId'])) {
         $data['customerId'] = \App::getUserLogged()->getOrganizationId();
     }
     $commercialGroup = new CommercialGroupModel($data);
     // Check if it's allowed
     $this->_helper->allowed('create', $commercialGroup);
     // Create the organization via its service
     $this->_cgSrv->create($commercialGroup);
     // Response with the organization id
     $this->view->data = $commercialGroup->getId();
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:19,代码来源:CommercialgroupController.php


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