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

add permission for enableLink #135

Merged
merged 2 commits into from
Mar 21, 2018
Merged

add permission for enableLink #135

merged 2 commits into from
Mar 21, 2018

Conversation

xam-stephan
Copy link
Contributor

please add a permission to enable the link just for some roles

@@ -6,6 +6,7 @@
$this->providePermission('grafana/graphconfig', $this->translate('Allow to configure graphs.'));
$this->providePermission('grafana/debug', $this->translate('Allow to see module debug informations.'));
$this->providePermission('grafana/showall', $this->translate('Allow access to see all graphs of a host.'));
$this->providePermission('grafana/enableLink', $this->translate('Enable link to grafana'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I‘d suggest to keep permissions lowercase.

I would also do that for the config setting, but that‘s for a different issue.

@@ -511,7 +511,7 @@ public function getPreviewHtml(MonitoredObject $object, $report = false)
$res = $this->getMyPreviewHtml($serviceName, $hostName, $previewHtml);

//do not render URLs on error or if disabled
if (!$res || $this->enableLink == "no") {
if (!$res || $this->enableLink == "no" || !$this->permission->hasPermission('grafana/enableLink')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that condition really correct?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yepp its correct.

@Mikesch-mp Mikesch-mp self-assigned this Mar 20, 2018
@Mikesch-mp Mikesch-mp added this to the 1.2.1 milestone Mar 20, 2018
@Mikesch-mp
Copy link
Owner

Please lowercase the permissions as @dnsmichi suggested and i will add it.

@xam-stephan
Copy link
Contributor Author

ok, the permission name ist now enable-link.
To get the link the users must have the permission and the link must be enabled in the module config.
I'm not sure if you want to keep it that way

@Mikesch-mp Mikesch-mp merged commit a23fd71 into Mikesch-mp:master Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants