com.atlassian.jira.security.type
Class AbstractIssueFieldSecurityType

java.lang.Object
  extended by com.atlassian.jira.security.type.AbstractSecurityType
      extended by com.atlassian.jira.security.type.AbstractIssueFieldSecurityType
All Implemented Interfaces:
SchemeType, SecurityType
Direct Known Subclasses:
GroupCF, SimpleIssueFieldSecurityType, UserCF

public abstract class AbstractIssueFieldSecurityType
extends AbstractSecurityType


Constructor Summary
AbstractIssueFieldSecurityType()
           
 
Method Summary
protected abstract  String getFieldName(String parameter)
          Get the field name for this Issue Field-based Security Type given the parameter in the saved configuration.
 org.apache.lucene.search.Query getQuery(com.atlassian.crowd.embedded.api.User searcher, Project project, IssueSecurityLevel securityLevel, String parameter)
          Returns a query based on security level and the project passed in.
 org.apache.lucene.search.Query getQuery(com.atlassian.crowd.embedded.api.User searcher, Project project, String parameter)
           
protected  org.apache.lucene.search.BooleanQuery getQueryForProject(Project project, com.atlassian.crowd.embedded.api.User searcher, String fieldName)
          Gets called to produce the Lucene query for a project
protected  org.apache.lucene.search.BooleanQuery getQueryForSecurityLevel(IssueSecurityLevel issueSecurity, com.atlassian.crowd.embedded.api.User searcher, String fieldName)
          Produces a Lucene query for a given issue security type such that documents match the query only when the given user is defined for the issue by this custom field in the given security.
protected abstract  boolean hasIssuePermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, org.ofbiz.core.entity.GenericValue issueGv, String argument)
           
protected abstract  boolean hasIssuePermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, Issue issue, String parameter)
           
 boolean hasPermission(org.ofbiz.core.entity.GenericValue entity, String argument)
          Interface for determining if a permission type has the permission.
 boolean hasPermission(org.ofbiz.core.entity.GenericValue entity, String argument, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
          Decides if the given User has permission to see the given issue or project.
 boolean hasPermission(Issue issue, String argument)
          Determines if this permission type is satisfied for anonymous access.
 boolean hasPermission(Issue issue, String parameter, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
          Determines if this permission type is satisfied.
 boolean hasPermission(Project project, String argument)
          Determines if this permission type is satisfied for anonymous access.
 boolean hasPermission(Project project, String parameter, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
          Determines if this permission type is satisfied.
protected abstract  boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, org.ofbiz.core.entity.GenericValue project)
           
protected abstract  boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, Project project)
           
 
Methods inherited from class com.atlassian.jira.security.type.AbstractSecurityType
getArgumentDisplay, isValidForPermission
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.security.type.SecurityType
getUsers
 
Methods inherited from interface com.atlassian.jira.scheme.SchemeType
doValidation, getDisplayName, getType
 

Constructor Detail

AbstractIssueFieldSecurityType

public AbstractIssueFieldSecurityType()
Method Detail

getFieldName

protected abstract String getFieldName(String parameter)
Get the field name for this Issue Field-based Security Type given the parameter in the saved configuration.

Some Field based permissions are based on hard-coded fields like assignee and reporter in which case the parameter is not used. Other types use the parameter to name the particular User or Group custom field that is used for the permission.

Parameters:
parameter - the parameter as saved in the config
Returns:
the field name for this Issue Field-based Security Type.

getQuery

public org.apache.lucene.search.Query getQuery(com.atlassian.crowd.embedded.api.User searcher,
                                               Project project,
                                               String parameter)

getQuery

public org.apache.lucene.search.Query getQuery(com.atlassian.crowd.embedded.api.User searcher,
                                               Project project,
                                               IssueSecurityLevel securityLevel,
                                               String parameter)
Description copied from interface: SecurityType
Returns a query based on security level and the project passed in. This may be required in particular for role based issue security levels. (see JRA-12739)

Parameters:
searcher - The searcher conducting the search
project - The project for which we're constructing a query
securityLevel - The security level for which we are constructing the query
parameter - Parameter identifying user related field (reporter, assignee, etc)
Returns:
A lucene permissions query

getQueryForProject

@Nullable
protected org.apache.lucene.search.BooleanQuery getQueryForProject(@Nonnull
                                                                            Project project,
                                                                            @Nullable
                                                                            com.atlassian.crowd.embedded.api.User searcher,
                                                                            @Nonnull
                                                                            String fieldName)
Gets called to produce the Lucene query for a project

Parameters:
project - The project for which to construct a query
searcher - The user who is searching to add to the query
Returns:
A BooleanQuery with the project and searcher terms, or null if the searcher is either null or not a known user

getQueryForSecurityLevel

@Nullable
protected org.apache.lucene.search.BooleanQuery getQueryForSecurityLevel(@Nonnull
                                                                                  IssueSecurityLevel issueSecurity,
                                                                                  @Nullable
                                                                                  com.atlassian.crowd.embedded.api.User searcher,
                                                                                  @Nonnull
                                                                                  String fieldName)
Produces a Lucene query for a given issue security type such that documents match the query only when the given user is defined for the issue by this custom field in the given security.

Parameters:
issueSecurity - the security defined by this IssueFieldSecurityType instance.
searcher - the user.
Returns:
a query to constrain to the given issue security for the given user or null if user is either null or not a known user

hasPermission

public boolean hasPermission(org.ofbiz.core.entity.GenericValue entity,
                             String argument)
Description copied from interface: SchemeType
Interface for determining if a permission type has the permission.

This method is called if there is no Remote User (ie anonymous)

Parameters:
entity - This is the issue or the project that the security is being checked for
argument - If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name for GroupDropdown)
Returns:
true if anonymous Users have this permission.

