Author: Lars Michelsen <[email protected]>
Date: Tue Sep 4 17:08:41 2012 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Tue Sep 4 17:08:41 2012 +0200
Bugfix: Not showing "acknowledge" link when not permitted to perform this action
---
ChangeLog | 1 +
docs/en_US/context_templates.html | 3 +++
share/frontend/nagvis-js/classes/NagVisMapView.php | 1 +
share/frontend/nagvis-js/js/NagVisObject.js | 3 +++
share/server/core/classes/CoreModAction.php | 2 ++
share/userfiles/templates/default.context.html | 6 +++++-
6 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 289fd10..2ed1d55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ Core
* Bugfix: Geomap: Fixed validation problem when editin map global options
Frontend
+ * Bugfix: Not showing "acknowledge" link when not permitted to perform this
action
* Bugfix: Fixed hover menu positioning in scrolled maps
* Bugfix: Fixed hover menu positioning in IE
diff --git a/docs/en_US/context_templates.html
b/docs/en_US/context_templates.html
index 546c81b..16122be 100644
--- a/docs/en_US/context_templates.html
+++ b/docs/en_US/context_templates.html
@@ -132,6 +132,9 @@
<tr>
<td>permitted_edit</td><td>Only show when the user is able to edit
the map.</td>
</tr>
+ <tr>
+ <td>permitted_perform</td><td>Only show when the user is able to
perform actions.</td>
+ </tr>
</table>
</body>
</html>
diff --git a/share/frontend/nagvis-js/classes/NagVisMapView.php
b/share/frontend/nagvis-js/classes/NagVisMapView.php
index f199d63..4a496d1 100644
--- a/share/frontend/nagvis-js/classes/NagVisMapView.php
+++ b/share/frontend/nagvis-js/classes/NagVisMapView.php
@@ -129,6 +129,7 @@ class NagVisMapView {
$arr['event_repeat_duration'] = intval($this->MAPCFG->getValue(0,
'event_repeat_duration'));
$arr['event_on_load'] = intval($this->MAPCFG->getValue(0,
'event_on_load'));
$arr['permitted_edit'] = $this->CORE->getAuthorization() !==
null && $this->CORE->getAuthorization()->isPermitted('Map', 'edit',
$this->name);
+ $arr['permitted_perform'] = $this->CORE->getAuthorization() !==
null && $this->CORE->getAuthorization()->isPermitted('Action', 'perform', '*');
// hover_menu & context_menu have to be handled separated from the
others
// It is special for them that the object individual settings have to
be
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js
b/share/frontend/nagvis-js/js/NagVisObject.js
index ed2e364..25793cf 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -265,6 +265,9 @@ var NagVisObject = Base.extend({
if(!oViewProperties || !oViewProperties.permitted_edit)
oSectionMacros.permitted_edit =
'<!--\\sBEGIN\\spermitted_edit\\s-->.+?<!--\\sEND\\spermitted_edit\\s-->';
+ if(!oViewProperties || !oViewProperties.permitted_perform)
+ oSectionMacros.permitted_perform =
'<!--\\sBEGIN\\spermitted_perform\\s-->.+?<!--\\sEND\\spermitted_perform\\s-->';
+
if(usesSource('automap')) {
oSectionMacros.not_automap =
'<!--\\sBEGIN\\snot_automap\\s-->.+?<!--\\sEND\\snot_automap\\s-->';
// Skip the root change link for the root host
diff --git a/share/server/core/classes/CoreModAction.php
b/share/server/core/classes/CoreModAction.php
index 951965d..6c3de12 100644
--- a/share/server/core/classes/CoreModAction.php
+++ b/share/server/core/classes/CoreModAction.php
@@ -30,6 +30,8 @@ class CoreModAction extends CoreModule {
private $MAPCFG = null;
public function __construct(GlobalCore $CORE) {
+ $this->sName = 'Action';
+
// Register valid actions
$this->aActions = Array(
'acknowledge' => 'perform',
diff --git a/share/userfiles/templates/default.context.html
b/share/userfiles/templates/default.context.html
index f4e3d13..6bc456e 100644
--- a/share/userfiles/templates/default.context.html
+++ b/share/userfiles/templates/default.context.html
@@ -26,13 +26,17 @@
<li class="spacer"></li>
<li><a href="[html_cgi]/cmd.cgi?cmd_typ=55&host=[name]"
target="_blank">[lang_schedule_downtime]</a></li>
<li><a href="[html_cgi]/cmd.cgi?cmd_typ=96&host=[name]&force_check"
target="_blank">[lang_reschedule_next_check]</a></li>
+ <!-- BEGIN permitted_perform -->
<li><a href="#" onClick="showAckDialog('[map_name]',
'[obj_id]');contextHide();return false">[lang_ack]</a></li>
+ <!-- END permitted_perform -->
<!-- END host -->
<!-- BEGIN service -->
<li class="spacer"></li>
<li><a
href="[html_cgi]/cmd.cgi?cmd_typ=56&host=[name]&service=[service_description]"
target="_blank">[lang_schedule_downtime]</a></li>
<li><a
href="[html_cgi]/cmd.cgi?cmd_typ=7&host=[name]&service=[service_description]&force_check"
target="_blank">[lang_reschedule_next_check]</a></li>
- <li><a href="#" onClick="showAckDialog('[map_name]',
'[obj_id]');contextHide();return false">[lang_ack]</a></li>
+ <!-- BEGIN permitted_perform -->
+ <li><a href="javascript:void(0)" onClick="showAckDialog('[map_name]',
'[obj_id]');contextHide();return false">[lang_ack]</a></li>
+ <!-- END permitted_perform -->
<!-- END service -->
</ul>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins