Exemplo n.º 1
0
 public function canUserViewLogEntry(User $user, LogEntry $logEntry)
 {
     if ($this->hasUserGlobalAccess($user)) {
         return true;
     }
     if ($user->hasRole('sensitive')) {
         return true;
     }
     if ($logEntry->getType() === 'SYSTEM') {
         //Information not for the common folk.
         return false;
     }
     if ($logEntry->getHost() instanceof Host) {
         return $this->canUserViewHost($user, $logEntry->getHost());
     }
     return false;
 }
Exemplo n.º 2
0
 public function export(LogEntry $entity)
 {
     $host = $entity->getHost();
     $service = $entity->getService();
     return array('id' => (string) $entity->getId(), 'type' => $entity->getType(), 'timestamp' => $entity->getTimestamp(), 'value' => $entity->getValue(), 'host' => array('id' => $host instanceof Host ? (string) $host->getId() : null, 'address' => $host instanceof Host ? $host->getAddress() : null), 'service' => array('id' => $service instanceof Service ? (string) $service->getId() : null));
 }