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


PHP AuthorizationPolicy::effect方法代码示例

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


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

示例1: isValid

 /**
  * @see HandlerValidator::isValid()
  */
 function isValid()
 {
     // Delegate to the AuthorizationPolicy
     if (!$this->_policy->applies()) {
         return false;
     }
     if ($this->_policy->effect() == AUTHORIZATION_DENY) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:15,代码来源:HandlerValidatorPolicy.inc.php

示例2: isValid

 /**
  * @see HandlerValidator::isValid()
  */
 function isValid()
 {
     // Delegate to the AuthorizationPolicy
     if (!$this->_policy->applies()) {
         return false;
     }
     // Pass the authorized context to the police.
     $this->_policy->setAuthorizedContext($this->handler->getAuthorizedContext());
     if ($this->_policy->effect() == AUTHORIZATION_DENY) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:17,代码来源:HandlerValidatorPolicy.inc.php

示例3: testAuthorizationPolicy

 /**
  * @covers AuthorizationPolicy
  */
 public function testAuthorizationPolicy()
 {
     $policy = new AuthorizationPolicy('some message');
     // Test advice.
     self::assertTrue($policy->hasAdvice(AUTHORIZATION_ADVICE_DENY_MESSAGE));
     self::assertFalse($policy->hasAdvice(AUTHORIZATION_ADVICE_CALL_ON_DENY));
     self::assertEquals('some message', $policy->getAdvice(AUTHORIZATION_ADVICE_DENY_MESSAGE));
     self::assertNull($policy->getAdvice(AUTHORIZATION_ADVICE_CALL_ON_DENY));
     // Test authorized context objects.
     self::assertFalse($policy->hasAuthorizedContextObject(ASSOC_TYPE_USER_GROUP));
     $someContextObject = new DataObject();
     $someContextObject->setData('test1', 'test1');
     $policy->addAuthorizedContextObject(ASSOC_TYPE_USER_GROUP, $someContextObject);
     self::assertTrue($policy->hasAuthorizedContextObject(ASSOC_TYPE_USER_GROUP));
     self::assertEquals($someContextObject, $policy->getAuthorizedContextObject(ASSOC_TYPE_USER_GROUP));
     self::assertEquals(array(ASSOC_TYPE_USER_GROUP => $someContextObject), $policy->getAuthorizedContext());
     // Test authorized context.
     $someOtherContextObject = new DataObject();
     $someOtherContextObject->setData('test2', 'test2');
     $authorizedContext = array(ASSOC_TYPE_USER_GROUP => $someOtherContextObject);
     $policy->setAuthorizedContext($authorizedContext);
     self::assertEquals($authorizedContext, $policy->getAuthorizedContext());
     // Test default policies.
     self::assertTrue($policy->applies());
     self::assertEquals(AUTHORIZATION_DENY, $policy->effect());
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:29,代码来源:AuthorizationPolicyTest.php


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