public class

IssueSecuritySchemeManagerImpl

extends AbstractSchemeManager
implements GroupConfigurable Startable IssueSecuritySchemeManager
java.lang.Object
   ↳ com.atlassian.jira.scheme.AbstractSchemeManager
     ↳ com.atlassian.jira.issue.security.IssueSecuritySchemeManagerImpl

Summary

[Expand]
Inherited Constants
From interface com.atlassian.jira.scheme.SchemeManager
[Expand]
Inherited Fields
From class com.atlassian.jira.scheme.AbstractSchemeManager
Public Constructors
IssueSecuritySchemeManagerImpl(ProjectManager projectManager, SecurityTypeManager securityTypeManager, PermissionContextFactory permissionContextFactory, SchemeFactory schemeFactory, EventPublisher eventPublisher, OfBizDelegator ofBizDelegator, GroupManager groupManager, NodeAssociationStore nodeAssociationStore, CacheManager cacheManager, ApplicationProperties applicationProperties)
Public Methods
GenericValue copyScheme(GenericValue oldScheme)
This method overrides the AbstractSchemeManager because within Issue Security schemes there is an extra level, which is the table that holds the Security Levels for that Scheme.
GenericValue createScheme(String name, String description)
Creates a new scheme
GenericValue createSchemeEntity(GenericValue scheme, SchemeEntity schemeEntity)
void deleteEntities(Iterable<Long> ids)
Deletes a collection of entities from the database.
void deleteEntity(Long id)
Deletes an entity with the given id from the database.
void deleteScheme(Long id)
Deletes a scheme from the database
String getDefaultDescriptionKey()
String getDefaultNameKey()
List<GenericValue> getEntities(GenericValue scheme, String entityTypeId)
Inherited from SchemeManager.
List<GenericValue> getEntities(GenericValue scheme, String type, Long schemeTypeId)
Get all Generic Value issue security records for a particular scheme, type and Id
List<GenericValue> getEntities(GenericValue scheme)
Get all Scheme entity records for a particular scheme
List<GenericValue> getEntities(GenericValue scheme, Long schemeTypeId, String parameter)
Get all Generic Value permission records for a particular scheme and permission Id
List<GenericValue> getEntities(GenericValue scheme, Long securityLevelId)
Inherited from SchemeManager.
List<GenericValue> getEntitiesBySecurityLevel(Long securityLevelId)
Returns the configured permissions for the given Security Level.
String getEntityName()
IssueSecurityLevelScheme getIssueSecurityLevelScheme(Long issueSecuritySchemeId)
Returns the IssueSecurityLevelScheme for the given ID.
Collection<IssueSecurityLevelScheme> getIssueSecurityLevelSchemes()
Returns a list containing all defined IssueSecuritySchemes
List<IssueSecurityLevelPermission> getPermissionsBySecurityLevel(Long securityLevelId)
Returns the configured permissions for the given Security Level.
List<Project> getProjectsUsingScheme(long schemeId)
Returns all projects that use the given Issue Security Level Scheme.
String getSchemeDesc()
String getSchemeEntityName()
Collection<GenericValue> getSchemesContainingEntity(String type, String parameter)
This is a method that is meant to quickly get you all the schemes that contain an entity of the specified type and parameter.
boolean hasSecurityLevelAccess(Issue issue, ApplicationUser user)
Checks if the given user has permission to see the Issue Security Level of the given issue.
boolean isGroupUsed(Group group)
Determine whether configuration exists for the specified Group.
@EventListener void onClearCache(ClearCacheEvent event)
boolean removeEntities(GenericValue scheme, Long entityTypeId)
Retrieves all the entites for this permission and then removes them.
boolean removeEntities(String type, String parameter)
This method overrides the super implemntation in order to clear cache.
void setSchemeForProject(Project project, Long schemeId)
Set the issue security level scheme to be used by the given Project.
void start()
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.
Protected Methods
AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent(Scheme scheme, Project project)
@Nonnull AbstractSchemeCopiedEvent createSchemeCopiedEvent(Scheme oldScheme, Scheme newScheme)
AbstractSchemeEvent createSchemeCreatedEvent(Scheme scheme)
Object createSchemeEntityDeletedEvent(GenericValue entity)
GenericValue createSchemeEntityNoEvent(GenericValue scheme, SchemeEntity schemeEntity)
AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Scheme scheme, Project project)
AbstractSchemeUpdatedEvent createSchemeUpdatedEvent(Scheme scheme, Scheme originalScheme)
void flushProjectSchemes()
SchemeEntity makeSchemeEntity(GenericValue entity)
[Expand]
Inherited Methods
From class com.atlassian.jira.scheme.AbstractSchemeManager
From class java.lang.Object
From interface com.atlassian.jira.config.group.GroupConfigurable
From interface com.atlassian.jira.extension.Startable
From interface com.atlassian.jira.issue.security.IssueSecuritySchemeManager
From interface com.atlassian.jira.scheme.SchemeManager

Public Constructors

public IssueSecuritySchemeManagerImpl (ProjectManager projectManager, SecurityTypeManager securityTypeManager, PermissionContextFactory permissionContextFactory, SchemeFactory schemeFactory, EventPublisher eventPublisher, OfBizDelegator ofBizDelegator, GroupManager groupManager, NodeAssociationStore nodeAssociationStore, CacheManager cacheManager, ApplicationProperties applicationProperties)

Public Methods

public GenericValue copyScheme (GenericValue oldScheme)

This method overrides the AbstractSchemeManager because within Issue Security schemes there is an extra level, which is the table that holds the Security Levels for that Scheme. This is because with Issue Security schemes you can add and delete the different levels of security. With other schemes this is not possible

Parameters
oldScheme The permission scheme to be copied
Returns
  • The new permission scheme
