本文整理汇总了PHP中App::getOrgUserLogged方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getOrgUserLogged方法的具体用法?PHP App::getOrgUserLogged怎么用?PHP App::getOrgUserLogged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App::getOrgUserLogged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* @param DownloadTokenModel $downloadToken
* @return DownloadTokenModel
*/
public function create(models\ModelAbstract $downloadToken)
{
if (!$downloadToken instanceof DownloadTokenModel) {
throw new InvalidArgumentException('Supplied data must be a download token model');
}
$downloadToken->token = UserService::getInstance()->generatePassword(60);
$brandService = BrandService::getInstance();
$brand = $brandService->loadByOrganization(\App::getOrgUserLogged());
$router = \Zend_Controller_Front::getInstance()->getRouter();
$downloadToken->url = $brand->endPoint . $router->assemble(array('controller' => $downloadToken->controller, 'action' => $downloadToken->action, 'token' => $downloadToken->token), 'downloadToken');
$downloadToken->orgId = \App::getOrgUserLogged()->getId();
$downloadToken->expireDatetime = \App::config('downloadTokenLifeTime', "+1 day");
$ident = \Zend_Auth::getInstance()->getIdentity();
if (isset($ident['username'])) {
$downloadToken->username = $ident['username'];
}
if (isset($ident['authType'])) {
$downloadToken->authType = $ident['authType'];
}
if (isset($ident['apiId'])) {
$downloadToken->apiId = $ident['apiId'];
}
if (isset($ident['impersonation'])) {
$downloadToken->impersonation = $ident['impersonation'];
}
return parent::create($downloadToken);
}
示例2: isValid
public function isValid($value, $context = null)
{
if (!parent::isValid($value, $context)) {
return false;
}
$cg = $this->_getCommercialGroup($value, 'id');
if ($cg === false) {
return false;
}
if ($cg === NULL) {
$this->_error(self::ERROR_COMMERCIAL_GROUP_NOT_EXISTS, $value);
return false;
}
if ($this->getCheckRestrictions()) {
$restricted = $cg->restricted;
switch (\App::getOrgUserLogged()->getType()) {
case OrgCustomerModel::ORG_TYPE:
if ($restricted) {
$this->_error(self::ERROR_COMMERCIAL_GROUP_RESTRICTED, $value);
return false;
}
}
}
return true;
}
示例3: dispatchLoopStartup
/**
* Route shutdown hook -- Check for router exceptions
*
* @param Zend_Controller_Request_Abstract $request
*/
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
$orgService = \Application\Service\OrgService::getInstance();
$identity = $auth->getIdentity();
//Bypass other auth methods
if ($identity['authType'] != App_Controller_Plugin_Auth::AUTH_TYPE_AUTH_TOKEN) {
return;
}
$front = Zend_Controller_Front::getInstance();
$bs = $front->getParam('bootstrap');
// Fetch logs and apply the token to them
$multilog = $bs->getPluginResource('multiplelog');
if (empty($identity['impersonation']) || empty($identity['impersonation']['orgId'])) {
return;
}
$orgId = $identity['impersonation']['orgId'];
$userSrv = UserService::getInstance();
\App::log()->info($identity['username'] . " is running as " . $orgId . " admin");
$user = $userSrv->loadByUsername($identity['username']);
$userSrv->generateImpersonatedUser($user, $identity['impersonation']);
foreach ($multilog->getLogs() as $log) {
$log->setEventItem('impersonated', "as {$orgId} admin");
$log->setEventItem('impersonatedOrgId', "{$orgId}");
$log->setEventItem('username', $identity['username'] . " as {$orgId} admin");
}
// Application\Model\Mapper\ProtoAbstractMapper::$accountingUserId .= "_impersonated";
Application\Model\Mapper\ProtoAbstractMapper::$organizationId = $orgId;
App_ListFilter::addDefaultExtraData('impersonated_org', $orgId);
$org = OrgService::getInstance()->load($orgId);
\App::getOrgUserLogged($org);
}
示例4: isValid
public function isValid($value, $context = null)
{
if (!parent::isValid($value, $context)) {
return false;
}
if ($value == BusinessRule::CHANGE_COMMERCIAL_GROUP) {
$type = App_Util_Array::getItem($context, '__parent.__parent.universeType');
if ($type == AlarmRuleModel::UNIVERSE_SUBSCRIPTIONS_OF_COMMERCIAL_GROUP || $type == AlarmRuleModel::UNIVERSE_COMMERCIAL_GROUP) {
$universeId = App_Util_Array::getItem($context, '__parent.__parent.universeId');
$cg = $this->_getCommercialGroup($universeId, 'id');
if ($cg === NULL) {
$this->_error(self::ERROR_COMMERCIAL_GROUP_NOT_EXISTS, $universeId);
return false;
}
$restricted = $cg->restricted;
switch (\App::getOrgUserLogged()->getType()) {
case OrgCustomerModel::ORG_TYPE:
if ($restricted) {
$mss = "{$type} with commercial group id {$universeId}";
$this->_error(self::ERROR_UNIVERSE_TYPE_COMMERCIAL_GROUP_RESTRICTED, $mss);
return false;
}
}
}
}
return true;
}
示例5: postAction
public function postAction()
{
$data = $this->_helper->requestData(true);
if (isset($data['endCustomerData'])) {
$data = $data['endCustomerData'];
}
// Filter data
$data = $this->_helper->filter($data)->blacklist($this->_getCreateBlackList());
//TODO filter should provide a fluent iface to apply these methods
$data = $this->_helper->filter($data)->removeEmpty();
$data = $this->_mapToModel($data);
$org = new OrgAggregatorModel($data);
$org->parentId = \App::getOrgUserLogged()->id;
$org->description = "Organization made by API";
// Check if it's allowed
$this->_helper->allowed('create', $org);
// Check mandatory fields
// $this->_preValidate($org->exportData(), new \Application\Model\Validate\Organization\OrgAggregatorValidate());
// Create the organization via its service
$this->_orgSrv->create($org);
// Response with the organization id
$this->view->endCustomerID = $org->getId();
$url = $this->getFrontController()->getRouter()->assemble(array('controller' => $this->getRequest()->getControllerName(), 'action' => $this->getRequest()->getActionName(), 'id' => $org->getId()));
$this->getResponse()->setHeader('Location', $url);
$this->getResponse()->setHttpResponseCode(201);
}
示例6: __construct
public function __construct($options = null)
{
parent::__construct($options);
if (isset($this->_spec['validators']['simType'])) {
unset($this->_spec['validators']['simType']);
}
if (isset($this->_spec['validators']['simModel'])) {
unset($this->_spec['validators']['simModel']);
}
if (isset($this->_spec['validators']['staticIpAddress']['Sim\\ApnSubnet'])) {
unset($this->_spec['validators']['staticIpAddress']['Sim\\ApnSubnet']);
}
$org = \App::getOrgUserLogged();
$orgConfig = \Application\Service\OrgService::getInstance()->getOrgConfig($org);
// check that ipv6 is disabled
if (isset($this->_spec['validators']['staticIpAddress']['Ip']) && $orgConfig->getConfig(OrgConfigModel::ORG_CONFIG_IPV6_DISABLED_KEY, OrgConfigModel::ORG_CONFIG_IPV6_DISABLED_DEFAULT)) {
$this->_spec['validators']['staticIpAddress']['Ip']['allowipv6'] = false;
}
if (isset($this->_spec['validators']['staticIpAddress']['NotEmptyIfField'])) {
unset($this->_spec['validators']['staticIpAddress']['NotEmptyIfField']);
}
if (isset($this->_spec['validators']['staticIpApnIndex'])) {
$this->_spec['validators']['staticIpApnIndex'] = array('ApnIndex' => array('breakChainOnFailure' => true, 'min' => 1, 'max' => 10));
}
/**
* @todo Move icc, imsi, msisdn to validators?
* @see AbstractParser.php
*/
$this->_spec['validators']['icc'] = array('regex' => array('pattern' => "/^[0-9]{2}[1-9][0-9]{0,2}[0-9]{1,4}[0-9]+\$/", 'breakChainOnFailure' => true), 'LuhnAlgorithm' => array('breakChainOnFailure' => true));
$this->_spec['validators']['imsi'] = array('regex' => array('pattern' => "/^[0-9]{15}\$/", 'breakChainOnFailure' => true));
$this->_spec['validators']['msisdn'] = array('regex' => array('pattern' => "/^[1-9][0-9]{0,2}[0-9]{1,15}\$/", 'breakChainOnFailure' => true));
$this->_spec['validators']['apns'] = array('ApnList' => array('breakChainOnFailure' => true));
$this->_spec['validators']['locationManual'] = array('LocationValidate' => array('breakChainOnFailure' => true, 'acceptArrayAsModel' => true));
}
示例7: _findByServiceType
protected function _findByServiceType($serviceType)
{
$filters = array("_parents" => 1, "organizationId" => \App::getOrgUserLogged()->id);
$result = $this->_getPybeService()->callMethod($this::LIST_METHOD, $filters);
$httpResponse = $this->_getPybeService()->getLastResult();
$this->_checkResponseResult($httpResponse, 'Pybe error looking for contracts by service type');
$valid_service_ids = array();
$services = \App_Util_Array::getItem($result, $this::SERVICE_KEY . '.items');
if ($services) {
foreach ($services as $service) {
if (isset($service['type']) && $service['type'] == $serviceType) {
$valid_service_ids[] = $service['id'];
}
}
}
if (!$valid_service_ids) {
return new ListResultModel(array('items' => array(), 'count' => 0));
}
$entries = array();
$candidateContracts = array();
$contracts = \App_Util_Array::getItem($result, $this::LIST_KEY . '.items');
if ($contracts) {
foreach ($contracts as $contract) {
if (isset($contract['serviceId'])) {
if (in_array($contract['serviceId'], $valid_service_ids)) {
$entries[] = $contract;
}
} elseif (isset($contract['parentContractId'])) {
if (isset($candidateContracts[$contract['parentContractId']])) {
$candidateContracts[$contract['parentContractId']][] = $contract;
} else {
$candidateContracts[$contract['parentContractId']] = array($contract);
}
}
}
}
if ($candidateContracts) {
$parentContracts = \App_Util_Array::getItem($result, $this::PARENT_KEY . '.items');
if ($parentContracts) {
foreach ($parentContracts as $contract) {
if (isset($contract['serviceId'])) {
if (in_array($contract['serviceId'], $valid_service_ids) and isset($candidateContracts[$contract['id']])) {
$entries = array_merge($entries, $candidateContracts[$contract['id']]);
}
}
}
}
}
if (!$entries) {
return new ListResultModel(array('items' => array(), 'count' => 0));
}
$outputItems = array();
foreach ($entries as $entry) {
$data = $this->_mapPybeModelToModel($entry);
$outputItems[] = !is_null($this->_modelClassResult) ? new $this->_modelClassResult($data) : $data;
}
return new ListResultModel(array('items' => $outputItems, 'count' => count($outputItems)));
}
示例8: getList
public function getList()
{
$options = array(Vpn::IP_TYPE_IPV4);
$config = OrgService::getInstance()->getOrgConfig(\App::getOrgUserLogged());
if (!$config->getConfig(OrgConfigModel::ORG_CONFIG_IPV6_DISABLED)) {
$options[] = Vpn::IP_TYPE_IPV6;
}
return $options;
}
示例9: indexAction
/**
* Return all the roles of a given organization or an
* associative list of all organizations and their roles.
*/
public function indexAction()
{
$orgClass = get_class(\App::getOrgUserLogged());
$orgType = $this->_getParam('orgType');
if (!$orgType || $orgClass::ORG_TYPE !== $orgType && $orgClass::CHILDREN_ORG_TYPE !== $orgType) {
throw new InvalidArgumentException("Invalid organization type.");
}
$this->view->roles = $this->_roleSrv->getRoles($orgType);
}
示例10: postAction
/**
*/
public function postAction()
{
// Filter data
$data = $this->_helper->requestData(true);
$data = $this->_helper->filter($data)->blacklist(array('id', 'organizationId'));
$template = new TemplateModel($data);
// Check if it's allowed
$this->_helper->allowed('create', $template);
$this->_templateSrv->create($template, \App::getOrgUserLogged());
// Response with the user id
$this->view->data = $template->getId();
}
示例11: setUp
public function setUp()
{
if (App::getEnv() !== 'testing-ericsson') {
$this->markTestSkipped();
}
$this->simMapper = SimMapper::getInstance();
// Hack: Override the logged user organization
$org = new \Application\Model\Organization\OrgMasterModel();
$org->setId(self::ORG_ID);
\App::getOrgUserLogged($org);
$this->_user = $this->_createAuthUser(array('userName' => 'SimUserTest', 'organizationId' => self::ORG_ID));
}
示例12: postAction
/**
* Create a new service group
*/
public function postAction()
{
// Create model
$data = $this->_helper->requestData(true);
$sg = new SupervisionGroupModel($data);
$org = \App::getOrgUserLogged();
$sg->setCustomerId($org->getId());
// Check permissions
$this->_helper->allowed('create', $sg);
$sg = SupervisionGroupService::getInstance()->create($sg);
// Response with the id
$this->view->data = $sg->getId();
}
示例13: consumptionAction
protected function consumptionAction()
{
// get the organization ID
$orgId = \App::getOrgUserLogged()->getId();
$start = $this->_getParam('start');
$end = $this->_getParam('end');
// get target params (comma delimited targets)
$target = $this->_getParam('target');
if (!empty($target)) {
$params = explode(',', $target);
}
$this->_reportSrv->getConsumptionData($orgId, $params, $start, $end);
}
示例14: 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());
}
示例15: 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) {
$org = \App::getOrgUserLogged();
$orgConfig = \Application\Service\OrgService::getInstance()->getOrgConfig($org);
$lteProvider = $orgConfig->getConfig(OrgConfigModel::ORG_CONFIG_LTE_ENABLED);
if (!$lteProvider) {
$this->_error(self::LTE_PROVIDER_DISABLED);
return false;
}
}
return true;
}