Class SecurityIndexingUtils

java.lang.Object
com.atlassian.jira.issue.index.SecurityIndexingUtils

@Internal public class SecurityIndexingUtils extends Object
Set of utility methods for indexing and querying project and issue security permissions.

Permissions can be based on a combination of:

  • project id
  • project id + field (name + value)
  • issue security level id
  • issue security level id + project id
  • issue security level id + field (name + value)
Each field which can be used in project security scheme or issue security scheme (i.e. one that is a user or group field) has to be indexed with indexPermissions(FieldValueCollector, Issue, String, String).
Since:
8.0
  • Constructor Details

    • SecurityIndexingUtils

      public SecurityIndexingUtils()
  • Method Details

    • indexPermissions

      public static void indexPermissions(FieldValueCollector collector, Issue issue)
      Index top level permissions - ones that depend only on the project and issue security level and not on a specific field value. For example "project lead" is satisfied for all issues in a given project, regardless of the issues' values.
      Parameters:
      collector - FieldValueCollector to which the indexed field will be added
      issue - Issue that is indexed in the document
    • indexPermissions

      public static void indexPermissions(FieldValueCollector collector, Issue issue, String fieldName, String fieldValue)
      Index field level permissions - ones that depend on specific field value. For example "assignee" is satisfied only by issues which have the assignee field set to the current searcher.
      Parameters:
      collector - FieldValueCollector to which the indexed field will be added
      issue - Issue that is indexed in the document
      fieldName - The name of the field that is being indexed
      fieldValue - The value of the field that is being indexed
    • generateProjectPermissionFieldContentString

      public static String generateProjectPermissionFieldContentString(Long projectId)
      Generate a query String that corresponds to a project permission that is satisfied by the project.
      Parameters:
      projectId - ID of the project for which we generate permission field content
      Returns:
      Permission field content for the project ID as a String
    • generateProjectPermissionFieldContentString

      public static String generateProjectPermissionFieldContentString(Long projectId, String fieldName, String fieldValue)
      Generate a query String that corresponds to a project permission that is satisfied by a concrete value of a concrete field.
      Parameters:
      projectId - ID of the project for which we generate field content
      fieldName - Field name for which we generate permission field content
      fieldValue - Value of the field for which we generate permission field content
      Returns:
      Permission field content for the value of the field in the specified project as a String
    • generateIssueLevelPermissionContentString

      public static String generateIssueLevelPermissionContentString(Long issueSecurityLevel)
      Generate a query String that corresponds to an issue security level permission that is satisfied by the issue security level.
      Parameters:
      issueSecurityLevel - ID of the issue security level for which we generate field content
      Returns:
      Permission field content for the issue security level as a String
    • generateIssueLevelPermissionContentString

      public static String generateIssueLevelPermissionContentString(Long issueSecurityLevel, Long projectId)
      Generate a query String that corresponds to an issue security level permission that is satisfied by the issue security level in the project.
      Parameters:
      issueSecurityLevel - ID of the issue security level for which we generate field content
      projectId - ID of the project for which we generate field content
      Returns:
      Permission field content for the issue security level and project as a String
    • generateIssueLevelPermissionContentString

      public static String generateIssueLevelPermissionContentString(Long issueSecurityLevel, String fieldName, String fieldValue)
      Generate a query String that corresponds to an issue security level permission that is satisfied by a concrete value of a concrete field.
      Parameters:
      issueSecurityLevel - ID of the issue security level for which we generate field content
      fieldName - Field name for which we generate permission field content
      fieldValue - Value of the field for which we generate permission field content
      Returns:
      Permission field content for the issue security level, field name and value as a String