Class AbstractIssueFieldSecurityType

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

public abstract class AbstractIssueFieldSecurityType extends AbstractSecurityType
  • Constructor Details

    • AbstractIssueFieldSecurityType

      public AbstractIssueFieldSecurityType()
  • Method Details

    • isTopLevelProjectPermission

      public boolean isTopLevelProjectPermission()
      Description copied from interface: SecurityType
      Returns true if this permission depends only on a project value and not on issue security level or any field value. Used for optimisation.
    • 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.
    • getPermissionFieldContents

      public Set<org.apache.lucene.util.BytesRef> getPermissionFieldContents(ApplicationUser searcher, @Nonnull Project project, String parameter)
      Description copied from interface: SecurityType
      Returns a set of (project permission field) contents based on the project and optionally the parameter (for role-based queries). This is needed to build project security scheme query.
      Parameters:
      searcher - The searcher conducting the search
      project - The project for which we're constructing the permissions field contents
      parameter - Parameter identifying user related field (reporter, assignee, etc)
      Returns:
      A set of Lucene permissions field tuples
      See Also:
    • isTopLevelIssueSecurityPermission

      public boolean isTopLevelIssueSecurityPermission()
      Description copied from interface: SecurityType
      Returns true if this permission depends only on a issue security level value and not on project or any field value. Used for optimisation.
    • getPermissionFieldContents

      public Set<org.apache.lucene.util.BytesRef> getPermissionFieldContents(ApplicationUser searcher, Project project, IssueSecurityLevel securityLevel, String parameter)
      Description copied from interface: SecurityType
      Returns a set of (issue level permission field) contents based on the security level, the project and optionally the parameter (for role-based queries). This is needed to build issue security level query.
      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 permissions field contents
      parameter - Parameter identifying user related field (reporter, assignee, etc)
      Returns:
      A set of Lucene permissions field tuples
      See Also:
    • getPermissionFieldContentsForProject

      @Nullable protected Set<org.apache.lucene.util.BytesRef> getPermissionFieldContentsForProject(@Nonnull Project project, @Nullable ApplicationUser 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
    • getPermissionFieldContentsForSecurityLevel

      @Nullable protected Set<org.apache.lucene.util.BytesRef> getPermissionFieldContentsForSecurityLevel(@Nonnull IssueSecurityLevel issueSecurity, @Nullable ApplicationUser 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(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(Issue issue, String parameter, ApplicationUser 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, ApplicationUser 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(ApplicationUser user, boolean issueCreation, Issue issue, String parameter)
    • hasProjectPermission

      protected abstract boolean hasProjectPermission(ApplicationUser user, boolean issueCreation, Project project)