com.atlassian.jira.bc.whitelist
Class DefaultWhitelistService

java.lang.Object
  extended by com.atlassian.jira.bc.whitelist.DefaultWhitelistService
All Implemented Interfaces:
WhitelistService

public class DefaultWhitelistService
extends Object
implements WhitelistService

Since:
v4.3

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.whitelist.WhitelistService
WhitelistService.WhitelistResult, WhitelistService.WhitelistUpdateValidationResult
 
Constructor Summary
DefaultWhitelistService(PermissionManager permissionManager, WhitelistManager whitelistManager, I18nHelper.BeanFactory beanFactory)
           
 
Method Summary
 WhitelistService.WhitelistResult getRules(JiraServiceContext context)
          Returns a list of rules that are currently allowed in the whitelist.
 boolean isAllowed(URI uri)
          Checks if requests to the provided URI are allowed according to the current whitelist configuration
 boolean isDisabled()
          Returns true if the whitelist is currently disabled (meaning all requests are allowed).
 WhitelistService.WhitelistResult updateRules(WhitelistService.WhitelistUpdateValidationResult result)
          Takes the validation result from WhitelistService.validateUpdateRules(com.atlassian.jira.bc.JiraServiceContext, java.util.List, boolean) and persists the new rules.
 WhitelistService.WhitelistUpdateValidationResult validateUpdateRules(JiraServiceContext context, List<String> rules, boolean disabled)
          Validates that the current user is allowed to update the whitelist by checking if they are a system administrator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWhitelistService

public DefaultWhitelistService(PermissionManager permissionManager,
                               WhitelistManager whitelistManager,
                               I18nHelper.BeanFactory beanFactory)
Method Detail

getRules

public WhitelistService.WhitelistResult getRules(JiraServiceContext context)
Description copied from interface: WhitelistService
Returns a list of rules that are currently allowed in the whitelist. The list will contain entries like:

Specified by:
getRules in interface WhitelistService
Parameters:
context - The service context with the current user & error collection
Returns:
Result containing the list of rules or an error message

validateUpdateRules

public WhitelistService.WhitelistUpdateValidationResult validateUpdateRules(JiraServiceContext context,
                                                                            List<String> rules,
                                                                            boolean disabled)
Description copied from interface: WhitelistService
Validates that the current user is allowed to update the whitelist by checking if they are a system administrator.

Specified by:
validateUpdateRules in interface WhitelistService
Parameters:
context - The service context with the current user & error collection
rules - List of rule strings
disabled - true if the whitelist should be turned off
Returns:
A validation result that can be used to persist the new whitelist rules.

updateRules

public WhitelistService.WhitelistResult updateRules(WhitelistService.WhitelistUpdateValidationResult result)
Description copied from interface: WhitelistService
Takes the validation result from WhitelistService.validateUpdateRules(com.atlassian.jira.bc.JiraServiceContext, java.util.List, boolean) and persists the new rules.

Specified by:
updateRules in interface WhitelistService
Parameters:
result - a validation result obtained by calling WhitelistService.validateUpdateRules(com.atlassian.jira.bc.JiraServiceContext, java.util.List, boolean)
Returns:
Result containing the newly peristed whitelist

isDisabled

public boolean isDisabled()
Description copied from interface: WhitelistService
Returns true if the whitelist is currently disabled (meaning all requests are allowed).

Specified by:
isDisabled in interface WhitelistService
Returns:
true if the whitelist is currently disabled (meaning all requests are allowed)

isAllowed

public boolean isAllowed(URI uri)
Description copied from interface: WhitelistService
Checks if requests to the provided URI are allowed according to the current whitelist configuration

Specified by:
isAllowed in interface WhitelistService
Parameters:
uri - The uri a http request is made to
Returns:
true if requests are allowed, false otherwise


Copyright © 2002-2012 Atlassian. All Rights Reserved.