Throws
GenericEntityException

public GenericValue createScheme (String name, String description)

Creates a new scheme

Parameters
name The name of the new scheme
description The description of the new scheme
Returns
  • The new scheme object
Throws
GenericEntityException

public GenericValue createSchemeEntity (GenericValue scheme, SchemeEntity schemeEntity)

Throws
GenericEntityException

public void deleteEntities (Iterable<Long> ids)

Deletes a collection of entities from the database.

Parameters
ids a collection entity ids to be deleted.

public void deleteEntity (Long id)

Deletes an entity with the given id from the database.

Parameters
id The id of the entity to be deleted

public void deleteScheme (Long id)

Deletes a scheme from the database

Parameters
id Id of the scheme to be deleted
Throws
GenericEntityException

public String getDefaultDescriptionKey ()

public String getDefaultNameKey ()

public List<GenericValue> getEntities (GenericValue scheme, String entityTypeId)

Inherited from SchemeManager.

Throws
GenericEntityException

public List<GenericValue> getEntities (GenericValue scheme, String type, Long schemeTypeId)

Get all Generic Value issue security records for a particular scheme, type and Id

Parameters
scheme The scheme that the permissions belong to
type The type of the permission(Group, Current Reporter etc)
schemeTypeId The security level Id
Returns
  • List of (GenericValue) permissions
Throws
GenericEntityException

public List<GenericValue> getEntities (GenericValue scheme)

Get all Scheme entity records for a particular scheme

Parameters
scheme The scheme that the entities belong to
Returns
  • List of (GenericValue) entities

public List<GenericValue> getEntities (GenericValue scheme, Long schemeTypeId, String parameter)

Get all Generic Value permission records for a particular scheme and permission Id

Parameters
scheme The scheme that the permissions belong to
schemeTypeId The security level Id
parameter The permission parameter (group name etc)
Returns
  • List of (GenericValue) permissions
Throws
GenericEntityException

public List<GenericValue> getEntities (GenericValue scheme, Long securityLevelId)

Inherited from SchemeManager.

Throws
GenericEntityException

public List<GenericValue> getEntitiesBySecurityLevel (Long securityLevelId)

Returns the configured permissions for the given Security Level.

Parameters
securityLevelId the Security Level
Returns
  • the configured permissions for the given Security Level.

public String getEntityName ()

public IssueSecurityLevelScheme getIssueSecurityLevelScheme (Long issueSecuritySchemeId)

Returns the IssueSecurityLevelScheme for the given ID.

Parameters
issueSecuritySchemeId Scheme ID
Returns
  • the IssueSecurityLevelScheme for the given ID.

public Collection<IssueSecurityLevelScheme> getIssueSecurityLevelSchemes ()

Returns a list containing all defined IssueSecuritySchemes

Returns
  • a list of IssueSecuritySchemes

public List<IssueSecurityLevelPermission> getPermissionsBySecurityLevel (Long securityLevelId)

Returns the configured permissions for the given Security Level.

Parameters
securityLevelId the Security Level
Returns
  • the configured permissions for the given Security Level.

public List<Project> getProjectsUsingScheme (long schemeId)

Returns all projects that use the given Issue Security Level Scheme.

Parameters
schemeId ID of the Issue Security Level Scheme
Returns
  • all projects that use the given Issue Security Level Scheme.

public String getSchemeDesc ()

public String getSchemeEntityName ()

public Collection<GenericValue> getSchemesContainingEntity (String type, String parameter)

This is a method that is meant to quickly get you all the schemes that contain an entity of the specified type and parameter.

Parameters
type is the entity type
parameter is the scheme entries parameter value
Returns
  • Collection of GenericValues that represents a scheme

public boolean hasSecurityLevelAccess (Issue issue, ApplicationUser user)

Checks if the given user has permission to see the Issue Security Level of the given issue.

Note that this does not check other permissions.

Parameters
issue the Issue
user the User (null for anonymous)
Returns
  • true if the user hase Security Level permission for the issue.

public boolean isGroupUsed (Group group)

Determine whether configuration exists for the specified Group.

Parameters
group that may or may not exist.
Returns
  • true if the group is used in the components configuration.

@EventListener public void onClearCache (ClearCacheEvent event)

public boolean removeEntities (GenericValue scheme, Long entityTypeId)

Retrieves all the entites for this permission and then removes them.

Parameters
scheme to remove entites from must NOT be null
entityTypeId to remove
Returns
  • True all the time (legacy)

public boolean removeEntities (String type, String parameter)

This method overrides the super implemntation in order to clear cache.

Parameters
type type
parameter parameter
Returns
  • the original result of the call to super method
Throws
RemoveException if super method throws it

public void setSchemeForProject (Project project, Long schemeId)

Set the issue security level scheme to be used by the given Project.

Parameters
project The Project
schemeId The desired new security level scheme to use - null indicates "no issue security levels".

public void start ()

This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Throws
Exception

Protected Methods

protected AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent (Scheme scheme, Project project)

@Nonnull protected AbstractSchemeCopiedEvent createSchemeCopiedEvent (Scheme oldScheme, Scheme newScheme)

protected AbstractSchemeEvent createSchemeCreatedEvent (Scheme scheme)

protected Object createSchemeEntityDeletedEvent (GenericValue entity)

protected GenericValue createSchemeEntityNoEvent (GenericValue scheme, SchemeEntity schemeEntity)

Throws
GenericEntityException

protected AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent (Scheme scheme, Project project)

protected AbstractSchemeUpdatedEvent createSchemeUpdatedEvent (Scheme scheme, Scheme originalScheme)

protected void flushProjectSchemes ()

protected SchemeEntity makeSchemeEntity (GenericValue entity)