public class

IssueSecuritySchemeManagerImpl

extends AbstractSchemeManager
implements 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 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)
Get all Scheme entity records for a particular scheme
List<GenericValue> getEntities(GenericValue scheme, String entityTypeId)
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, String type, Long schemeTypeId)
Get all Generic Value issue security records for a particular scheme, type and Id
List<GenericValue> getEntities(GenericValue scheme, Long securityLevelId)
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.
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 hasSchemeAuthority(Long entityType, GenericValue issue, User user, boolean issueCreation)
Checks to see if the user has access to issues of this security level.
boolean hasSchemeAuthority(Long entityType, GenericValue entity)
Checks anonymous permission of the given permission type for the given entity.
@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 wil 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.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 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)

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, String entityTypeId)

Throws
GenericEntityException

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, 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, Long securityLevelId)

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 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 hasSchemeAuthority (Long entityType, GenericValue issue, User user, boolean issueCreation)

Checks to see if the user has access to issues of this security level. If the user is not passed in then the check is made on the current user

Parameters
entityType The security level to check against
issue The issue
user The user to check for the permission. User must NOT be null
issueCreation true if this is an attempt to create a new issue
Returns
  • true if the user is a member of the security level otherwise false

public boolean hasSchemeAuthority (Long entityType, GenericValue entity)

Checks anonymous permission of the given permission type for the given entity.

Parameters
entityType permission type.
entity the entity to which permission is being checked.
Returns
  • true only if the anonymous user is permitted.

@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 wil 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)