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

PHP Zend_Acl_Resource_Interface类代码示例

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

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



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

示例1: assert

 public function assert(Core_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         return false;
     }
     $controller = Controlador::getInstance();
     $usuario = $controller->usuario;
     $somenteUltimo = false;
     $contexto = $resource->getContexto($somenteUltimo);
     // Se houver um contexto, e o usuario tem permissao para o recurso
     if (!is_null($contexto)) {
         // Checa se o usuario tem permissao de acessar o recurso
         if (!$controller->cache->test('privilegio_' . $usuario->ID . '_' . $resource->id)) {
             // não existe o cache, pegar o valor do banco
             $privilegio = DaoRecurso::getPrivilegioByUsuario($usuario, $resource);
             $controller->cache->save($privilegio, 'privilegio_' . $usuario->ID . '_' . $resource->id, array('acl_usuario_' . $usuario->ID, 'acl_unidade_' . $usuario->ID_UNIDADE));
         } else {
             $privilegio = $controller->cache->load('privilegio_' . $usuario->ID . '_' . $resource->id);
         }
         if ($privilegio) {
             foreach ($contexto as $umContexto) {
                 // checa se o objeto do contexto tem a mesma area de trabalho do usuario
                 if ($umContexto['id_unid_area_trabalho'] == $usuario->ID_UNIDADE) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:31,代码来源:AreaTrabalhoEPermissao.php


示例2: 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)
 {
     switch (true) {
         case $resource instanceof CommercialGroupModel:
             //return the restricted boolean value of the commercial group
             return $resource->getRestricted();
     }
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:22,代码来源:IsRestricted.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)
 {
     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


示例4: 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)
 {
     $feedbackId = $model->getFeedbackId();
     //$request = Zend_Controller_Front::getInstance()->getRequest();
     //$param = $request->getParam('id');
     $post = $model->getPostArray();
     // posted feedback id
     $param = $post['id'];
     // check if posted feedbackId is the same as feedbackId retrieved from cookie
     if ($param !== null && $param == $feedbackId) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:br00k,项目名称:tnc-web,代码行数:24,代码来源:GuestCanSaveFeedbackAssertion.php


示例5: 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 UserModel) {
         throw new Exception('Resource must be an instance of UserModel');
     }
     return $role->getRoleId() === $resource->getRoleId();
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:29,代码来源:SameRole.php


示例6: 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


示例7: validaControleAtivo

 /**
  * validacao se o controle está ativo
  * @param Zend_Acl_Resource_Interface $oResource
  * @param string $sPrivilegio
  */
 protected function validaControleAtivo(Zend_Acl_Resource_Interface $oResource, $sPrivilegio)
 {
     $aIdentidadeControle = explode(':', $oResource->getResourceId());
     $sIdentidadeControle = $aIdentidadeControle[1];
     $sIdentidadeModulo = $aIdentidadeControle[0];
     $oModulo = Administrativo_Model_Modulo::getByAttribute('identidade', $sIdentidadeModulo);
     $aControles = $oModulo->getControles();
     foreach ($aControles as $oControle) {
         if ($oControle->getIdentidade() != $sIdentidadeControle) {
             continue;
         }
         if (!$oControle->getVisivel()) {
             return TRUE;
         }
     }
     return TRUE;
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:22,代码来源:validacaoExtraAcl.php


示例8: 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


示例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)
 {
     // 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');
     }
     switch (true) {
         case $resource instanceof \Application\Model\Organization\OrgServiceProviderModel:
         case $resource instanceof \Application\Model\Organization\OrgCustomerModel:
             return $resource->getSubscriptionCount() === 0;
         default:
             throw new Exception('Resource must be an instance of OrgServiceProviderModel or OrgCustomerModel');
     }
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:32,代码来源:OrgHasNoSims.php


示例10: 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');
     }
     switch (true) {
         case $resource instanceof Model\PreBillModel:
             return $resource->getPublished();
         case $resource instanceof Model\ServicePackModel:
         case $resource instanceof Model\SupplServicesModel:
             return $resource->getPublished() === Model\ServicePackModel::STATUS_PUBLISHED;
     }
     throw new Exception('Resource must be an instance of ServicePack or PreBill');
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:33,代码来源:Published.php


示例11: 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)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     // have to hack this because of the 'oneitem' route all controller/action combo's will execute this assertion
     // @todo: change this in the oneitem route somehow?
     if ($request->getControllerName() !== 'user') {
         return true;
     }
     $param = $request->getParam('id', null);
     if (!$param) {
         return true;
     }
     // perform check
     if ($model->getUserById($param)->hasRole(array('presenter', 'chair'))) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:GEANT,项目名称:CORE,代码行数:28,代码来源:ShowUserAssertion.php


示例12: 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 (NULL === $role || NULL === $resource) {
         return false;
     }
     if (!$role instanceof \Application\Model\UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     if (!$resource instanceof \Application\Model\Organization\OrgCustomerModel) {
         throw new Exception('Org must be an instance of OrgCustomerModel');
     }
     foreach ($resource->getAllBillingAccounts() as $billing) {
         // Basic info billing cycle start day is not modifiable if one of
         // billings is inheriting this value and it is not modifiable
         if (empty($billing->billingCycleStartDay) && !$billing->billingCycleModifiable) {
             return false;
         }
     }
     return true;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:34,代码来源:BillingCycleModifiable.php


示例13: 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


示例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)
 {
     // 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


示例15: 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();
     $org = Service\OrgService::getInstance()->load($orgId);
     if (!$org) {
         return false;
     }
     switch (true) {
         case $resource instanceof Model\ServicePackModel:
             return $org->getParentId() === $resource->getServiceProvider();
     }
     throw new Exception('Resource must be an instance of ServicePack');
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:35,代码来源:ParentOrganization.php


示例16: assert

 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         return false;
     }
     $ident = $auth->getIdentity();
     if ($resource->getResourceId() == 'projects_m_project') {
         foreach ($resource->Projects_Model_Leader as $leader) {
             if ($leader->user_id == $ident->id) {
                 return true;
             }
         }
         return false;
     } else {
         $q = Doctrine_Query::create()->from('Projects_Model_Leader pl')->where('user_id = ?', $ident->id);
         if ($q->count()) {
             return true;
         }
         return false;
     }
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:22,代码来源:IsLeader.php


示例17: assert

 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     if (!$resource instanceof Issues_Model_Abstract) {
         throw new Issues_Model_Exception('Invalid resource for this assertion');
     }
     list($resourceType, $resourceId) = explode('-', $resource->getResourceId());
     if (!$resource->isPrivate()) {
         return $acl->isAllowed($role, $resourceType, $privilege);
     }
     $userService = Zend_Registry::get('Default_DiContainer')->getUserService();
     $userRoles = $userService->getIdentity()->getRoles();
     foreach ($userRoles as $i) {
         $roles[] = $i->getRoleId();
     }
     $aclService = Zend_Registry::get('Default_DiContainer')->getAclService();
     $records = $aclService->getResourceRecords($roles, $resourceType, $resourceId);
     if (count($records)) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:Roave,项目名称:issues,代码行数:22,代码来源:HasPermissionAssertion.php


示例18: 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 a sim');
     }
     $org = $resource->getCustomer();
     if (!$org) {
         $org = $role->getOrganization();
         if (!$org instanceof OrgCustomerModel) {
             return false;
         }
     }
     return $org ? $org->timeAndConsumptionVoucherIsEnabled : false;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:36,代码来源:TimeAndConsumptionVoucherEnabled.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  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) {
         if ($role instanceof \Application\Model\CurrentUserModel && $role->isApiAuthUser()) {
             return $role->apiId == $resource->owner;
         }
         return $role->id === $resource->owner;
     }
     if ($resource instanceof UserConfigModel) {
         return $role->id === $resource->userId;
     }
     if (!$resource instanceof UserModel) {
         throw new Exception('Resource must be an instance of UserModel');
     }
     return $role->getId() === $resource->getId();
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:38,代码来源:SameUser.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  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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Acl_Role_Interface类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Acl类代码示例发布时间: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