forked from rchavik/Audit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
274 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
App::uses('AuditAppController', 'Audit.Controller'); | ||
|
||
/** | ||
* SessionAudits Controller | ||
* | ||
* @property SessionAudit $SessionAudit | ||
* @property PaginatorComponent $Paginator | ||
*/ | ||
class SessionAuditsController extends AuditAppController { | ||
|
||
/** | ||
* Components | ||
* | ||
* @var array | ||
*/ | ||
public $components = array('Paginator'); | ||
|
||
/** | ||
* admin_index method | ||
* | ||
* @return void | ||
*/ | ||
public function admin_index() { | ||
$this->SessionAudit->recursive = 0; | ||
$this->set('sessionAudits', $this->paginate()); | ||
} | ||
|
||
/** | ||
* admin_view method | ||
* | ||
* @throws NotFoundException | ||
* @param string $id | ||
* @return void | ||
*/ | ||
public function admin_view($id = null) { | ||
if (!$this->SessionAudit->exists($id)) { | ||
throw new NotFoundException(__d('croogo', 'Invalid session audit')); | ||
} | ||
$options = array('conditions' => array('SessionAudit.' . $this->SessionAudit->primaryKey => $id)); | ||
$this->set('sessionAudit', $this->SessionAudit->find('first', $options)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
App::uses('AuditAppModel', 'Audit.Model'); | ||
|
||
/** | ||
* SessionAudit Model | ||
* | ||
* @property User $User | ||
* @property Source $Source | ||
* @property Session $Session | ||
*/ | ||
class SessionAudit extends AppModel { | ||
|
||
/** | ||
* belongsTo associations | ||
* | ||
* @var array | ||
*/ | ||
public $belongsTo = array( | ||
'User' => array( | ||
'className' => 'User', | ||
'foreignKey' => 'user_id', | ||
'conditions' => '', | ||
'fields' => '', | ||
'order' => '' | ||
), | ||
'Source' => array( | ||
'className' => 'User', | ||
'foreignKey' => 'source_id', | ||
'conditions' => '', | ||
'fields' => '', | ||
'order' => '' | ||
), | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
$this->viewVars['title_for_layout'] = __d('croogo', 'Session Audits'); | ||
$this->extend('/Common/admin_index'); | ||
|
||
$this->Html | ||
->addCrumb('', '/admin', array('icon' => 'home')) | ||
->addCrumb(__d('croogo', 'Session Audits'), array('action' => 'index')); | ||
|
||
?> | ||
|
||
<div class="sessionAudits index"> | ||
<table class="table table-striped"> | ||
<tr> | ||
<th> | ||
<?php echo $this->Paginator->sort('id'); ?><br /> | ||
<?php echo $this->Paginator->sort('session_id'); ?><br /> | ||
<?php echo $this->Paginator->sort('event'); ?> | ||
</th> | ||
<th><?php echo $this->Paginator->sort('user_id'); ?></th> | ||
<th><?php echo $this->Paginator->sort('source_id'); ?></th> | ||
<th><?php echo $this->Paginator->sort('remote_addr'); ?></th> | ||
<th> | ||
<?php echo $this->Paginator->sort('ua'); ?><br /> | ||
<?php echo $this->Paginator->sort('referer'); ?><br /> | ||
<?php echo $this->Paginator->sort('created'); ?> | ||
</th> | ||
<th class="actions"><?php echo __d('croogo', 'Actions'); ?></th> | ||
</tr> | ||
<?php foreach ($sessionAudits as $sessionAudit): ?> | ||
<tr> | ||
<td> | ||
<?php echo h($sessionAudit['SessionAudit']['id']); ?> <br /> | ||
<?php echo h($sessionAudit['SessionAudit']['session_id']); ?> <br /> | ||
<?php echo h($sessionAudit['SessionAudit']['event']); ?> | ||
</td> | ||
<td> | ||
<?php | ||
echo $this->Html->link($sessionAudit['User']['name'], array( | ||
'plugin' => 'users', 'controller' => 'users', 'action' => 'view', | ||
$sessionAudit['User']['id'] | ||
)); | ||
?> | ||
</td> | ||
<td> | ||
<?php | ||
echo $this->Html->link($sessionAudit['Source']['name'], array( | ||
'plugin' => 'users', 'controller' => 'users', 'action' => 'view', | ||
$sessionAudit['Source']['id'], | ||
)); | ||
?> | ||
</td> | ||
<td><?php echo h($sessionAudit['SessionAudit']['remote_addr']); ?> </td> | ||
<td> | ||
<?php | ||
list($ua,)= explode(' ', $sessionAudit['SessionAudit']['ua']); | ||
echo $this->Html->tag('span', $ua, array( | ||
'title' => $sessionAudit['SessionAudit']['ua'], | ||
)); | ||
?> </br> | ||
<?php echo h($sessionAudit['SessionAudit']['referer']); ?> <br /> | ||
<?php echo h($sessionAudit['SessionAudit']['created']); ?> | ||
</td> | ||
<td class="item-actions"> | ||
<?php echo $this->Croogo->adminRowAction('', array('action' => 'view', $sessionAudit['SessionAudit']['id']), array('icon' => 'eye-open')); ?> | ||
</td> | ||
</tr> | ||
<?php endforeach; ?> | ||
</table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<?php | ||
$this->viewVars['title_for_layout'] = sprintf('%s: %s', __d('croogo', 'Session Audits'), h($sessionAudit['SessionAudit']['id'])); | ||
|
||
$this->Html | ||
->addCrumb('', '/admin', array('icon' => 'home')) | ||
->addCrumb(__d('croogo', 'Session Audits'), array('action' => 'index')); | ||
|
||
?> | ||
<h2 class="hidden-desktop"><?php echo __d('croogo', 'Session Audit'); ?></h2> | ||
|
||
<div class="row-fluid"> | ||
<div class="span12 actions"> | ||
<ul class="nav-buttons"> | ||
<li><?php echo $this->Html->link(__d('croogo', 'Edit Session Audit'), array('action' => 'edit', $sessionAudit['SessionAudit']['id']), array('button' => 'default')); ?> </li> | ||
<li><?php echo $this->Form->postLink(__d('croogo', 'Delete Session Audit'), array('action' => 'delete', $sessionAudit['SessionAudit']['id']), array('button' => 'danger', 'escape' => true), __d('croogo', 'Are you sure you want to delete # %s?', $sessionAudit['SessionAudit']['id'])); ?> </li> | ||
<li><?php echo $this->Html->link(__d('croogo', 'List Session Audits'), array('action' => 'index'), array('button' => 'default')); ?> </li> | ||
<li><?php echo $this->Html->link(__d('croogo', 'New Session Audit'), array('action' => 'add'), array('button' => 'success')); ?> </li> | ||
<li><?php echo $this->Html->link(__d('croogo', 'List Users'), array('controller' => 'users', 'action' => 'index')); ?> </li> | ||
<li><?php echo $this->Html->link(__d('croogo', 'New User'), array('controller' => 'users', 'action' => 'add')); ?> </li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<div class="sessionAudits view"> | ||
<dl class="inline"> | ||
<dt><?php echo __d('croogo', 'Id'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['id']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Event'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['event']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'User'); ?></dt> | ||
<dd> | ||
<?php echo $this->Html->link($sessionAudit['User']['name'], array('controller' => 'users', 'action' => 'view', $sessionAudit['User']['id'])); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Source'); ?></dt> | ||
<dd> | ||
<?php echo $this->Html->link($sessionAudit['Source']['name'], array('controller' => 'users', 'action' => 'view', $sessionAudit['Source']['id'])); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Host'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['host']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Ua'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['ua']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Referer'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['referer']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Server Name'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['server_name']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Server Address'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['server_address']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Server Port'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['server_port']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Remote Addr'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['remote_addr']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Request Scheme'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['request_scheme']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Request Time'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['request_time']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Request Time Float'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['request_time_float']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Description'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['description']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Session Id'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['session_id']); ?> | ||
| ||
</dd> | ||
<dt><?php echo __d('croogo', 'Created'); ?></dt> | ||
<dd> | ||
<?php echo h($sessionAudit['SessionAudit']['created']); ?> | ||
| ||
</dd> | ||
</dl> | ||
</div> |