Merge branch '2.4' of github.com:MISP/MISP into 2.4

pull/5560/head
mokaddem 2020-04-07 14:58:15 +02:00
commit b3c114a13a
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
3 changed files with 6 additions and 6 deletions

View File

@ -2452,7 +2452,7 @@ class UsersController extends AppController
$this->set('roles', $roles);
$this->set('role_perms', $role_perms);
$orgConditions = array('OR' => array('local' => 1));
if (!empty($suggestedOrg)) {
if (!empty($suggestedOrg) && is_array($suggestedOrg)) {
$orgConditions['OR'] = array('Organisation.id' => $suggestedOrg[0]);
}
$this->set('orgs', $this->User->Organisation->find('list', array(

View File

@ -431,7 +431,7 @@ class Organisation extends AppModel
public function checkDesiredOrg($suggestedOrg, $registration)
{
if ($suggestedOrg !== false) {
if ($suggestedOrg !== false && $suggestedOrg !== -1) {
$conditions = array();
if (!empty($registration['Inbox']['data']['org_uuid'])) {
$conditions = array('Organisation.uuid' => $registration['Inbox']['data']['org_uuid']);
@ -443,10 +443,10 @@ class Organisation extends AppModel
'fields' => array('id', 'name', 'local'),
'conditions' => $conditions
));
if (!empty($suggestedOrg) && $suggestedOrg[0] !== $identifiedOrg['Organisation']['id']) {
if (empty($identifiedOrg)) {
$suggestedOrg = -1;
} else if (!empty($suggestedOrg) && $suggestedOrg[0] !== $identifiedOrg['Organisation']['id']) {
$suggestedOrg = false;
} else if (empty($identifiedOrg)) {
$suggestedOrg = -1;
} else {
$suggestedOrg = array($identifiedOrg['Organisation']['id'], $identifiedOrg['Organisation']['name'], $identifiedOrg['Organisation']['local']);
}

View File

@ -62,7 +62,7 @@
'class' => 'input-xxlarge',
'required' => 1,
'options' => $orgs,
'default' => empty($suggestedOrg) ? false : $suggestedOrg[0]
'default' => empty($suggestedOrg[0]) ? false : $suggestedOrg[0]
),
array(
'field' => 'role_id',