public class

JiraGadgetPermissionManager

extends Object
implements GadgetPermissionManager
java.lang.Object
   ↳ com.atlassian.jira.dashboard.permission.JiraGadgetPermissionManager

Summary

Public Constructors
JiraGadgetPermissionManager(PermissionManager permissionManager, PluginAccessor pluginAccessor, DashboardPermissionService permissionService)
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.dashboard.permission.GadgetPermissionManager

Public Constructors

public JiraGadgetPermissionManager (PermissionManager permissionManager, PluginAccessor pluginAccessor, DashboardPermissionService permissionService)

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