User limitation to menus

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mskufca
Posts: 8
Joined: Tue May 03, 2016 4:09 am

User limitation to menus

Post by mskufca »

Hi,

Is it possible to have some limited users in NagiosXI, that cannot manage theirs Dashboards and views and to have limited access to menus of my admin choice?

tnx
br
Metod
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: User limitation to menus

Post by bwallace »

Absolutely possible. This doc on multi-tenancy in Nagios XI explains how it's done:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Hope this helps and certainly let us know if you have any questions.
Be sure to check out the Knowledgebase for helpful articles and solutions!
mskufca
Posts: 8
Joined: Tue May 03, 2016 4:09 am

Re: User limitation to menus

Post by mskufca »

Hi,

I think you have misunderstood me.
I would like to limit menu options. Like top menu only showing "Home" and "Views" and left menu (With top menu home selected) only showing lets say "Home Dashboard", "Service details" and "Host details".
Basic idea is, to really limit user, not to be able to change anything.

tnx

br
m.
mskufca
Posts: 8
Joined: Tue May 03, 2016 4:09 am

Re: User limitation to menus

Post by mskufca »

Hi,

Basically I would need functionality like this one.
https://www.thruk.org/documentation/menu.html
Especially chapters
"Make item available for some groups only", "Make item available for some groups only" and "Make item available for some specific user only".

Can I do it in NagiosXI?

tnx
br
m.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: User limitation to menus

Post by rkennedy »

Currently this isn't possible, I did file a feature request for it though -

Code: Select all

NEW TASK ID 10908 created - Nagios XI Feature Request: Add further user control per page
It's up to the developers now, but it might make it in a future release!
Former Nagios Employee
mskufca
Posts: 8
Joined: Tue May 03, 2016 4:09 am

Re: User limitation to menus

Post by mskufca »

Hi,

I did play around a bit and I manage to do something working with editing php files. I know it is not perfect, but it works for my needs.
It would be nice to have this (similar) coded in proper way.

Before you start: BACKUP, BACKUP and another BACKUP. All these changes are going to be overridden with next upgrade!!!!!
Do backup of original file (since it is the linux way :-) ) AND after your implement changes do BACKUP of your files!!!!

For top menu:
vim /usr/local/nagiosxi/html/includes/header.inc.php
# Menu is limited with "is_advanced_user" and "is_admin"
...
# Top menu entires limited for users to "Home", "Views" and "Dashboard" only (Line 57)
<div id="topmenu">
<?php if (is_authenticated() == true) { ?>
<div class="mainmenu">
<div><a href="<?php echo get_base_url(); ?>"><?php echo _("Home"); ?></a></div>
<div><a href="<?php echo get_base_url(); ?>views/"><?php echo _("Views"); ?></a></div>
<div><a href="<?php echo get_base_url(); ?>dashboards/"><?php echo _("Dashboards"); ?></a></div>
<?php if (is_advanced_user() == true) { ?>
<div><a href="<?php echo get_base_url(); ?>reports/"><?php echo _("Reports"); ?></a></div>
<?php } ?>
<?php if (is_authorized_to_configure_objects() == true) { ?>
<div id="config-menulink">
<span>
<a href="<?php echo get_base_url(); ?>config/"><?php echo _("Configure"); ?></a>
<ul class="config-dropdown">
<li><a href="<?php echo get_base_url(); ?>config/?xiwindow=monitoringwizard.php"><i class="fa fa-magic l"></i> <?php echo _('Configuration Wizards'); ?></a></li>
<?php if (is_advanced_user()) { ?>
<li><a href="<?php echo get_base_url(); ?>includes/components/ccm/xi-index.php"><i class="fa fa-cog l"></i> <?php echo _('Core Config Manager'); ?></a></li>
<?php } ?>
</ul>
</span>
</div>
<?php } ?>
<?php if (is_admin() == true) { ?>
<div><a href="<?php echo get_base_url(); ?>tools/"><?php echo _("Tools"); ?></a></div>
<?php } ?>
<?php if (is_advanced_user() == true) { ?>
<div><a href="<?php echo get_base_url(); ?>help/"><?php echo _("Help"); ?></a></div>
<?php } ?>
<?php if (is_admin() == true) { ?>
<div><a href="<?php echo get_base_url(); ?>admin/"><?php echo _("Admin"); ?></a></div>
<?php } ?>
</div>
<div class="hiddenmenu">
<div id="mdropdown">
<span>
<span class="nav-head"><i class="fa fa-chevron-down l"></i> <?php echo _("Navigation"); ?></span>
<ul class="dropdown-items">
<li><a href="<?php echo get_base_url(); ?>"><?php echo _("Home"); ?></a></li>
<li><a href="<?php echo get_base_url(); ?>views/"><?php echo _("Views"); ?></a></li>
<li><a href="<?php echo get_base_url(); ?>dashboards/"><?php echo _("Dashboards"); ?></a></li>
<li><a href="<?php echo get_base_url(); ?>reports/"><?php echo _("Reports"); ?></a></li>
<?php if (is_authorized_to_configure_objects() == true) { ?>
<li><a href="<?php echo get_base_url(); ?>config/"><?php echo _("Configure"); ?></a></li>
<?php } ?>
<li><a href="<?php echo get_base_url(); ?>tools/"><?php echo _("Tools"); ?></a></li>
<li><a href="<?php echo get_base_url(); ?>help/"><?php echo _("Help"); ?></a></li>
<?php if (is_admin() == true) { ?>
<li><a href="<?php echo get_base_url(); ?>admin/"><?php echo _("Admin"); ?></a></li>
<?php } ?>
</ul>
</span>
</div>
</div>
<?php } else { ?>
<div class="mainmenu">
<div><a href="<?php echo get_base_url() . PAGEFILE_LOGIN; ?>"><?php echo _("Login"); ?></a></div>
</div>
<?php } ?>
</div>

