Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Particular plugin menu should not be displayed to unauthenticated users #4784

Closed
phutchins opened this issue Apr 21, 2016 · 12 comments
Closed
Assignees
Labels
Milestone

Comments

@phutchins
Copy link

This issue was initially opened in the grafana-zabbix repo's issues but @alexanderzobnin mentioned that it was an issue with Grafana and not the plugin.

  • I'm currently running out of the develop branch at commit 163b45c
  • Plugin that is showing up is the grafana-zabbix plugin menu
  • This is running on Ubuntu 14.04

When sharing a dashboard in grafana, an unauthenticated user can click the grafana menu button in the top left and will see a Zabbix menu item. It says permission denied when it is clicked but it should not be displayed.

The Zabbix plugin's menu should not be displayed unless the user is authenticated.

Authenticated:

Unauthenticated

Please let me know if there is any additional information that I can provide that would be helpful.

Honestly, I'd love it if we had the ability to share a dashboard which did not display the menu bar at the top at all. I don't want the user to be able to change anything so I don't care about them not being able to see the time configuration.

@torkelo
Copy link
Member

torkelo commented Apr 25, 2016

Fixed so that the nav will not include the app if there are no subnavs that the user has access to.

This will not solve your case because Zabbix has 2 dashboard links where addToNav is set to true, which no Role assigned (defaults to Viewer). So Zabbix link will still be shown for anonymous users.

https://github.com/alexanderzobnin/grafana-zabbix/blob/master/src/plugin.json#L48

@phutchins
Copy link
Author

@torkelo awesome! Thank you so much! I'll work with the zabbix plugin developer to get this fixed the rest of the way. Thanks again for such an awesome dashboard and all of your work on this!

I've been watching the project for a year or two now and I'm very excited to have started using it...

@phutchins
Copy link
Author

I've added the 'Editor' role to the includes and removed addToNav and have managed to get the sub menus to disappear from the menu but the Zabbix menu still appears. Could you point me in the right direction for adding a required role to the root level of the menu? A similar example might be good enough if you know of one.

@phutchins
Copy link
Author

Well, I take it back. Removing addToNav completely removes it from the nav and I then can't see the menu item when logged in... When addToNav exists, but I have "role": "Editor" I can still see the menu item when logged out :-.

@torkelo
Copy link
Member

torkelo commented Apr 26, 2016

whats your anonymous user role? (specified in config file in the anonymous section )

@phutchins
Copy link
Author

It's all pretty much default. org_role = Viewer for auth.anonymous

@torkelo
Copy link
Member

torkelo commented Apr 26, 2016

@phutchins strange, works here, when I set role: "Editor" to one of the dashboards or pages, (in the includes section), I cannot see the main app link in nav when I am anonymous. Did you restart grafana-server ? it needs restart to reread plugin.json (also if you are modifying a plugin that has a dist folder modify the plugin json in the dist folder)

@phutchins
Copy link
Author

@torkelo odd. I'm editing the plugin.json in /var/lib/grafana/plugins/alexanderzobnin-zabbix-app/ and when I made changes (and restart) I do see changes on the front end to the sub menus but the main menu is still not going away. I'm 2 days behind on the zabbix plugin so maybe I can pull updates and see if that helps...

Does this look like what you're doing?

  "includes": [
    {
      "type": "datasource",
      "name": "Zabbix Datasource",
      "role": "Editor"
    },
    {
      "type": "panel",
      "name": "Triggers Panel",
      "role": "Editor",
      "addToNav": true
    },
    {
      "type": "dashboard",
      "name": "Zabbix Server Dashboard",
      "path": "dashboards/zabbix_server_dashboard.json",
      "role": "Editor",
      "addToNav": true
    }
  ],

@torkelo
Copy link
Member

torkelo commented Apr 26, 2016

A panel should not have addToNav
On 26 Apr 2016 4:25 PM, "Philip Hutchins" [email protected] wrote:

@torkelo https://github.com/torkelo odd. I'm editing the plugin.json in
/var/lib/grafana/plugins/alexanderzobnin-zabbix-app/ and when I made
changes (and restart) I do see changes on the front end to the sub menus
but the main menu is still not going away. I'm 2 days behind on the zabbix
plugin so maybe I can pull updates and see if that helps...

Does this look like what you're doing?

"includes": [
{
"type": "datasource",
"name": "Zabbix Datasource",
"role": "Editor"
},
{
"type": "panel",
"name": "Triggers Panel",
"role": "Editor",
"addToNav": true
},
{
"type": "dashboard",
"name": "Zabbix Server Dashboard",
"path": "dashboards/zabbix_server_dashboard.json",
"role": "Editor",
"addToNav": true
}
],


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#4784 (comment)

@phutchins
Copy link
Author

I removed the addToNav as I had before and still the same outcome...

screen shot 2016-04-27 at 7 22 18 am

Then when I log in, those two menus are missing...

screen shot 2016-04-27 at 7 25 20 am

Any thoughts? Maybe @alexanderzobnin has an idea?

@tammytankian
Copy link

tammytankian commented Nov 6, 2017

I dont know if you guys already found a solution for this, but I could solve with deleting the includes of the dashboards in

/var/lib/grafana/plugins/alexanderzobnin-zabbix-app/dist/plugin.json /var/lib/grafana/plugins/alexanderzobnin-zabbix-app/src/plugin.json

And that is it

Only every update of it, you have to do the procedure again

Is going to be like this the file:

"includes": [
{
"type": "datasource",
"name": "Zabbix Datasource"
},
{
"type": "panel",
"name": "Triggers Panel"
}
],

"dependencies": {
"grafanaVersion": "3.x 4.x",
"plugins": []
}
}

After that, restart grafana, and you remove the menu, wito=hout losing access to the config in "plugins" menu.

image

Hope I could help (:

@alexanderzobnin
Copy link
Contributor

@phutchins I'll take a look at this issue again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants