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


PHP Zend_Acl_Resource_Interface类代码示例

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


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


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