public class

IssueSecurityLevelManagerImpl

extends Object
implements IssueSecurityLevelManager
java.lang.Object
   ↳ com.atlassian.jira.issue.security.IssueSecurityLevelManagerImpl

Class Overview

This class gets a list of all the security that can be part of a issue security scheme

Summary

Fields
protected final Logger log
Public Constructors
IssueSecurityLevelManagerImpl(IssueSecuritySchemeManager issueSecuritySchemeManager, SecurityTypeManager securityTypeManager, ProjectManager projectManager, UserManager userManager, UserKeyService userKeyService, PermissionManager permissionManager, EntityEngine entityEngine, CacheManager cacheManager)
Public Methods
void clearProjectLevels(Project project)
Clears the User security Level Map.
void clearUsersLevels()
Clears the User security Level Map.
IssueSecurityLevel createIssueSecurityLevel(long schemeId, String name, String description)
Creates an Issue Security Level with the given properties.
void deleteSecurityLevel(Long levelId)
Deletes the given Issue Security Level and any child permissions.
Collection<IssueSecurityLevel> getAllIssueSecurityLevels()
Get all the different levels of security across all schemes.
Collection<GenericValue> getAllSecurityLevels()
Get all the different levels of security across all schemes.
@Nonnull Collection<IssueSecurityLevel> getAllSecurityLevelsForUser(ApplicationUser user)
Get the different levels of security that the user can see across all projects.
Collection<GenericValue> getAllUsersSecurityLevels(ApplicationUser user)
Get the different levels of security that the user can see across all projects.
Long getDefaultSecurityLevel(Project project)
Returns the default Security Level as defined in the Issue Security Level scheme for the given project.
GenericValue getIssueSecurity(Long id)
Returns the IssueSecurityLevel with the given ID.
String getIssueSecurityDescription(Long id)
GenericValue getIssueSecurityLevel(Long id)
Returns the IssueSecurityLevel with the given ID.
List<IssueSecurityLevel> getIssueSecurityLevels(long schemeId)
Returns the list of Security Levels for the given Issue Security Level Scheme.
Collection<IssueSecurityLevel> getIssueSecurityLevelsByName(String securityLevelName)
Get the different levels of security that have the specified name.
String getIssueSecurityName(Long id)
Get the name of the issue security
Long getSchemeDefaultSecurityLevel(GenericValue project)
Returns the default Security Level as defined in the Issue Security Level scheme for the given project.
List<GenericValue> getSchemeIssueSecurityLevels(Long schemeId)
Returns the list of Security Levels for the given Issue Security Level Scheme.
IssueSecurityLevel getSecurityLevel(long id)
Returns the IssueSecurityLevel with the given ID.
Collection<GenericValue> getSecurityLevelsByName(String securityLevelName)
Get the different levels of security that have the specified name.
Collection<IssueSecurityLevel> getSecurityLevelsForUserByName(ApplicationUser user, String securityLevelName)
Get the different levels of security that a user can see that have the specified name.
List<IssueSecurityLevel> getUsersSecurityLevels(Issue issue, ApplicationUser user)
Get the different levels of security that can be set for this issue.
List<GenericValue> getUsersSecurityLevels(GenericValue entity, ApplicationUser user)
Get the different levels of security that can be set for this issue.
List<IssueSecurityLevel> getUsersSecurityLevels(Project project, ApplicationUser user)
Get the different levels of security that can be set for an issue created in this project.
Collection<GenericValue> getUsersSecurityLevelsByName(ApplicationUser user, String securityLevelName)
Get the different levels of security that a user can see that have the specified name.
@EventListener void onClearCache(ClearCacheEvent event)
@EventListener void onEvent(IssueSecuritySchemeDeletedEvent event)
boolean schemeIssueSecurityExists(Long id)
Checks to see if the issue security exists
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.issue.security.IssueSecurityLevelManager

Fields

protected final Logger log

Public Constructors

public IssueSecurityLevelManagerImpl (IssueSecuritySchemeManager issueSecuritySchemeManager, SecurityTypeManager securityTypeManager, ProjectManager projectManager, UserManager userManager, UserKeyService userKeyService, PermissionManager permissionManager, EntityEngine entityEngine, CacheManager cacheManager)

Public Methods

public void clearProjectLevels (Project project)

Clears the User security Level Map. This is done when security records are added or deleted

public void clearUsersLevels ()

Clears the User security Level Map. This is done when security records are added or deleted

public IssueSecurityLevel createIssueSecurityLevel (long schemeId, String name, String description)

Creates an Issue Security Level with the given properties.

Parameters
schemeId The Issue security scheme that this level belongs to.
name The name of the new level
description an optional description
Returns
  • the newly created Issue Security Level

public void deleteSecurityLevel (Long levelId)

Deletes the given Issue Security Level and any child permissions.

Parameters
levelId Issue Security Level ID

public Collection<IssueSecurityLevel> getAllIssueSecurityLevels ()

Get all the different levels of security across all schemes.

Returns
  • list containing the security levels, can be null

public Collection<GenericValue> getAllSecurityLevels ()

Get all the different levels of security across all schemes.

Returns
  • list containing the security levels, can be null
