public interface

GadgetPermissionManager

com.atlassian.jira.dashboard.permission.GadgetPermissionManager
Known Indirect Subclasses

Class Overview

Permission Manager to decide if a gadget should be shown to a user or not. Also responsible for filtering out gadgets from a dashboardState that shouldn't be shown.

Summary

Public Methods
DashboardState filterGadgets(DashboardState dashboardState, ApplicationUser remoteUser)
Removes any gadgets a user doesn't have permission to see in the passed in dashboard state.
Option<PluginGadgetSpec> getPluginGadgetSpec(URI gadgetUri)
Retrieve the equivalent of PluginGadgetSpec object from gadgetUri.
Vote voteOn(PluginGadgetSpec pluginGadgetSpec, ApplicationUser remoteUser)
Decides if a user has permission to view a particular gadget.

Public Methods

public DashboardState filterGadgets (DashboardState dashboardState, ApplicationUser remoteUser)

Removes any gadgets a user doesn't have permission to see in the passed in dashboard state. This will only be done for dashboards where the user has read only permission. If the user has write permission, the gadget will be left in place, and the dashboard plugin will render a place holder with an appropriate error message. The user can the remove the gadget him/herself.

Parameters
dashboardState The dashboard state to filter
remoteUser The user viewing the dashboard. May be null for anonymous users
Returns
  • A filtered dashboardstate with any offending gadgets removed.

public Option<PluginGadgetSpec> getPluginGadgetSpec (URI gadgetUri)

Retrieve the equivalent of PluginGadgetSpec object from gadgetUri.

Parameters
gadgetUri The url to be used to retrieve the PluginGadgetSpec object.
Returns
  • Either a PluginGadgetSpec if it exists, otherwise nothing.

public Vote voteOn (PluginGadgetSpec pluginGadgetSpec, ApplicationUser remoteUser)

Decides if a user has permission to view a particular gadget.

Parameters
pluginGadgetSpec The gadget spec to check permissions for
remoteUser The user viewing the dashboard. May be null for anonymous users
Returns
  • Vote.DENY if the user doesn't have permission. Vote.ALLOW otherwise