When adding/editing a sync user, the choice to limit a user by instance settings shows empty lines for instances without a name

- use the URL in those cases instead
pull/796/head
iglocska 2015-12-21 12:08:08 +01:00
parent 000449ee81
commit d769942a15
1 changed files with 7 additions and 5 deletions

View File

@ -389,9 +389,10 @@ class UsersController extends AppController {
$conditions = array();
if (!$this->_isSiteAdmin()) $conditions['Server.org_id LIKE'] = $this->Auth->user('org_id');
$temp = $this->Server->find('all', array('conditions' => $conditions, 'recursive' => -1, 'fields' => array('id', 'name')));
$servers = array(0 => 'Nothing');
$servers = array(0 => 'Not bound to a server');
if (!empty($temp)) foreach ($temp as $t) {
$servers[$t['Server']['id']] = $t['Server']['name'];
if (!empty($t['Server']['name'])) $servers[$t['Server']['id']] = $t['Server']['name'];
else $servers[$t['Server']['id']] = $t['Server']['url'];
}
$this->set('servers', $servers);
$this->set(compact('roles'));
@ -518,10 +519,11 @@ class UsersController extends AppController {
$this->loadModel('Server');
$conditions = array();
if (!$this->_isSiteAdmin()) $conditions['Server.org_id LIKE'] = $this->Auth->user('org_id');
$temp = $this->Server->find('all', array('conditions' => $conditions, 'recursive' => -1, 'fields' => array('id', 'name')));
$servers = array(0 => 'Nothing');
$temp = $this->Server->find('all', array('conditions' => $conditions, 'recursive' => -1, 'fields' => array('id', 'name', 'url')));
$servers = array(0 => 'Not bound to a server');
foreach ($temp as $t) {
$servers[$t['Server']['id']] = $t['Server']['name'];
if (!empty($t['Server']['name'])) $servers[$t['Server']['id']] = $t['Server']['name'];
else $servers[$t['Server']['id']] = $t['Server']['url'];
}
$this->set('servers', $servers);
$this->set('orgs', $orgs);