Throws
GenericEntityException

@Nonnull public Collection<IssueSecurityLevel> getAllSecurityLevelsForUser (ApplicationUser user)

Get the different levels of security that the user can see across all projects.

Parameters
user The user used for the security check
Returns
  • list containing the security levels

public Collection<GenericValue> getAllUsersSecurityLevels (ApplicationUser user)

Get the different levels of security that the user can see across all projects.

Parameters
user The user used for the security check
Returns
  • list containing the security levels, can be null
Throws
GenericEntityException

public Long getDefaultSecurityLevel (Project project)

Returns the default Security Level as defined in the Issue Security Level scheme for the given project.

Parameters
project the Project
Returns
  • the default Security Level as defined in the Issue Security Level scheme for the given project. Can be null.

public GenericValue getIssueSecurity (Long id)

Returns the IssueSecurityLevel with the given ID.

Parameters
id the ID
Returns
  • the IssueSecurityLevel with the given ID.

public String getIssueSecurityDescription (Long id)

public GenericValue getIssueSecurityLevel (Long id)

Returns the IssueSecurityLevel with the given ID.

Parameters
id the ID
Returns
  • the IssueSecurityLevel with the given ID.

public List<IssueSecurityLevel> getIssueSecurityLevels (long schemeId)

Returns the list of Security Levels for the given Issue Security Level Scheme. The elements are ordered by name.

Parameters
schemeId ID of the Issue Security Level Scheme.
Returns
  • the list of Security Levels for the given Issue Security Level Scheme.

public Collection<IssueSecurityLevel> getIssueSecurityLevelsByName (String securityLevelName)

Get the different levels of security that have the specified name.

Parameters
securityLevelName the name of the security level.
Returns
  • a collection of the IssueSecurityLevels with the specified name.

public String getIssueSecurityName (Long id)

Get the name of the issue security

Parameters
id The security Id
Returns
  • The name of the security

public Long getSchemeDefaultSecurityLevel (GenericValue project)

Returns the default Security Level as defined in the Issue Security Level scheme for the given project.

Parameters
project the Project
Returns
  • the default Security Level as defined in the Issue Security Level scheme for the given project. Can be null.
Throws
GenericEntityException

public List<GenericValue> getSchemeIssueSecurityLevels (Long schemeId)

Returns the list of Security Levels for the given Issue Security Level Scheme.

Parameters
schemeId ID of the Issue Security Level Scheme.
Returns
  • the list of Security Levels for the given Issue Security Level Scheme.

public IssueSecurityLevel getSecurityLevel (long id)

Returns the IssueSecurityLevel with the given ID.

Parameters
id the ID
Returns
  • the IssueSecurityLevel with the given ID.

public Collection<GenericValue> getSecurityLevelsByName (String securityLevelName)

Get the different levels of security that have the specified name.

Parameters
securityLevelName the name of the security level.
Returns
  • a collection of the GenericValues representing each level with the specified name.
Throws
GenericEntityException

public Collection<IssueSecurityLevel> getSecurityLevelsForUserByName (ApplicationUser user, String securityLevelName)

Get the different levels of security that a user can see that have the specified name.

Parameters
user the user
securityLevelName the name of the security level.
Returns
  • a collection of each IssueSecurityLevel they can see with the specified name.

public List<IssueSecurityLevel> getUsersSecurityLevels (Issue issue, ApplicationUser user)

Get the different levels of security that can be set for this issue. If you are creating a new Issue, then use #getUsersSecurityLevels(com.atlassian.jira.project.Project, com.atlassian.crowd.embedded.api.User).

Parameters
issue This is the issue that the security is being checked for
user The user used for the security check
Returns
  • list containing the security levels, can be null

public List<GenericValue> getUsersSecurityLevels (GenericValue entity, ApplicationUser user)

Get the different levels of security that can be set for this issue. TODO: JRA-14323 This method can return incorrect results because of a bug in caching.

When editing an Issue, then you would pass in the GenericValue for the Issue. When creating an Issue, the project is passed in.

Parameters
entity This is the issue or the project that the security is being checked for
user The user used for the security check
Returns
  • an unmodifiable List containing the security levels
Throws
GenericEntityException

public List<IssueSecurityLevel> getUsersSecurityLevels (Project project, ApplicationUser user)

Get the different levels of security that can be set for an issue created in this project. If you are editing an existing Issue, then use #getUsersSecurityLevels(Issue, User).

Parameters
project the project that the security is being checked for
user The user used for the security check
Returns
  • list containing the security levels, can be null

public Collection<GenericValue> getUsersSecurityLevelsByName (ApplicationUser user, String securityLevelName)

Get the different levels of security that a user can see that have the specified name.

Parameters
user the user
securityLevelName the name of the security level.
Returns
  • a collection of the GenericValues representing each level they can see with the specified name.
Throws
GenericEntityException

@EventListener public void onClearCache (ClearCacheEvent event)

@EventListener public void onEvent (IssueSecuritySchemeDeletedEvent event)

public boolean schemeIssueSecurityExists (Long id)

Checks to see if the issue security exists

Parameters
id The security Id
Returns
  • True / False