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, GroupManager groupManager)
           
 
Method Summary
 void doValidation(String key, Map<String,String> parameters, JiraServiceContext jiraServiceContext)
           
 String getArgumentDisplay(String argument)
           
 List<Field> getDisplayFields()
           
 String getDisplayName()
           
protected  String getFieldName(String parameter)
          Get the field name for this Issue Field-based Security Type given the parameter in the saved configuration.
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.
 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 hasIssuePermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, Issue issue, String parameter)
           
protected  boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, org.ofbiz.core.entity.GenericValue project)
           
protected  boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user, boolean issueCreation, Project project)
           
 
Methods inherited from class com.atlassian.jira.security.type.AbstractIssueFieldSecurityType
getQuery, getQuery, hasPermission, hasPermission, hasPermission, hasPermission, 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,
               GroupManager groupManager)
Method Detail

getDisplayName

public String getDisplayName()

getType

public String getType()

getQueryForProject

protected org.apache.lucene.search.BooleanQuery getQueryForProject(Project project,
                                                                   com.atlassian.crowd.embedded.api.User searcher,
                                                                   String fieldName)
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, or null if the searcher is either null or not a known user

getQueryForSecurityLevel

protected org.apache.lucene.search.BooleanQuery getQueryForSecurityLevel(IssueSecurityLevel issueSecurity,
                                                                         com.atlassian.crowd.embedded.api.User searcher,
                                                                         String fieldName)
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 either null or not a known user

doValidation

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

getFieldName

protected String getFieldName(String parameter)
Description copied from class: AbstractIssueFieldSecurityType
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.

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

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

hasProjectPermission

protected boolean hasProjectPermission(com.atlassian.crowd.embedded.api.User user,
                                       boolean issueCreation,
                                       Project 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.

hasIssuePermission

protected boolean hasIssuePermission(com.atlassian.crowd.embedded.api.User user,
                                     boolean issueCreation,
                                     Issue issue,
                                     String parameter)
Specified by:
hasIssuePermission in class AbstractIssueFieldSecurityType

getDisplayFields

public List<Field> 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

Parameters:
customFieldId - eg. 'customfield_10000'
ctx - The current issue and project
Returns:
A set of Users.


Copyright © 2002-2014 Atlassian. All Rights Reserved.