chg: [internal] instead of replicating the event level distribution rules, the attribute model now inherits the event code

pull/3530/head
iglocska 2018-08-03 11:34:55 +02:00
parent 057eecf852
commit f712efe85e
1 changed files with 3 additions and 20 deletions

View File

@ -2560,28 +2560,11 @@ class Attribute extends AppModel
{
$conditions = array();
if (!$user['Role']['perm_site_admin']) {
$sgids = $this->SharingGroup->fetchAllAuthorised($user);
$sgids = $this->Event->cacheSgids($user, true);
$eventConditions = $this->Event->createEventConditions($user);
$conditions = array(
'AND' => array(
array(
'OR' => array(
'Event.org_id' => $user['org_id'],
array(
'AND' => array(
'Event.distribution >' => 0,
'Event.distribution <' => 4,
Configure::read('MISP.unpublishedprivate') ? array('Event.published =' => 1) : array(),
),
),
array(
'AND' => array(
'Event.sharing_group_id' => $sgids,
'Event.distribution' => 4,
Configure::read('MISP.unpublishedprivate') ? array('Event.published =' => 1) : array(),
)
)
)
),
$eventConditions['AND'],
array(
'OR' => array(
'Event.org_id' => $user['org_id'],