com.atlassian.jira.dashboard.permission
Class JiraGadgetPermissionManager

java.lang.Object
  extended by com.atlassian.jira.dashboard.permission.JiraGadgetPermissionManager
All Implemented Interfaces:
GadgetPermissionManager

public class JiraGadgetPermissionManager
extends Object
implements GadgetPermissionManager


Constructor Summary
JiraGadgetPermissionManager(PermissionManager permissionManager, com.atlassian.plugin.PluginAccessor pluginAccessor, com.atlassian.gadgets.dashboard.spi.DashboardPermissionService permissionService)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JiraGadgetPermissionManager

public JiraGadgetPermissionManager(PermissionManager permissionManager,
                                   com.atlassian.plugin.PluginAccessor pluginAccessor,
                                   com.atlassian.gadgets.dashboard.spi.DashboardPermissionService permissionService)
Method Detail

voteOn

public com.atlassian.gadgets.Vote voteOn(com.atlassian.gadgets.plugins.PluginGadgetSpec pluginGadgetSpec,
                                         com.atlassian.crowd.embedded.api.User remoteUser)
Description copied from interface: GadgetPermissionManager
Decides if a user has permission to view a particular gadget.

Specified by:
voteOn in interface GadgetPermissionManager
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

public com.atlassian.gadgets.dashboard.DashboardState filterGadgets(com.atlassian.gadgets.dashboard.DashboardState dashboardState,
                                                                    com.atlassian.crowd.embedded.api.User remoteUser)
Description copied from interface: GadgetPermissionManager
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.

Specified by:
filterGadgets in interface GadgetPermissionManager
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.

extractModuleKey

public String extractModuleKey(String gadgetUri)
Description copied from interface: GadgetPermissionManager
Used to extract/convert a url to a plugin key.

Specified by:
extractModuleKey in interface GadgetPermissionManager
Parameters:
gadgetUri - The url to convert
Returns:
The plugin key

voteOn

public com.atlassian.gadgets.Vote voteOn(String completeGadgetKey,
                                         com.atlassian.crowd.embedded.api.User remoteUser)
Description copied from interface: GadgetPermissionManager
Decides if a user has permission to view a particular gadget.

Specified by:
voteOn in interface GadgetPermissionManager
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


Copyright © 2002-2012 Atlassian. All Rights Reserved.