• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Acl_Role_Interface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAcl

 /**
  * Get acl for role
  *
  * @param Zend_Acl_Role_Interface $role
  * @return Zend_Acl
  */
 public function getAcl(Zend_Acl_Role_Interface $role)
 {
     if (isset($this->cache[$role->getRoleId()])) {
         return $this->cache[$role->getRoleId()];
     }
     $acl = new Zend_Acl();
     // set resources
     $resources = $this->getResources();
     foreach (array_keys($resources) as $resource) {
         $acl->addResource($resource);
     }
     // get role parents if possible
     $method = self::PARENTS_METHOD;
     $parents = NULL;
     if (method_exists($role, $method)) {
         foreach ($role->{$method}() as $parent) {
             $parents[] = $parent;
             $acl->addRole($parent);
             $this->addRules($acl, $parent);
         }
     }
     // set role
     $acl->addRole($role, $parents);
     $this->addRules($acl, $role);
     return $this->cache[$role->getRoleId()] = $acl;
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:32,代码来源:Acl.php


示例2: addParent

 /**
  * Add parent to the $role node
  *
  * @param \Zend_Acl_Role_Interface|string $role
  * @param array|\Zend_Acl_Role_Interface|string $parents
  * @return $this
  * @throws \Zend_Acl_Role_Registry_Exception
  */
 public function addParent($role, $parents)
 {
     try {
         if ($role instanceof \Zend_Acl_Role_Interface) {
             $roleId = $role->getRoleId();
         } else {
             $roleId = $role;
             $role = $this->get($role);
         }
     } catch (\Zend_Acl_Role_Registry_Exception $e) {
         throw new \Zend_Acl_Role_Registry_Exception("Child Role id '{$roleId}' does not exist");
     }
     if (!is_array($parents)) {
         $parents = [$parents];
     }
     foreach ($parents as $parent) {
         try {
             if ($parent instanceof \Zend_Acl_Role_Interface) {
                 $roleParentId = $parent->getRoleId();
             } else {
                 $roleParentId = $parent;
             }
             $roleParent = $this->get($roleParentId);
         } catch (\Zend_Acl_Role_Registry_Exception $e) {
             throw new \Zend_Acl_Role_Registry_Exception("Parent Role id '{$roleParentId}' does not exist");
         }
         $this->_roles[$roleId]['parents'][$roleParentId] = $roleParent;
         $this->_roles[$roleParentId]['children'][$roleId] = $role;
     }
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:39,代码来源:Registry.php


示例3: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     // We need specific objects to check against each other
     if (NULL === $role || NULL === $resource) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     if (!$resource instanceof WatcherModel) {
         throw new Exception('Resource must be an instance of WatcherModel');
     }
     switch ($resource->scope) {
         case 'user':
             return $role->id == $resource->scopeId;
         case 'apiId':
             if (!$role instanceof \Application\Model\CurrentUserModel || !$role->isApiAuthUser()) {
                 return FALSE;
             }
             return $role->apiId == $resource->scopeId;
         case 'token':
             if (Zend_Auth::getInstance()->hasIdentity() && ($ident = Zend_Auth::getInstance()->getIdentity()) && isset($ident['token'])) {
                 return $ident['token'] === $resource->scopeId;
             }
             return false;
         case 'organization':
             return $role->organizationId === $resource->scopeId;
     }
     return false;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:45,代码来源:SameScope.php


示例4: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     // We need specific objects to check against each other
     if (NULL === $role) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     // Get the organization
     $orgService = \Application\Service\OrgService::getInstance();
     $org = $orgService->load($role->getOrganizationId());
     if ($org->getType() != OrgCustomerModel::ORG_TYPE) {
         $org = $orgService->getParentByType($org, OrgCustomerModel::ORG_TYPE);
     }
     if ($org && !is_null($org->getSupplementaryServicesId())) {
         // Check if the customer has supplementary services configured
         // with application originated SMS option activated
         $supplSrv = \Application\Service\SupplServicesService::getInstance();
         $services = $supplSrv->load($org->getSupplementaryServicesId());
         if ($services && $services->getApplicationOriginatedSms() == SupplServicesModel::ST_ACTIVATED) {
             return true;
         }
     }
     throw new Exception('Role must have applicationOriginatedSms activated');
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:41,代码来源:ActivatedApplicationOriginatedSms.php


示例5: assert

 /**
  * 判断是否有访问某个游戏的条件
  * 
  * @see Zend_Acl_Assert_Interface::assert()
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     if ($this->_request->has('gametype')) {
         $roleData = ZtChart_Model_Acl_Loader::getInstance()->getRole($role->getRoleId());
         return in_array($this->_request->getParam('gametype'), $roleData['role_gametype']);
     }
     return true;
 }
开发者ID:starflash,项目名称:ZtChart-ZF1-Example,代码行数:13,代码来源:GameType.php


示例6: getRules

 /**
  * Get rules for role
  *
  * @param Zend_Acl_Role_Interface $role
  * @return array
  */
 public function getRules(\Zend_Acl_Role_Interface $role)
 {
     $em = $this->doctrine->getManager();
     $queryBuilder = $em->getRepository('Newscoop\\Entity\\Acl\\Rule')->createQueryBuilder('r')->select('r.resource, r.action, r.type')->where('r.role = :role')->setParameter('role', $role->getRoleId());
     if (is_a($role, '\\Newscoop\\Entity\\User\\Group')) {
         // @fix WOBS-568: ignore deny rules for roles
         $queryBuilder->andWhere('r.type = :allow')->setParameter('allow', 'allow');
     }
     return $queryBuilder->getQuery()->getArrayResult();
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:16,代码来源:Storage.php


示例7: getRules

 /**
  * Get rules for role
  *
  * @param Zend_Acl_Role_Interface $role
  * @return array
  */
 public function getRules(\Zend_Acl_Role_Interface $role)
 {
     $em = $this->doctrine->getManager();
     $repository = $em->getRepository('Newscoop\\Entity\\Acl\\Rule');
     $criteria = array('role' => $role->getRoleId());
     if (is_a($role, '\\Newscoop\\Entity\\User\\Group')) {
         // @fix WOBS-568: ignore deny rules for roles
         $criteria['type'] = 'allow';
     }
     return $repository->findBy($criteria);
 }
开发者ID:alvsgithub,项目名称:Newscoop,代码行数:17,代码来源:Storage.php


示例8: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     // We need specific objects to check against each other
     if (NULL === $role) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     return $role->isImpersonating();
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:26,代码来源:Impersonating.php


示例9: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     if (!$resource instanceof App_ListFilter) {
         throw new Exception('Resource must be an instance of App_ListFilter');
     }
     $filter = $resource->getOneFilterByFieldName(SimFilterFields::SERVICE_PROVIDER_COMM);
     if (!$filter) {
         return false;
     }
     return $filter->getValue() == $role->getOrganizationId();
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:28,代码来源:FilterSameOrg.php


示例10: assert

 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     if (NULL === $role) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof \Application\Model\UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     $org = $role->getOrganization();
     $orgConfig = \Application\Service\OrgService::getInstance()->getOrgConfig($org);
     $keyConfig = $this->getKey();
     $valueConfig = $this->getValue();
     return $orgConfig->getConfig($keyConfig) == $valueConfig;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:15,代码来源:OrgConfig.php


示例11: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  null                        $privilege
  * @return bool
  * @throws Exception
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     if (NULL === $role || NULL === $resource) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof \Application\Model\UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     $org = $role->getOrganization();
     if (!$org instanceof \Application\Model\Organization\OrgServiceProviderModel) {
         throw new Exception('Org must be an instance of OrgServiceProviderModel');
     }
     return \Application\Service\OrgService::getInstance()->isEnabler($org);
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:30,代码来源:ServiceProviderEnabler.php


示例12: assert

 /**
  * This assertion should receive the actual User objects.
  *
  * @param Zend_Acl $acl
  * @param Zend_Acl_Role_Interface $user
  * @param Zend_Acl_Resource_Interface $model
  * @param $privilege
  * @return bool
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $user = null, Zend_Acl_Resource_Interface $model = null, $privilege = null)
 {
     if ($user) {
         $sessions = $user->getSessionsToChair();
     } else {
         return false;
     }
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $param = $request->getParam('id') ? $request->getParam('id') : $request->getParam('session_id');
     // perform check
     if ($param !== null && in_array((int) $param, $sessions, true)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:GEANT,项目名称:CORE,代码行数:25,代码来源:UserCanUpdateSessionAssertion.php


示例13: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     // We need specific objects to check against each other
     if (NULL === $role || NULL === $resource) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     $orgId = $role->getOrganizationId();
     if (!$resource instanceof SimModel) {
         throw new Exception('Resource must be an instance of SimModel');
     }
     return $orgId === $resource->getServiceProviderCommercialId();
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:30,代码来源:SameServiceProviderCommercial.php


示例14: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     if (!$resource instanceof OrgModelAbstract) {
         throw new Exception('Resource must be an instance of OrgModelAbstract');
     }
     $type = $resource->getType();
     if (!isset($this->_types[$type])) {
         throw new Exception('Resource has an undefined organization type');
     }
     $org = $role->getOrganization();
     $orgType = $org->getType();
     return $this->_diff($this->_types[$orgType], $this->_types[$type]);
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:30,代码来源:ChildOrganizationType.php


示例15: assert

 /**
  * This assertion should receive the actual Presentation objects.
  *
  * @param Zend_Acl $acl
  * @param Zend_Acl_Role_Interface $user
  * @param Zend_Acl_Resource_Interface $model
  * @param $privilege
  * @return bool
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $user = null, Zend_Acl_Resource_Interface $model = null, $privilege = null)
 {
     if ($user) {
         $presentations = $user->getMyPresentations();
     } else {
         return false;
     }
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $param = $request->getParam('id') ? $request->getParam('id') : $request->getParam('presentation_id');
     $presentation = $model->getPresentationById($param);
     // perform check
     if ($param !== null && $presentation->isBeforeEditDeadline() && in_array((int) $param, $presentations, true)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:GEANT,项目名称:CORE,代码行数:26,代码来源:UserCanUpdatePresentationAssertion.php


示例16: assert

 /**
  * Returns true if and only if the assertion conditions are met
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  null                        $privilege
  * @return bool
  * @throws Exception
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     // We need specific objects to check against each other
     if (NULL === $role || NULL === $resource) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     $orgId = $role->getOrganizationId();
     switch (true) {
         case $resource instanceof OrgModelAbstract:
             return $orgId === $resource->getParentId();
         case $resource instanceof Model\PreBillModel:
             return true;
             //TODO: we need serviceProviderId from ericsson
             return $orgId === $resource->getServiceProvider()->getId();
         case $resource instanceof UserModel:
             try {
                 $org = $resource->getOrganization();
                 if (NULL !== $org) {
                     return $orgId === $org->getParentId();
                 }
                 App::log()->err("User (" . $resource->getId() . ") organization (" . $resource->getOrganizationId() . ") doesn't exist");
                 return false;
             } catch (Exception $e) {
                 return false;
             }
         case $resource instanceof Model\CommercialGroupModel:
             // customerId is one of service provider customers?
             // TODO aggregatorId case?
             $org = OrgService::getInstance()->load($resource->getCustomerId());
             return $org && $orgId === $org->getParentId();
         case $resource instanceof Model\ReportModel:
             $params = $resource->getParams();
             if (isset($params['orgId']) && !empty($params['orgId'])) {
                 $org = OrgService::getInstance()->load($params['orgId']);
                 return $org && $orgId === $org->getParentId();
             } else {
                 return true;
             }
     }
     throw new Exception('Resource must be an instance of OrgModelAbstract or UserModel');
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:59,代码来源:ChildOrganization.php


示例17: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     // We need specific objects to check against each other
     if (NULL === $role) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     if (!$resource instanceof SimModel) {
         throw new Exception('Resource must be an instance of SimModel');
     }
     // Get the organization
     $orgService = \Application\Service\OrgService::getInstance();
     if ($orgService->getTypeById($role->getOrganizationId()) == OrgServiceProviderModel::ORG_TYPE) {
         $org = $orgService->load($resource->customerId);
     } else {
         $org = $orgService->load($role->getOrganizationId());
     }
     if ($org->getType() != OrgCustomerModel::ORG_TYPE) {
         $org = $orgService->getParentByType($org, OrgCustomerModel::ORG_TYPE);
     }
     if ($org && !is_null($org->getSupplementaryServicesId())) {
         // Check if the customer has supplementary services configured
         // with application originated SMS option activated
         $supplSrv = \Application\Service\SupplServicesService::getInstance();
         try {
             if ($orgService->getTypeById($role->getOrganizationId()) == OrgAggregatorModel::ORG_TYPE) {
                 $services = $supplSrv->load($org->getSupplementaryServicesId(), $org);
             } else {
                 $services = $supplSrv->load($org->getSupplementaryServicesId());
             }
         } catch (\Exception $e) {
             \App::log()->warn($e);
             return False;
         }
         if ($services && $services->advancedSupervision == SupplServicesModel::ST_ACTIVATED) {
             return true;
         }
     }
     return false;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:57,代码来源:ActivatedAdvSupervision.php


示例18: assert

 /**
  * This assertion should receive the actual User objects.
  *
  * @param Zend_Acl $acl
  * @param Zend_Acl_Role_Interface $user
  * @param Zend_Acl_Resource_Interface $model
  * @param $privilege
  * @return bool
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $user = null, Zend_Acl_Resource_Interface $model = null, $privilege = null)
 {
     if ($user) {
         $presentations = $user->getMyPresentations();
     } else {
         return false;
     }
     $param = Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
     if (!$param) {
         return false;
     }
     // get presentation_id
     $presentation = $model->getResource('presentationsusers')->getItemById($param)->presentation_id;
     // perform check
     if ($presentation !== null && in_array((int) $presentation, $presentations, true)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:GEANT,项目名称:CORE,代码行数:29,代码来源:UserCanModifyUserPresentationAssertion.php


示例19: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  null                        $privilege
  * @return bool
  * @throws Exception
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     if (NULL === $role || NULL === $resource) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof \Application\Model\UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     $org = $role->getOrganization();
     if ($org instanceof \Application\Model\Organization\OrgServiceProviderModel) {
         $orgConfigValidator = new App_Acl_Assert_OrgConfig(array('key' => OrgConfigModel::ORG_CONFIG_LTE_ENABLED, 'value' => true));
         return $orgConfigValidator->assert($acl, $role, $resource, $privilege);
     } else {
         if ($org instanceof \Application\Model\Organization\OrgCustomerModel) {
             return $org->lteEnabled;
         }
     }
     return false;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:35,代码来源:LteOrganization.php


示例20: assert

 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     // We need specific objects to check against each other
     if (NULL === $role || NULL === $resource) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof Model\UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     $orgId = $role->getOrganizationId();
     switch (true) {
         case $resource instanceof OrgModelAbstract:
             $parent = OrgService::getInstance()->load($resource->getParentId());
             if ($parent) {
                 return $orgId === $parent->getParentId();
             }
             return false;
     }
     throw new Exception('Resource must be an instance of OrgModelAbstract');
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:35,代码来源:GrandChildOrganization.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Amf_Parse_Amf3_Deserializer类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Acl_Resource_Interface类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap