mirror of https://github.com/MISP/MISP
fix: [Sharing groups] Various fixes to align the reported local instance URL as the external_baseurl if set, as opposed to always using the baseurl, fixes #4982
parent
f203c3fd5c
commit
6b58b51bd3
|
@ -122,7 +122,7 @@ class SharingGroupsController extends AppController
|
|||
return $this->RestResponse->describe('SharingGroup', 'add', false, $this->response->type());
|
||||
}
|
||||
$this->set('orgs', $orgs);
|
||||
$this->set('localInstance', Configure::read('MISP.baseurl'));
|
||||
$this->set('localInstance', empty(Configure::read('MISP.external_baseurl')) ? Configure::read('MISP.baseurl') : Configure::read('MISP.external_baseurl'));
|
||||
// We just pass true and allow the user to edit, since he/she is just about to create the SG. This is needed to reuse the view for the edit
|
||||
$this->set('user', $this->Auth->user());
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ class SharingGroupsController extends AppController
|
|||
$this->set('sharingGroup', $sharingGroup);
|
||||
$this->set('id', $id);
|
||||
$this->set('orgs', $orgs);
|
||||
$this->set('localInstance', Configure::read('MISP.baseurl'));
|
||||
$this->set('localInstance', empty(Configure::read('MISP.external_baseurl')) ? Configure::read('MISP.baseurl') : Configure::read('MISP.external_baseurl'));
|
||||
// We just pass true and allow the user to edit, since he/she is just about to create the SG. This is needed to reuse the view for the edit
|
||||
$this->set('user', $this->Auth->user());
|
||||
}
|
||||
|
@ -316,7 +316,11 @@ class SharingGroupsController extends AppController
|
|||
if (isset($sg['SharingGroupServer'])) {
|
||||
foreach ($sg['SharingGroupServer'] as $key => $sgs) {
|
||||
if ($sgs['server_id'] == 0) {
|
||||
$sg['SharingGroupServer'][$key]['Server'] = array('id' => "0", 'name' => 'Local instance', 'url' => Configure::read('MISP.baseurl'));
|
||||
$sg['SharingGroupServer'][$key]['Server'] = array(
|
||||
'id' => "0",
|
||||
'name' => 'Local instance',
|
||||
'url' => empty(Configure::read('MISP.external_baseurl')) ? Configure::read('MISP.baseurl') : Configure::read('MISP.external_baseurl')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,7 +270,10 @@ class SharingGroup extends AppModel
|
|||
if (isset($server['Server'][0])) {
|
||||
$server['Server'] = $server['Server'][0];
|
||||
}
|
||||
if ($server['Server']['url'] == Configure::read('MISP.baseurl')) {
|
||||
if (
|
||||
$server['Server']['url'] == Configure::read('MISP.baseurl') ||
|
||||
(!empty(Configure::read('MISP.external_baseurl')) && Configure::read('MISP.external_baseurl') === $server['Server']['url'])
|
||||
) {
|
||||
$serverCheck = true;
|
||||
if ($user['Role']['perm_sync'] && $server['all_orgs']) {
|
||||
$orgCheck = true;
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
servers.push({
|
||||
id: '<?php echo h($s['server_id']);?>',
|
||||
name: 'Local instance',
|
||||
url: '<?php echo h(Configure::read('MISP.baseurl'));?>',
|
||||
url: '<?php echo empty(Configure::read('MISP.external_baseurl')) ? Configure::read('MISP.baseurl') : Configure::read('MISP.external_baseurl');?>',
|
||||
all_orgs: '<?php echo h($s['all_orgs']); ?>',
|
||||
removable:0,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue