com.atlassian.jira.security.type
Class GroupCF

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

public class GroupCF
extends AbstractIssueFieldSecurityType

Issue Security and Permission type for a Group Selector custom field, or select-list custom fields which specify groups.

Since:
3.6

Field Summary
static String TYPE
           
 
Constructor Summary
GroupCF(JiraAuthenticationContext jiraAuthenticationContext, GroupSelectorUtils groupSelectorUtils, CustomFieldManager customFieldManager, UserUtil userUtil)
           
 
Method Summary
 void doValidation(String key, Map parameters, JiraServiceContext jiraServiceContext)
           
 String getArgumentDisplay(String argument)
           
 List getDisplayFields()
           
 String getDisplayName()
           
protected  String getFieldName()
           
 org.apache.lucene.search.Query getQuery(com.atlassian.crowd.embedded.api.User searcher, org.ofbiz.core.entity.GenericValue entity, String parameter)
           
protected  org.apache.lucene.search.BooleanQuery getQueryForProject(org.ofbiz.core.entity.GenericValue project, com.atlassian.crowd.embedded.api.User searcher)
          Gets called to produce the Lucene query for a project
protected  org.apache.lucene.search.BooleanQuery getQueryForSecurityLevel(org.ofbiz.core.entity.GenericValue issueSecurity, com.atlassian.crowd.embedded.api.User searcher)
          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.
 String getType()
           
 Set<com.atlassian.crowd.embedded.api.User> getUsers(PermissionContext ctx, String customFieldId)
          Get user specified by the Custom Field
protected  boolean hasIssuePermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, org.ofbiz.core.entity.GenericValue issueGv, String customFieldName)
          Determines if the given user has permission to see the given issue by using the custom field with the given custom field name to look up a group.
protected  boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, org.ofbiz.core.entity.GenericValue project)
           
 
Methods inherited from class com.atlassian.jira.security.type.AbstractIssueFieldSecurityType
getQuery, hasPermission, hasPermission
 
Methods inherited from class com.atlassian.jira.security.type.AbstractSecurityType
isValidForPermission
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final String TYPE
See Also:
Constant Field Values
Constructor Detail

GroupCF

public GroupCF(JiraAuthenticationContext jiraAuthenticationContext,
               GroupSelectorUtils groupSelectorUtils,
               CustomFieldManager customFieldManager,
               UserUtil userUtil)
Method Detail

getDisplayName

public String getDisplayName()

getType

public String getType()

getQuery

public org.apache.lucene.search.Query getQuery(com.atlassian.crowd.embedded.api.User searcher,
                                               org.ofbiz.core.entity.GenericValue entity,
                                               String parameter)
Specified by:
getQuery in interface SecurityType
Overrides:
getQuery in class AbstractIssueFieldSecurityType

getQueryForProject

protected org.apache.lucene.search.BooleanQuery getQueryForProject(org.ofbiz.core.entity.GenericValue project,
                                                                   com.atlassian.crowd.embedded.api.User searcher)
Description copied from class: AbstractIssueFieldSecurityType
Gets called to produce the Lucene query for a project

Overrides:
getQueryForProject in class AbstractIssueFieldSecurityType
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

getQueryForSecurityLevel

protected org.apache.lucene.search.BooleanQuery getQueryForSecurityLevel(org.ofbiz.core.entity.GenericValue issueSecurity,
                                                                         com.atlassian.crowd.embedded.api.User searcher)
Description copied from class: AbstractIssueFieldSecurityType
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.

Overrides:
getQueryForSecurityLevel in class AbstractIssueFieldSecurityType
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 null.

doValidation

public void doValidation(String key,
                         Map parameters,
                         JiraServiceContext jiraServiceContext)

getFieldName

protected String getFieldName()
Specified by:
getFieldName in class AbstractIssueFieldSecurityType

hasProjectPermission

protected boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user,
                                       boolean issueCreation,
                                       org.ofbiz.core.entity.GenericValue project)
Specified by:
hasProjectPermission in class AbstractIssueFieldSecurityType

hasIssuePermission

protected boolean hasIssuePermission(com.atlassian.crowd.embedded.api.User user,
                                     boolean issueCreation,
                                     org.ofbiz.core.entity.GenericValue issueGv,
                                     String customFieldName)
Determines if the given user has permission to see the given issue by using the custom field with the given custom field name to look up a group. Returns true only if the user is in the group.

Specified by:
hasIssuePermission in class AbstractIssueFieldSecurityType
Parameters:
user - the user for whom permission is being determined.
issueCreation - not used.
issueGv - the issue to which permission is being determined
customFieldName - the name of the custom field.
Returns:
true only if the user is in the group defined by the issue's named custom field.

getDisplayFields

public List getDisplayFields()

getArgumentDisplay

public String getArgumentDisplay(String argument)
Specified by:
getArgumentDisplay in interface SecurityType
Overrides:
getArgumentDisplay in class AbstractSecurityType

getUsers

public Set<com.atlassian.crowd.embedded.api.User> getUsers(PermissionContext ctx,
                                                           String customFieldId)
Get user specified by the Custom Field

Specified by:
getUsers in interface SecurityType
Overrides:
getUsers in class AbstractIssueFieldSecurityType
Parameters:
customFieldId - eg. 'customfield_10000'
ctx - The current issue and project
Returns:
A set of Users.


Copyright © 2002-2012 Atlassian. All Rights Reserved.