示例#1
0
 /**
  * Get content from listeners
  */
 public function getAuthenticationContent()
 {
     $content = '';
     if ($this->dispatcher->hasListeners(UserEvents::USER_AUTHENTICATION_CONTENT)) {
         $event = new AuthenticationContentEvent($this->request);
         $this->dispatcher->dispatch(UserEvents::USER_AUTHENTICATION_CONTENT, $event);
         $content = $event->getContent();
         // Remove post_logout session after content has been generated
         $this->request->getSession()->remove('post_logout');
     }
     return $content;
 }
示例#2
0
 /**
  * Returns true if the listener is implemented for a resourceType and an action
  *
  * @param ResourceType $resourceType
  * @param string       $actionName
  */
 public function isResourceActionImplemented(ResourceType $resourceType = null, $actionName)
 {
     if ($resourceType) {
         $alwaysTrue = array('rename', 'edit-properties', 'edit-rights', 'open-tracking');
         //first, directories can be downloaded even if there is no listener attached to it
         if ($resourceType->getName() === 'directory' && $actionName == 'download') {
             return true;
         }
         if (in_array($actionName, $alwaysTrue)) {
             return true;
         }
         $eventName = $actionName . '_' . $resourceType->getName();
     } else {
         $eventName = 'resource_action_' . $actionName;
     }
     return $this->dispatcher->hasListeners($eventName);
 }