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
 String extractModuleKey(String gadgetUri)
          Used to extract/convert a url to a plugin key.
 com.atlassian.gadgets.dashboard.DashboardState filterGadgets(com.atlassian.gadgets.dashboard.DashboardState dashboardState, com.atlassian.crowd.embedded.api.User remoteUser)
          Removes any gadgets a user doesn't have permission to see in the passed in dashboard state.
 com.atlassian.gadgets.Vote voteOn(com.atlassian.gadgets.plugins.PluginGadgetSpec pluginGadgetSpec, com.atlassian.crowd.embedded.api.User remoteUser)
          Decides if a user has permission to view a particular gadget.
 com.atlassian.gadgets.Vote voteOn(String completeGadgetKey, com.atlassian.crowd.embedded.api.User 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,
                                  com.atlassian.crowd.embedded.api.User 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,
                                                             com.atlassian.crowd.embedded.api.User 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.

voteOn

com.atlassian.gadgets.Vote voteOn(String completeGadgetKey,
                                  com.atlassian.crowd.embedded.api.User remoteUser)
Decides if a user has permission to view a particular gadget.

Parameters:
completeGadgetKey - The plugin key 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

extractModuleKey

String extractModuleKey(String gadgetUri)
Used to extract/convert a url to a plugin key.

Parameters:
gadgetUri - The url to convert
Returns:
The plugin key


Copyright © 2002-2012 Atlassian. All Rights Reserved.