#Top right Drop down limitation (Line 118)
...
<div class="header-right ext">
<span class="ext-menu">
<i class="fa fa-bars"></i>
<ul>
<?php if (is_advanced_user() == true) { ?>
<li id="schedulepagereport" class="tt-bind" data-placement="left" title="<?php echo _('Schedule page'); ?>"><a href="#"><i class="fa fa-clock-o"></i></a></li>
<?php } ?>
<li id="popout" class="tt-bind" data-placement="left" title="<?php echo _('Popout'); ?>"><a href="#"><i class="fa fa-share-square-o"></i></a></li>
<?php if (is_advanced_user() == true) { ?>
<li id="addtomyviews" class="tt-bind" data-placement="left" title="<?php echo _('Add to my views'); ?>"><a href="#"><i class="fa fa-plus-circle"></i></a></li>
<li id="permalink" class="tt-bind" data-placement="left" title="<?php echo _('Get permalink'); ?>"><a href="#"><i class="fa fa-chain"></i></a></li>
<li id="feedback" class="tt-bind" data-placement="left" title="<?php echo _('Send us feedback'); ?>"><a href="#"><i class="fa fa-comment-o"></i></a></li>
<?php } ?>
</ul>
</span>
</div>
# Blockage Account menu for users (line 132)
...
<div class="header-right profile">
<?php if (is_advanced_user() == true) { ?>
<a href="<?php echo get_base_url(); ?>account/" style="margin-right: 1.5rem;"><i class="fa fa-user"></i> <span><?php echo $_SESSION["username"]; ?></span></a>
<?php } else { ?>
<a style="margin-right: 1.5rem;"><i class="fa fa-user"></i> <span><?php echo $_SESSION["username"]; ?></span></a>
<?php } ?>
<?php if (is_http_basic_authenticated() == false) { ?>
<a href="<?php echo get_base_url() . PAGEFILE_LOGIN; ?>?logout&nsp=<?php echo get_nagios_session_protector_id(); ?>"><i class="fa fa-power-off"></i> <span><?php echo _("Logout"); ?></span></a>
<?php } ?>
</div>
...


#Left side menus limitation is in file
vim /usr/local/nagiosxi/html/includes/utils-menu.inc.php

and menu can be limited to is_advanced_user or is_admin function in the similar way. You just decide what to remove for normal users. Take a look in example for component removal for normal users:

# BPI component: added "," and "function" => "is_advanced_user", (be carefull with php syntax. Notice positions of ","!! )
vim /usr/local/nagiosxi/html/includes/components/nagiosbpi/nagiosbpi.inc.php
...
add_menu_item(MENU_HOME, array(
"type" => "linkspacer",
"title" => "",
"id" => "menu-home-bpi_spacer",
"order" => $neworder,
"opts" => array(),
"function" => "is_advanced_user",
));

$neworder = $neworder + 0.1;
add_menu_item(MENU_HOME, array(
"type" => "link",
"title" => "BPI",
"id" => "menu-home-bpi",
"order" => $neworder,
"opts" => array(
"href" => $urlbase . "/index.php",
"icon" => "fa-briefcase"
),
"function" => "is_advanced_user",
));
...

Hope that someone will have some time spared with my post. Good luck.

Go R&D, GO.... :-)

br
m.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: User limitation to menus

Post by rkennedy »

Thanks for sharing! I've passed this link on to our Developers along with the FR.
Former Nagios Employee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: User limitation to menus

Post by tmcdonald »

Closing. PM if you need it re-opened.
Former Nagios employee
Locked