com.atlassian.jira.dashboard.permission
Interface GadgetPermissionManager

All Known Implementing Classes:
JiraGadgetPermissionManager

public interface GadgetPermissionManager

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.

Since:
v4.0

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

Method Detail

voteOn

com.atlassian.gadgets.Vote voteOn(com.atlassian.gadgets.plugins.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

filterGadgets

com.atlassian.gadgets.dashboard.DashboardState filterGadgets(com.atlassian.gadgets.dashboard.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.

getPluginGadgetSpec

com.atlassian.fugue.Option<com.atlassian.gadgets.plugins.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.


Copyright © 2002-2014 Atlassian. All Rights Reserved.