Server moved to new org object

- relation added
- index updated
pull/762/head
Iglocska 2015-04-20 15:12:36 +02:00
parent c44bee0e96
commit 00dd47ef5e
3 changed files with 23 additions and 7 deletions

View File

@ -18,7 +18,7 @@ class ServersController extends AppController {
'maxLimit' => 9999, // LATER we will bump here on a problem once we have more than 9999 events
'order' => array(
'Server.url' => 'ASC'
)
),
);
public $uses = array('Server', 'Event');
@ -43,11 +43,12 @@ class ServersController extends AppController {
$this->Server->recursive = 0;
if ($this->_isSiteAdmin()) {
$this->paginate = array(
'conditions' => array(),
'conditions' => array(),
'fields' => array('Server.*', 'Organisation.name', 'Organisation.id'),
);
} else {
if (!$this->userRole['perm_sync'] && !$this->userRole['perm_admin']) $this->redirect(array('controller' => 'events', 'action' => 'index'));
$conditions['Server.org LIKE'] = $this->Auth->user('org');
$conditions['Server.org_id LIKE'] = $this->Auth->user('org_id');
$this->paginate = array(
'conditions' => array($conditions),
);

View File

@ -13,6 +13,14 @@ class Server extends AppModel {
'userKey' => 'user_id',
'change' => 'full'
), 'Trim');
public $belongsTo = array(
'Organisation' => array(
'className' => 'Organisation',
'foreignKey' => 'org_id',
//'conditions' => array('SharingGroupElement.organisation_uuid' => 'Organisation.uuid')
)
);
/**
* Display field

View File

@ -18,6 +18,7 @@
</div>
<table class="table table-striped table-hover table-condensed">
<tr>
<th><?php echo $this->Paginator->sort('name');?></th>
<th><?php echo $this->Paginator->sort('push');?></th>
<th><?php echo $this->Paginator->sort('pull');?></th>
<th><?php echo $this->Paginator->sort('url');?></th>
@ -32,13 +33,19 @@
<?php
foreach ($servers as $server): ?>
<tr>
<td class="short" style="text-align: center;"><?php echo ($server['Server']['push'])? 'Yes' : 'No'; ?>&nbsp;</td>
<td class="short" style="text-align: center;"><?php echo ($server['Server']['pull'])? 'Yes' : 'No'; ?>&nbsp;</td>
<td>
<?php
if (!empty($server['Server']['name'])) echo h($server['Server']['name']);
else echo h($server['Server']['url']);
?>
</td>
<td class="short"><span class="<?php echo ($server['Server']['push']? 'icon-ok' : 'icon-remove'); ?>"></span></td>
<td class="short"><span class="<?php echo ($server['Server']['pull']? 'icon-ok' : 'icon-remove'); ?>"></span></td>
<td><?php echo h($server['Server']['url']); ?>&nbsp;</td>
<td><?php echo h($server['Server']['organization']); ?>&nbsp;</td>
<td class="short"><?php echo h($server['Server']['cert_file']); ?>&nbsp;</td>
<td class="short"><?php echo ($server['Server']['self_signed'] ? 'Yes' : 'No'); ?>&nbsp;</td>
<td class="short"><?php echo h($server['Server']['org']); ?>&nbsp;</td>
<td class="short"><span class="<?php echo ($server['Server']['self_signed'] ? 'icon-ok' : 'icon-remove'); ?>"></span></td>
<td class="short"><?php echo h($server['Organisation']['name']); ?>&nbsp;</td>
<td class="short"><?php echo $server['Server']['lastpulledid']; ?></td>
<td class="short"><?php echo $server['Server']['lastpushedid']; ?></td>
<td class="short action-links">