Fixed an issue where an event's sharing group ID would get set to the first available option even when a non sharing group distribution level is selected

pull/834/merge
Iglocska 2016-01-07 16:33:35 +01:00
parent abb3340bff
commit 62a20a2321
5 changed files with 10 additions and 2 deletions

View File

@ -1 +1 @@
{"major":2, "minor":4, "hotfix":5}
{"major":2, "minor":4, "hotfix":6}

View File

@ -163,7 +163,10 @@ class AppModel extends Model {
}
}
break;
case 'fixNonEmptySharingGroupID':
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4';
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4';
break;
default:
return false;
break;

View File

@ -518,6 +518,8 @@ class Attribute extends AppModel {
$this->data['Attribute']['value'] = $result;
}
// always return true, otherwise the object cannot be saved
if (!isset($this->data['Attribute']['distribution']) || $this->data['Attribute']['distribution'] != 4) $this->data['Attribute']['sharing_group_id'] = 0;
return true;
}

View File

@ -409,6 +409,8 @@ class Event extends AppModel {
if (empty($this->data['Event']['date'])) {
$this->data['Event']['date'] = date('Y-m-d');
}
if (!isset($this->data['Event']['distribution']) || $this->data['Event']['distribution'] != 4) $this->data['Event']['sharing_group_id'] = 0;
}
public function isOwnedByOrg($eventid, $org) {

View File

@ -24,6 +24,7 @@ if (!$isSiteAdmin) exit();
<li><?php echo $this->Form->postLink('Upgrade to 2.4', $baseurl . '/servers/upgrade2324');?> (This script will make the final changes to the database to bring it up to speed with 2.4)</li>
<li><?php echo $this->Form->postLink('BETA UPDATES', $baseurl . '/servers/updateDatabase/24betaupdates');?> (This script will update your db from an earlier version of the beta)</li>
<li><?php echo $this->Form->postLink('Index tables', $baseurl . '/servers/updateDatabase/indexTables');?> (This script will create indeces for all of the tables in MISP (other than primary keys))</li>
<li><?php echo $this->Form->postLink('Fix non-empty sharing group IDs', $baseurl . '/servers/updateDatabase/fixNonEmptySharingGroupID');?> (This script will change the sharing_group_id to 0 in all non sharing group setting events and attributes))</li>
</ul>
</div>
<?php