hasPermission

public boolean hasPermission(Issue issue,
                             String argument)
Description copied from interface: SchemeType
Determines if this permission type is satisfied for anonymous access.

Parameters:
issue - This is the issue that the security is being checked for
argument - If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name for GroupDropdown)
Returns:
true if anonymous Users have this permission.

hasPermission

public boolean hasPermission(Project project,
                             String argument)
Description copied from interface: SchemeType
Determines if this permission type is satisfied for anonymous access.

Parameters:
project - This is the project that the security is being checked for
argument - If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name for GroupDropdown)
Returns:
true if anonymous Users have this permission.

hasPermission

public boolean hasPermission(org.ofbiz.core.entity.GenericValue entity,
                             String argument,
                             com.atlassian.crowd.embedded.api.User user,
                             boolean issueCreation)
Decides if the given User has permission to see the given issue or project. If the user is null they can never have the permission so false is returned. If the entity is a Project the permission is always true as report and assignee have no context in a project only on the issues with the project It the entity is an Issue check if the user is in the relevent field in the issue

Parameters:
entity - The Generic Value. Should be an Issue (but sometimes it's a Project)
argument - Not needed for this implementation
user - User to check the permission on. If it is null then the check is made on the current user
issueCreation - NFI
Returns:
true if the user is the current assignee otherwise false
See Also:
hasPermission(org.ofbiz.core.entity.GenericValue, java.lang.String), ProjectLead.hasPermission(org.ofbiz.core.entity.GenericValue, java.lang.String), SingleUser.hasPermission(org.ofbiz.core.entity.GenericValue, java.lang.String), GroupDropdown.hasPermission(org.ofbiz.core.entity.GenericValue, java.lang.String)

hasPermission

public boolean hasPermission(Issue issue,
                             String parameter,
                             com.atlassian.crowd.embedded.api.User user,
                             boolean issueCreation)
Description copied from interface: SchemeType
Determines if this permission type is satisfied.

Parameters:
issue - This is the issue that the security is being checked for
parameter - If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name for GroupDropdown)
user - The user for whom the permission is being checked
issueCreation - Whether this permission is being checked during issue creation
Returns:
true if the given User has this permission.

hasPermission

public boolean hasPermission(Project project,
                             String parameter,
                             com.atlassian.crowd.embedded.api.User user,
                             boolean issueCreation)
Description copied from interface: SchemeType
Determines if this permission type is satisfied.

Parameters:
project - This is the project that the security is being checked for
parameter - If this particular SchemeType has been configured with a parameter, then this parameter is passed (eg. Group Name for GroupDropdown)
user - The user for whom the permission is being checked
issueCreation - Whether this permission is being checked during issue creation
Returns:
true if the given User has this permission.

hasIssuePermission

protected abstract boolean hasIssuePermission(com.atlassian.crowd.embedded.api.User user,
                                              boolean issueCreation,
                                              org.ofbiz.core.entity.GenericValue issueGv,
                                              String argument)

hasIssuePermission

protected abstract boolean hasIssuePermission(com.atlassian.crowd.embedded.api.User user,
                                              boolean issueCreation,
                                              Issue issue,
                                              String parameter)

hasProjectPermission

protected abstract boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user,
                                                boolean issueCreation,
                                                org.ofbiz.core.entity.GenericValue project)

hasProjectPermission

protected abstract boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user,
                                                boolean issueCreation,
                                                Project project)


Copyright © 2002-2014 Atlassian. All Rights Reserved.