Example #1
0
 /**
  * Test 8
  *
  * Subject.role == Array()
  *
  * Result = Indeterminate
  *
  */
 public function testEvaluate8()
 {
     $request = $this->createRequest();
     \Galmi\Xacml\Config::set(\Galmi\Xacml\Config::ATTRIBUTE_FINDER, $this->createAttributeFinder());
     $matchMock = $this->getMockBuilder('\\Galmi\\Xacml\\Match')->setConstructorArgs(array('Subject.role', 'Manager'))->getMock();
     $matchMock->method('evaluate')->willReturn(\Galmi\Xacml\Match::INDETERMINATE);
     $allOf = new \Galmi\Xacml\TargetAllOf();
     $allOf->addMatch($matchMock);
     $anyOf = new \Galmi\Xacml\TargetAnyOf();
     $anyOf->addTargetAllOf($allOf);
     $target = new \Galmi\Xacml\Target();
     $target->addTargetAnyOf($anyOf);
     $this->assertEquals(\Galmi\Xacml\Match::INDETERMINATE, $target->evaluate($request), 'Test 8 is Indeterminate');
 }
Example #2
0
 public function testEvaluate()
 {
     $request = new \Galmi\Xacml\Request();
     $target = new \Galmi\Xacml\TargetAnyOf();
     $this->assertEquals(\Galmi\Xacml\Match::INDETERMINATE, $target->evaluate($request));
 }
Example #3
0
 /**
  *  -----------------------------------------------------------------------------------------
  * |       Target         |    Condition    |               Rule Value                       |
  *  -----------------------------------------------------------------------------------------
  * | “Indeterminate”      | Don’t care      | “Indeterminate{P}” if the Effect is Permit,    |
  * |                      |                 | or “Indeterminate{D}” if the Effect is Deny    |
  *  -----------------------------------------------------------------------------------------
  */
 public function testEvaluate4()
 {
     $request = $this->createRequest();
     $matchMock = $this->getMockBuilder('\\Galmi\\Xacml\\Match')->setConstructorArgs(array('Subject.role', 'Manager'))->getMock();
     $matchMock->method('evaluate')->willReturn(\Galmi\Xacml\Match::INDETERMINATE);
     $allOf = new \Galmi\Xacml\TargetAllOf();
     $allOf->addMatch($matchMock);
     $anyOf = new \Galmi\Xacml\TargetAnyOf();
     $anyOf->addTargetAllOf($allOf);
     $target = new \Galmi\Xacml\Target();
     $target->addTargetAnyOf($anyOf);
     $rule = new \Galmi\Xacml\Rule();
     $rule->setEffect(\Galmi\Xacml\Decision::PERMIT);
     $rule->setTarget($target);
     $this->assertEquals(\Galmi\Xacml\Decision::INDETERMINATE_P, $rule->evaluate($request));
     $rule = new \Galmi\Xacml\Rule();
     $rule->setEffect(\Galmi\Xacml\Decision::DENY);
     $rule->setTarget($target);
     $this->assertEquals(\Galmi\Xacml\Decision::INDETERMINATE_D, $rule->evaluate($request));
 }