mirror of https://github.com/MISP/MISP
fix: [tags] More granularity for local and global add tag buttons
parent
bbaffea65c
commit
41099defb2
|
@ -5,7 +5,8 @@
|
|||
array(
|
||||
'attributeId' => $attributeId,
|
||||
'tags' => $attributeTags,
|
||||
'tagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id']),
|
||||
'tagAccess' => ($isSiteAdmin || $mayModify),
|
||||
'localTagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id'] || (int)$me['org_id'] === Configure::read('MISP.host_org_id')),
|
||||
'scope' => 'attribute'
|
||||
)
|
||||
);
|
||||
|
|
|
@ -143,7 +143,17 @@ $quickEdit = function($fieldName) use ($editScope, $object, $event) {
|
|||
</td>
|
||||
<td class="short">
|
||||
<div class="attributeTagContainer">
|
||||
<?php echo $this->element('ajaxTags', array('attributeId' => $object['id'], 'tags' => $object['AttributeTag'], 'tagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id']), 'context' => $context, 'scope' => 'attribute', 'tagConflicts' => isset($object['tagConflicts']) ? $object['tagConflicts'] : array())); ?>
|
||||
<?php echo $this->element(
|
||||
'ajaxTags',
|
||||
array('attributeId' => $object['id'],
|
||||
'tags' => $object['AttributeTag'],
|
||||
'tagAccess' => ($isSiteAdmin || $mayModify),
|
||||
'localTagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id'] || (int)$me['org_id'] === Configure::read('MISP.host_org_id')),
|
||||
'context' => $context,
|
||||
'scope' => 'attribute',
|
||||
'tagConflicts' => isset($object['tagConflicts']) ? $object['tagConflicts'] : array()
|
||||
)
|
||||
); ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
'event' => $event,
|
||||
'tags' => $event['EventTag'],
|
||||
'tagAccess' => false,
|
||||
'localTagAccess' => false,
|
||||
'missingTaxonomies' => false,
|
||||
'columnised' => true,
|
||||
'static_tags_only' => 1,
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
break;
|
||||
}
|
||||
$full = $isAclTagger && $tagAccess && empty($static_tags_only);
|
||||
$fullLocal = $isAclTagger && $localTagAccess && empty($static_tags_only);
|
||||
$host_org_editor = (int)$me['org_id'] === Configure::read('MISP.host_org_id') && $isAclTagger && empty($static_tags_only);
|
||||
$tagData = "";
|
||||
foreach ($tags as $tag) {
|
||||
|
@ -85,7 +86,7 @@
|
|||
);
|
||||
}
|
||||
$span_delete = '';
|
||||
if ($full) {
|
||||
if ($full || ($fullLocal && $tag['Tag']['local'])) {
|
||||
$span_delete = sprintf(
|
||||
'<span class="%s" title="%s" role="%s" tabindex="%s" aria-label="%s" onClick="%s">x</span>',
|
||||
'black-white tag useCursorPointer noPrint',
|
||||
|
@ -121,7 +122,7 @@
|
|||
'<i class="fas fa-globe-americas"></i> +'
|
||||
);
|
||||
}
|
||||
if ($host_org_editor || $full) {
|
||||
if ($full || $fullLocal) {
|
||||
$buttonData[] = sprintf(
|
||||
'<button title="%s" role="button" tabindex="0" aria-label="%s" class="%s" style="%s" onClick="%s">%s</button>',
|
||||
__('Add a local tag'),
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
'attributeId' => 0,
|
||||
'tags' => $tags,
|
||||
'tagAccess' => false,
|
||||
'localTagAccess' => false,
|
||||
'static_tags_only' => 1,
|
||||
'scope' => isset($field['scope']) ? $field['scope'] : 'event',
|
||||
'hide_global_scope' => isset($field['hide_global_scope']) ? $field['hide_global_scope'] : false
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
'event' => $event,
|
||||
'tags' => $tags,
|
||||
'tagAccess' => ($isSiteAdmin || $mayModify),
|
||||
'localTagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id'] || (int)$me['org_id'] === Configure::read('MISP.host_org_id')),
|
||||
'tagConflicts' => $tagConflicts
|
||||
));
|
||||
?>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
if ($fieldData === 'Tag') {
|
||||
echo '<div><span class="blue bold">Tags</span>: ';
|
||||
if (!empty($event['EventTag'])) {
|
||||
echo '<span>' . $this->element('ajaxTags', array('event' => $event, 'tags' => $event['EventTag'], 'static_tags_only' => true)) . '</span>';
|
||||
echo '<span>' . $this->element('ajaxTags', array('event' => $event, 'tags' => $event['EventTag'], 'static_tags_only' => true, 'tagAccess' => false, 'localTagAccess' => false)) . '</span>';
|
||||
}
|
||||
echo '</div>';
|
||||
} else {
|
||||
|
|
|
@ -71,7 +71,8 @@
|
|||
$this->element('ajaxTags', array(
|
||||
'event' => $event,
|
||||
'tags' => $event['Tag'],
|
||||
'tagAccess' => ($isSiteAdmin || $me['org_id'] == $event['Event']['orgc_id']),
|
||||
'tagAccess' => false,
|
||||
'localTagAccess' => false,
|
||||
'static_tags_only' => 1
|
||||
))
|
||||
)
|
||||
|
|
|
@ -105,7 +105,8 @@
|
|||
array(
|
||||
'event' => $event,
|
||||
'tags' => $event['EventTag'],
|
||||
'tagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['orgc_id']),
|
||||
'tagAccess' => ($isSiteAdmin || $mayModify),
|
||||
'localTagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id'] || (int)$me['org_id'] === Configure::read('MISP.host_org_id')),
|
||||
'missingTaxonomies' => $missingTaxonomies,
|
||||
'tagConflicts' => $tagConflicts
|
||||
)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
'scope' => 'feed',
|
||||
'tags' => array(array('Tag' => $feed['Tag'])),
|
||||
'tagAccess' => false,
|
||||
'localTagAccess' => false,
|
||||
'static_tags_only' => true
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue