com.atlassian.jira.security.type
Class UserCF

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.UserCF
All Implemented Interfaces:
SchemeType, SecurityType

public class UserCF
extends AbstractIssueFieldSecurityType

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


Field Summary
static String TYPE
           
 
Constructor Summary
UserCF(JiraAuthenticationContext jiraAuthenticationContext, CustomFieldManager customFieldManager)
           
 
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.
 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)
          Defines whether the given user has permission to see the given issue using the issue's value of the named custom field.
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, getQueryForProject, getQueryForSecurityLevel, 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

UserCF

public UserCF(JiraAuthenticationContext jiraAuthenticationContext,
              CustomFieldManager customFieldManager)
Method Detail

getDisplayName

public String getDisplayName()

getType

public String getType()

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)
Defines whether the given user has permission to see the given issue using the issue's value of the named custom field.

Specified by:
hasIssuePermission in class AbstractIssueFieldSecurityType
Parameters:
user - the user whose permission is being checked.
issueCreation - unused.
issueGv - a GenericValue representing the issue.
customFieldName - user custom field to use to determine which users have permission to the issue.
Returns:
true only if the user has permission to see the issue based on the custom field value.

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:
ctx - permission context
customFieldId - eg. 'customfield_10000'
Returns:
the set of users stored in the given custom field in the given context; an empty set is returned if the context could not provide values (i.e. there was no issue specified).


Copyright © 2002-2014 Atlassian. All Rights Reserved.