/**
  * Determines, which value is needed for the onCampus parameter
  *
  * @return boolean
  */
 protected function getOnCampus()
 {
     if (null === $this->isOnCampus) {
         $this->isOnCampus = $this->permissionHandler ? $this->permissionHandler->hasPermission() : false;
     }
     return $this->isOnCampus;
 }
 /**
  * Test the handler if permission does not match
  * This should return the default PrimoInstance code
  * (if this is configured, for this test it is configured)
  *
  * @return void
  */
 public function testHandlerDefaultOnlyCodeNoOncampus()
 {
     $handler = new PrimoPermissionHandler($this->primoConfigDefaultOnlyNoOnCampusRule);
     $mockAuth = $this->getMockBuilder('ZfcRbac\\Service\\AuthorizationService')->disableOriginalConstructor()->getMock();
     $mockAuth->expects($this->any())->method('isGranted')->will($this->returnValue(false));
     $handler->setAuthorizationService($mockAuth);
     $this->assertEquals('DEFAULT', $handler->getInstCode());
 }
 /**
  * Get a PrimoPermissionHandler
  *
  * @return PrimoPermissionHandler
  */
 protected function getPermissionHandler()
 {
     if (isset($this->primoConfig->Institutions)) {
         $permHandler = new PrimoPermissionHandler($this->primoConfig->Institutions);
         $permHandler->setAuthorizationService($this->serviceLocator->get('ZfcRbac\\Service\\AuthorizationService'));
         return $permHandler;
     }
     // If no PermissionHandler can be set, return null
     return null;
 }