Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/disc_prototypes.php1
-rw-r--r--ui/graphs.php2
-rw-r--r--ui/host_discovery.php1
-rw-r--r--ui/host_prototypes.php1
-rw-r--r--ui/httpconf.php1
-rw-r--r--ui/include/graphs.inc.php5
-rw-r--r--ui/include/hosts.inc.php5
-rw-r--r--ui/include/httptest.inc.php5
-rw-r--r--ui/include/items.inc.php5
-rw-r--r--ui/include/triggers.inc.php5
-rw-r--r--ui/include/views/configuration.graph.list.php6
-rw-r--r--ui/include/views/configuration.host.discovery.list.php4
-rw-r--r--ui/include/views/configuration.host.prototype.list.php7
-rw-r--r--ui/include/views/configuration.httpconf.list.php2
-rw-r--r--ui/include/views/configuration.item.list.php6
-rw-r--r--ui/include/views/configuration.item.prototype.list.php4
-rw-r--r--ui/include/views/configuration.trigger.prototype.list.php2
-rw-r--r--ui/include/views/configuration.triggers.list.php2
-rw-r--r--ui/items.php2
-rw-r--r--ui/trigger_prototypes.php1
-rw-r--r--ui/triggers.php3
21 files changed, 46 insertions, 24 deletions
diff --git a/ui/disc_prototypes.php b/ui/disc_prototypes.php
index 8469388188f..0be0cff892e 100644
--- a/ui/disc_prototypes.php
+++ b/ui/disc_prototypes.php
@@ -1579,6 +1579,7 @@ else {
);
$data['parent_templates'] = getItemParentTemplates($data['items'], ZBX_FLAG_DISCOVERY_PROTOTYPE);
+ $data['allowed_ui_conf_templates'] = CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES);
// render view
echo (new CView('configuration.item.prototype.list', $data))->getOutput();
diff --git a/ui/graphs.php b/ui/graphs.php
index 425b3735567..bff33f5bdb6 100644
--- a/ui/graphs.php
+++ b/ui/graphs.php
@@ -765,6 +765,8 @@ else {
: ZBX_FLAG_DISCOVERY_PROTOTYPE
);
+ $data['allowed_ui_conf_templates'] = CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES);
+
// render view
echo (new CView('configuration.graph.list', $data))->getOutput();
}
diff --git a/ui/host_discovery.php b/ui/host_discovery.php
index 867623dc97e..b6675e81fbe 100644
--- a/ui/host_discovery.php
+++ b/ui/host_discovery.php
@@ -985,6 +985,7 @@ else {
);
$data['parent_templates'] = getItemParentTemplates($data['discoveries'], ZBX_FLAG_DISCOVERY_RULE);
+ $data['allowed_ui_conf_templates'] = CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES);
// render view
echo (new CView('configuration.host.discovery.list', $data))->getOutput();
diff --git a/ui/host_prototypes.php b/ui/host_prototypes.php
index 130895678e0..71557452dc0 100644
--- a/ui/host_prototypes.php
+++ b/ui/host_prototypes.php
@@ -626,6 +626,7 @@ else {
}
$data['tags'] = makeTags($data['hostPrototypes'], true, 'hostid');
+ $data['allowed_ui_conf_templates'] = CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES);
// render view
echo (new CView('configuration.host.prototype.list', $data))->getOutput();
diff --git a/ui/httpconf.php b/ui/httpconf.php
index c4cf249c4cd..32c55fcbabd 100644
--- a/ui/httpconf.php
+++ b/ui/httpconf.php
@@ -889,6 +889,7 @@ else {
$data['parent_templates'] = getHttpTestParentTemplates($httpTests);
$data['httpTests'] = $httpTests;
$data['httpTestsLastData'] = $httpTestsLastData;
+ $data['allowed_ui_conf_templates'] = CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES);
// render view
echo (new CView('configuration.httpconf.list', $data))->getOutput();
diff --git a/ui/include/graphs.inc.php b/ui/include/graphs.inc.php
index 42c957a1ae5..032eea10ae9 100644
--- a/ui/include/graphs.inc.php
+++ b/ui/include/graphs.inc.php
@@ -286,10 +286,11 @@ function getGraphParentTemplates(array $graphs, $flag) {
* @param string $graphid
* @param array $parent_templates The list of the templates, prepared by getGraphParentTemplates() function.
* @param int $flag Origin of the graph (ZBX_FLAG_DISCOVERY_NORMAL or ZBX_FLAG_DISCOVERY_PROTOTYPE).
+ * @param bool $provide_links If this parameter is false, prefix will not contain links.
*
* @return array|null
*/
-function makeGraphTemplatePrefix($graphid, array $parent_templates, $flag) {
+function makeGraphTemplatePrefix($graphid, array $parent_templates, $flag, bool $provide_links) {
if (!array_key_exists($graphid, $parent_templates['links'])) {
return null;
}
@@ -300,7 +301,7 @@ function makeGraphTemplatePrefix($graphid, array $parent_templates, $flag) {
$template = $parent_templates['templates'][$parent_templates['links'][$graphid]['hostid']];
- if ($template['permission'] == PERM_READ_WRITE) {
+ if ($provide_links && $template['permission'] == PERM_READ_WRITE) {
$url = (new CUrl('graphs.php'));
if ($flag == ZBX_FLAG_DISCOVERY_PROTOTYPE) {
diff --git a/ui/include/hosts.inc.php b/ui/include/hosts.inc.php
index 06478d6c312..6642b40d503 100644
--- a/ui/include/hosts.inc.php
+++ b/ui/include/hosts.inc.php
@@ -815,10 +815,11 @@ function getHostPrototypeParentTemplates(array $host_prototypes) {
*
* @param string $host_prototypeid
* @param array $parent_templates The list of the templates, prepared by getHostPrototypeParentTemplates() function.
+ * @param bool $provide_links If this parameter is false, prefix will not contain links.
*
* @return array|null
*/
-function makeHostPrototypeTemplatePrefix($host_prototypeid, array $parent_templates) {
+function makeHostPrototypeTemplatePrefix($host_prototypeid, array $parent_templates, bool $provide_links) {
if (!array_key_exists($host_prototypeid, $parent_templates['links'])) {
return null;
}
@@ -829,7 +830,7 @@ function makeHostPrototypeTemplatePrefix($host_prototypeid, array $parent_templa
$template = $parent_templates['templates'][$parent_templates['links'][$host_prototypeid]['parent_hostid']];
- if ($template['permission'] == PERM_READ_WRITE) {
+ if ($provide_links && $template['permission'] == PERM_READ_WRITE) {
$name = (new CLink(CHtml::encode($template['name']),
(new CUrl('host_prototypes.php'))
->setArgument('parent_discoveryid', $parent_templates['links'][$host_prototypeid]['lld_ruleid'])
diff --git a/ui/include/httptest.inc.php b/ui/include/httptest.inc.php
index fedafe3c48c..cf64409d4a6 100644
--- a/ui/include/httptest.inc.php
+++ b/ui/include/httptest.inc.php
@@ -229,10 +229,11 @@ function getHttpTestParentTemplates(array $httptests) {
*
* @param string $httptestid
* @param array $parent_templates The list of the templates, prepared by getHttpTestParentTemplates() function.
+ * @param bool $provide_links If this parameter is false, prefix will not contain links.
*
* @return array|null
*/
-function makeHttpTestTemplatePrefix($httptestid, array $parent_templates) {
+function makeHttpTestTemplatePrefix($httptestid, array $parent_templates, bool $provide_links) {
if (!array_key_exists($httptestid, $parent_templates['links'])) {
return null;
}
@@ -243,7 +244,7 @@ function makeHttpTestTemplatePrefix($httptestid, array $parent_templates) {
$template = $parent_templates['templates'][$parent_templates['links'][$httptestid]['hostid']];
- if ($template['permission'] == PERM_READ_WRITE) {
+ if ($provide_links && $template['permission'] == PERM_READ_WRITE) {
$name = (new CLink(CHtml::encode($template['name']),
(new CUrl('httpconf.php'))
->setArgument('filter_set', '1')
diff --git a/ui/include/items.inc.php b/ui/include/items.inc.php
index 78e9b14c613..3f873b605bb 100644
--- a/ui/include/items.inc.php
+++ b/ui/include/items.inc.php
@@ -905,10 +905,11 @@ function getItemParentTemplates(array $items, $flag) {
* @param array $parent_templates The list of the templates, prepared by getItemParentTemplates() function.
* @param int $flag Origin of the item (ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_RULE,
* ZBX_FLAG_DISCOVERY_PROTOTYPE).
+ * @param bool $provide_links If this parameter is false, prefix will not contain links.
*
* @return array|null
*/
-function makeItemTemplatePrefix($itemid, array $parent_templates, $flag) {
+function makeItemTemplatePrefix($itemid, array $parent_templates, $flag, bool $provide_links) {
if (!array_key_exists($itemid, $parent_templates['links'])) {
return null;
}
@@ -919,7 +920,7 @@ function makeItemTemplatePrefix($itemid, array $parent_templates, $flag) {
$template = $parent_templates['templates'][$parent_templates['links'][$itemid]['hostid']];
- if ($template['permission'] == PERM_READ_WRITE) {
+ if ($provide_links && $template['permission'] == PERM_READ_WRITE) {
if ($flag == ZBX_FLAG_DISCOVERY_RULE) {
$url = (new CUrl('host_discovery.php'))
->setArgument('filter_set', '1')
diff --git a/ui/include/triggers.inc.php b/ui/include/triggers.inc.php
index 6285cfaf68d..d4e79d67a02 100644
--- a/ui/include/triggers.inc.php
+++ b/ui/include/triggers.inc.php
@@ -2359,10 +2359,11 @@ function getTriggerParentTemplates(array $triggers, $flag) {
* @param string $triggerid
* @param array $parent_templates The list of the templates, prepared by getTriggerParentTemplates() function.
* @param int $flag Origin of the trigger (ZBX_FLAG_DISCOVERY_NORMAL or ZBX_FLAG_DISCOVERY_PROTOTYPE).
+ * @param bool $provide_links If this parameter is false, prefix will not contain links.
*
* @return array|null
*/
-function makeTriggerTemplatePrefix($triggerid, array $parent_templates, $flag) {
+function makeTriggerTemplatePrefix($triggerid, array $parent_templates, $flag, bool $provide_links) {
if (!array_key_exists($triggerid, $parent_templates['links'])) {
return null;
}
@@ -2381,7 +2382,7 @@ function makeTriggerTemplatePrefix($triggerid, array $parent_templates, $flag) {
$list = [];
foreach ($templates as $template) {
- if ($template['permission'] == PERM_READ_WRITE) {
+ if ($provide_links && $template['permission'] == PERM_READ_WRITE) {
if ($flag == ZBX_FLAG_DISCOVERY_PROTOTYPE) {
$url = (new CUrl('trigger_prototypes.php'))
->setArgument('parent_discoveryid', $parent_templates['links'][$triggerid]['lld_ruleid']);
diff --git a/ui/include/views/configuration.graph.list.php b/ui/include/views/configuration.graph.list.php
index 535c220cbfc..bf9e584587c 100644
--- a/ui/include/views/configuration.graph.list.php
+++ b/ui/include/views/configuration.graph.list.php
@@ -157,11 +157,9 @@ foreach ($data['graphs'] as $graph) {
$hostList = implode(', ', $hostList);
}
+ $flag = ($data['parent_discoveryid'] === null) ? ZBX_FLAG_DISCOVERY_NORMAL : ZBX_FLAG_DISCOVERY_PROTOTYPE;
$name = [];
- $name[] = makeGraphTemplatePrefix($graphid, $data['parent_templates'], ($data['parent_discoveryid'] === null)
- ? ZBX_FLAG_DISCOVERY_NORMAL
- : ZBX_FLAG_DISCOVERY_PROTOTYPE
- );
+ $name[] = makeGraphTemplatePrefix($graphid, $data['parent_templates'], $flag, $data['allowed_ui_conf_templates']);
if ($graph['discoveryRule'] && $data['parent_discoveryid'] === null) {
$name[] = (new CLink(CHtml::encode($graph['discoveryRule']['name']),
diff --git a/ui/include/views/configuration.host.discovery.list.php b/ui/include/views/configuration.host.discovery.list.php
index 63c441f9251..e2cabf16a91 100644
--- a/ui/include/views/configuration.host.discovery.list.php
+++ b/ui/include/views/configuration.host.discovery.list.php
@@ -188,7 +188,9 @@ $update_interval_parser = new CUpdateIntervalParser(['usermacros' => true]);
foreach ($data['discoveries'] as $discovery) {
// description
$description = [];
- $description[] = makeItemTemplatePrefix($discovery['itemid'], $data['parent_templates'], ZBX_FLAG_DISCOVERY_RULE);
+ $description[] = makeItemTemplatePrefix($discovery['itemid'], $data['parent_templates'], ZBX_FLAG_DISCOVERY_RULE,
+ $data['allowed_ui_conf_templates']
+ );
if ($discovery['type'] == ITEM_TYPE_DEPENDENT) {
if ($discovery['master_item']['type'] == ITEM_TYPE_HTTPTEST) {
diff --git a/ui/include/views/configuration.host.prototype.list.php b/ui/include/views/configuration.host.prototype.list.php
index 48c848fee6a..d477b9e4de6 100644
--- a/ui/include/views/configuration.host.prototype.list.php
+++ b/ui/include/views/configuration.host.prototype.list.php
@@ -64,7 +64,9 @@ $hostTable = (new CTableInfo())
foreach ($this->data['hostPrototypes'] as $hostPrototype) {
// name
$name = [];
- $name[] = makeHostPrototypeTemplatePrefix($hostPrototype['hostid'], $data['parent_templates']);
+ $name[] = makeHostPrototypeTemplatePrefix($hostPrototype['hostid'], $data['parent_templates'],
+ $data['allowed_ui_conf_templates']
+ );
$name[] = new CLink(CHtml::encode($hostPrototype['name']),
(new CUrl('host_prototypes.php'))
->setArgument('form', 'update')
@@ -83,7 +85,8 @@ foreach ($this->data['hostPrototypes'] as $hostPrototype) {
foreach ($hostPrototype['templates'] as $template) {
$caption = [];
- if (array_key_exists($template['templateid'], $data['writable_templates'])) {
+ if ($data['allowed_ui_conf_templates']
+ && array_key_exists($template['templateid'], $data['writable_templates'])) {
$caption[] = (new CLink($template['name'],
'templates.php?form=update&templateid='.$template['templateid']
))
diff --git a/ui/include/views/configuration.httpconf.list.php b/ui/include/views/configuration.httpconf.list.php
index 05c98309ccf..be628fff431 100644
--- a/ui/include/views/configuration.httpconf.list.php
+++ b/ui/include/views/configuration.httpconf.list.php
@@ -126,7 +126,7 @@ $httpTests = $this->data['httpTests'];
foreach ($httpTests as $httpTestId => $httpTest) {
$name = [];
- $name[] = makeHttpTestTemplatePrefix($httpTestId, $data['parent_templates']);
+ $name[] = makeHttpTestTemplatePrefix($httpTestId, $data['parent_templates'], $data['allowed_ui_conf_templates']);
$name[] = new CLink(CHtml::encode($httpTest['name']),
(new CUrl('httpconf.php'))
->setArgument('form', 'update')
diff --git a/ui/include/views/configuration.item.list.php b/ui/include/views/configuration.item.list.php
index bafbadfd67a..6d766b94501 100644
--- a/ui/include/views/configuration.item.list.php
+++ b/ui/include/views/configuration.item.list.php
@@ -87,7 +87,9 @@ $update_interval_parser = new CUpdateIntervalParser(['usermacros' => true]);
foreach ($data['items'] as $item) {
// description
$description = [];
- $description[] = makeItemTemplatePrefix($item['itemid'], $data['parent_templates'], ZBX_FLAG_DISCOVERY_NORMAL);
+ $description[] = makeItemTemplatePrefix($item['itemid'], $data['parent_templates'], ZBX_FLAG_DISCOVERY_NORMAL,
+ $data['allowed_ui_conf_templates']
+ );
if (!empty($item['discoveryRule'])) {
$description[] = (new CLink(CHtml::encode($item['discoveryRule']['name']),
@@ -148,7 +150,7 @@ foreach ($data['items'] as $item) {
$trigger_description = [];
$trigger_description[] = makeTriggerTemplatePrefix($trigger['triggerid'], $data['trigger_parent_templates'],
- ZBX_FLAG_DISCOVERY_NORMAL
+ ZBX_FLAG_DISCOVERY_NORMAL, $data['allowed_ui_conf_templates']
);
$trigger['hosts'] = zbx_toHash($trigger['hosts'], 'hostid');
diff --git a/ui/include/views/configuration.item.prototype.list.php b/ui/include/views/configuration.item.prototype.list.php
index 4ca12745fb7..c11219874d9 100644
--- a/ui/include/views/configuration.item.prototype.list.php
+++ b/ui/include/views/configuration.item.prototype.list.php
@@ -68,7 +68,9 @@ $update_interval_parser = new CUpdateIntervalParser(['usermacros' => true, 'lldm
foreach ($data['items'] as $item) {
$description = [];
- $description[] = makeItemTemplatePrefix($item['itemid'], $data['parent_templates'], ZBX_FLAG_DISCOVERY_PROTOTYPE);
+ $description[] = makeItemTemplatePrefix($item['itemid'], $data['parent_templates'], ZBX_FLAG_DISCOVERY_PROTOTYPE,
+ $data['allowed_ui_conf_templates']
+ );
if ($item['type'] == ITEM_TYPE_DEPENDENT) {
if ($item['master_item']['type'] == ITEM_TYPE_HTTPTEST) {
diff --git a/ui/include/views/configuration.trigger.prototype.list.php b/ui/include/views/configuration.trigger.prototype.list.php
index 514f7edfd8c..b9da5da04f5 100644
--- a/ui/include/views/configuration.trigger.prototype.list.php
+++ b/ui/include/views/configuration.trigger.prototype.list.php
@@ -72,7 +72,7 @@ foreach ($this->data['triggers'] as $trigger) {
// description
$description = [];
$description[] = makeTriggerTemplatePrefix($trigger['triggerid'], $data['parent_templates'],
- ZBX_FLAG_DISCOVERY_PROTOTYPE
+ ZBX_FLAG_DISCOVERY_PROTOTYPE, $data['allowed_ui_conf_templates']
);
$description[] = new CLink(
diff --git a/ui/include/views/configuration.triggers.list.php b/ui/include/views/configuration.triggers.list.php
index e9dadd047b2..660b2efb3a5 100644
--- a/ui/include/views/configuration.triggers.list.php
+++ b/ui/include/views/configuration.triggers.list.php
@@ -215,7 +215,7 @@ foreach ($data['triggers'] as $tnum => $trigger) {
// description
$description = [];
$description[] = makeTriggerTemplatePrefix($trigger['triggerid'], $data['parent_templates'],
- ZBX_FLAG_DISCOVERY_NORMAL
+ ZBX_FLAG_DISCOVERY_NORMAL, $data['allowed_ui_conf_templates']
);
$trigger['hosts'] = zbx_toHash($trigger['hosts'], 'hostid');
diff --git a/ui/items.php b/ui/items.php
index a6f6a2d0e50..73a84893444 100644
--- a/ui/items.php
+++ b/ui/items.php
@@ -2121,6 +2121,8 @@ else {
'compression_status' => CHousekeepingHelper::get(CHousekeepingHelper::COMPRESSION_STATUS)
];
+ $data['allowed_ui_conf_templates'] = CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES);
+
// render view
echo (new CView('configuration.item.list', $data))->getOutput();
}
diff --git a/ui/trigger_prototypes.php b/ui/trigger_prototypes.php
index 6c086088232..3b92323d56e 100644
--- a/ui/trigger_prototypes.php
+++ b/ui/trigger_prototypes.php
@@ -691,6 +691,7 @@ else {
}
$data['parent_templates'] = getTriggerParentTemplates($data['triggers'], ZBX_FLAG_DISCOVERY_PROTOTYPE);
+ $data['allowed_ui_conf_templates'] = CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES);
// Render view.
echo (new CView('configuration.trigger.prototype.list', $data))->getOutput();
diff --git a/ui/triggers.php b/ui/triggers.php
index f3bc00735d3..f9faa96d4cc 100644
--- a/ui/triggers.php
+++ b/ui/triggers.php
@@ -1038,7 +1038,8 @@ else {
'parent_templates' => getTriggerParentTemplates($triggers, ZBX_FLAG_DISCOVERY_NORMAL),
'paging' => $paging,
'dep_triggers' => $dep_triggers,
- 'tags' => makeTags($triggers, true, 'triggerid', ZBX_TAG_COUNT_DEFAULT, $filter_tags)
+ 'tags' => makeTags($triggers, true, 'triggerid', ZBX_TAG_COUNT_DEFAULT, $filter_tags),
+ 'allowed_ui_conf_templates' => CWebUser::checkAccess(CRoleHelper::UI_CONFIGURATION_TEMPLATES)
];
// render view