Class IssueSecuritySchemeManagerImpl
java.lang.Object
com.atlassian.jira.scheme.AbstractSchemeManager
com.atlassian.jira.issue.security.IssueSecuritySchemeManagerImpl
- All Implemented Interfaces:
GroupConfigurable
,Startable
,IssueSecuritySchemeManager
,SchemeManager
public class IssueSecuritySchemeManagerImpl
extends AbstractSchemeManager
implements IssueSecuritySchemeManager, Startable, GroupConfigurable
-
Field Summary
Fields inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
eventPublisher, groupManager, schemeFactory, securityTypeManager
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
-
Constructor Summary
ConstructorsConstructorDescriptionIssueSecuritySchemeManagerImpl
(ProjectManager projectManager, SecurityTypeManager securityTypeManager, PermissionContextFactory permissionContextFactory, SchemeFactory schemeFactory, com.atlassian.event.api.EventPublisher eventPublisher, OfBizDelegator ofBizDelegator, GroupManager groupManager, NodeAssociationStore nodeAssociationStore, com.atlassian.cache.CacheManager cacheManager, IssueIndexingService issueIndexingService, IssueManager issueManager, TaskManager taskManager, QueryDslAccessor queryDslAccessor, I18nHelper i18nHelper) -
Method Summary
Modifier and TypeMethodDescriptionassignSchemeToProject
(Project project, Long newSchemeId, Map<Long, Long> oldToNewSecurityLevelMappings) Set the issue security level scheme to be used by the given Project and map any old security levels to new ones.org.ofbiz.core.entity.GenericValue
copyScheme
(org.ofbiz.core.entity.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.org.ofbiz.core.entity.GenericValue
createScheme
(String name, String description) Creates a new schemeprotected AbstractSchemeAddedToProjectEvent
createSchemeAddedToProjectEvent
(Scheme scheme, Project project) protected AbstractSchemeCopiedEvent
createSchemeCopiedEvent
(Scheme oldScheme, Scheme newScheme) protected AbstractSchemeEvent
createSchemeCreatedEvent
(Scheme scheme) org.ofbiz.core.entity.GenericValue
createSchemeEntity
(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) protected Object
createSchemeEntityDeletedEvent
(org.ofbiz.core.entity.GenericValue entity) protected org.ofbiz.core.entity.GenericValue
createSchemeEntityNoEvent
(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) protected AbstractSchemeRemovedFromProjectEvent
createSchemeRemovedFromProjectEvent
(Scheme scheme, Project project) protected AbstractSchemeUpdatedEvent
createSchemeUpdatedEvent
(Scheme scheme, Scheme originalScheme) 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 databaseprotected void
List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme) Get all Scheme entity records for a particular schemeList<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, Long securityLevelId) Inherited from SchemeManager.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, Long schemeTypeId, String parameter) Get all Generic Value permission records for a particular scheme and permission IdList<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, String entityTypeId) Inherited from SchemeManager.List<org.ofbiz.core.entity.GenericValue>
getEntities
(org.ofbiz.core.entity.GenericValue scheme, String type, Long schemeTypeId) Get all Generic Value issue security records for a particular scheme, type and IdList<org.ofbiz.core.entity.GenericValue>
getEntitiesBySecurityLevel
(Long securityLevelId) Returns the configured permissions for the given Security Level.getIssueSecurityLevelScheme
(Long issueSecuritySchemeId) Returns the IssueSecurityLevelScheme for the given ID.Returns a list containing all defined IssueSecuritySchemesgetPermissionsBySecurityLevel
(Long securityLevelId) Returns the configured permissions for the given Security Level.getProjectsUsingScheme
(long schemeId) Returns all projects that use the given Issue Security Level Scheme.Collection<org.ofbiz.core.entity.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
(com.atlassian.crowd.embedded.api.Group group) Determine whether configuration exists for the specifiedGroup
.protected SchemeEntity
makeSchemeEntity
(org.ofbiz.core.entity.GenericValue entity) void
onClearCache
(ClearCacheEvent event) boolean
removeEntities
(String type, String parameter) This method overrides the super implemntation in order to clear cache.boolean
removeEntities
(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) Retrieves all the entites for this permission and then removes them.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.Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeGenericValue, createSchemeNoEvent, createSchemeObject, getApplicationI18n, getAssociatedSchemes, getAssociationType, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntitiesByIds, getEntity, getGroups, getGroups, getNameForCopy, getProjects, getScheme, getScheme, getSchemeFor, getSchemeIdFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, swapParameterForEntitiesOfType, updateScheme, updateScheme
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.jira.config.group.GroupConfigurable
isGroupUsed
Methods inherited from interface com.atlassian.jira.issue.security.IssueSecuritySchemeManager
getSchemeObject
Methods inherited from interface com.atlassian.jira.scheme.SchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeObject, getAssociatedSchemes, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntitiesByIds, getEntity, getGroups, getGroups, getProjects, getScheme, getScheme, getSchemeFor, getSchemeIdFor, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, swapParameterForEntitiesOfType, updateScheme, updateScheme
-
Constructor Details
-
IssueSecuritySchemeManagerImpl
public IssueSecuritySchemeManagerImpl(ProjectManager projectManager, SecurityTypeManager securityTypeManager, PermissionContextFactory permissionContextFactory, SchemeFactory schemeFactory, com.atlassian.event.api.EventPublisher eventPublisher, OfBizDelegator ofBizDelegator, GroupManager groupManager, NodeAssociationStore nodeAssociationStore, com.atlassian.cache.CacheManager cacheManager, IssueIndexingService issueIndexingService, IssueManager issueManager, TaskManager taskManager, QueryDslAccessor queryDslAccessor, I18nHelper i18nHelper)
-
-
Method Details
-
start
Description copied from interface:Startable
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework. -
onClearCache
- Overrides:
onClearCache
in classAbstractSchemeManager
-
getSchemeEntityName
- Specified by:
getSchemeEntityName
in classAbstractSchemeManager
-
getEntityName
- Specified by:
getEntityName
in classAbstractSchemeManager
-
getSchemeDesc
- Specified by:
getSchemeDesc
in classAbstractSchemeManager
-
getDefaultNameKey
- Specified by:
getDefaultNameKey
in classAbstractSchemeManager
-
getDefaultDescriptionKey
- Specified by:
getDefaultDescriptionKey
in classAbstractSchemeManager
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme) Description copied from interface:SchemeManager
Get all Scheme entity records for a particular scheme- Specified by:
getEntities
in interfaceIssueSecuritySchemeManager
- Specified by:
getEntities
in interfaceSchemeManager
- Overrides:
getEntities
in classAbstractSchemeManager
- Parameters:
scheme
- The scheme that the entities belong to- Returns:
- List of (GenericValue) entities
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long securityLevelId) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:IssueSecuritySchemeManager
Inherited from SchemeManager.- Specified by:
getEntities
in interfaceIssueSecuritySchemeManager
- Specified by:
getEntities
in interfaceSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getIssueSecurityLevelScheme
Description copied from interface:IssueSecuritySchemeManager
Returns the IssueSecurityLevelScheme for the given ID.- Specified by:
getIssueSecurityLevelScheme
in interfaceIssueSecuritySchemeManager
- Parameters:
issueSecuritySchemeId
- Scheme ID- Returns:
- the IssueSecurityLevelScheme for the given ID.
-
getIssueSecurityLevelSchemes
Description copied from interface:IssueSecuritySchemeManager
Returns a list containing all defined IssueSecuritySchemes- Specified by:
getIssueSecurityLevelSchemes
in interfaceIssueSecuritySchemeManager
- Returns:
- a list of IssueSecuritySchemes
-
getEntitiesBySecurityLevel
Description copied from interface:IssueSecuritySchemeManager
Returns the configured permissions for the given Security Level.- Specified by:
getEntitiesBySecurityLevel
in interfaceIssueSecuritySchemeManager
- Parameters:
securityLevelId
- the Security Level- Returns:
- the configured permissions for the given Security Level.
-
getPermissionsBySecurityLevel
Description copied from interface:IssueSecuritySchemeManager
Returns the configured permissions for the given Security Level.- Specified by:
getPermissionsBySecurityLevel
in interfaceIssueSecuritySchemeManager
- Parameters:
securityLevelId
- the Security Level- Returns:
- the configured permissions for the given Security Level.
-
getSchemesContainingEntity
public Collection<org.ofbiz.core.entity.GenericValue> getSchemesContainingEntity(String type, String parameter) Description copied from interface:IssueSecuritySchemeManager
This is a method that is meant to quickly get you all the schemes that contain an entity of the specified type and parameter.- Specified by:
getSchemesContainingEntity
in interfaceIssueSecuritySchemeManager
- Parameters:
type
- is the entity typeparameter
- is the scheme entries parameter value- Returns:
- Collection of GenericValues that represents a scheme
-
setSchemeForProject
Description copied from interface:IssueSecuritySchemeManager
Set the issue security level scheme to be used by the given Project.- Specified by:
setSchemeForProject
in interfaceIssueSecuritySchemeManager
- Parameters:
project
- The ProjectschemeId
- The desired new security level scheme to use - null indicates "no issue security levels".
-
assignSchemeToProject
public String assignSchemeToProject(@Nonnull Project project, Long newSchemeId, Map<Long, Long> oldToNewSecurityLevelMappings) Description copied from interface:IssueSecuritySchemeManager
Set the issue security level scheme to be used by the given Project and map any old security levels to new ones.- Specified by:
assignSchemeToProject
in interfaceIssueSecuritySchemeManager
- Parameters:
project
- The ProjectnewSchemeId
- The desired new security level scheme to use - null indicates "no issue security levels".oldToNewSecurityLevelMappings
- Mappings of old to new security levels. This must not contain null values. '-1' is used to represent the value "none".- Returns:
- the URL of the progress page.
-
getProjectsUsingScheme
Description copied from interface:IssueSecuritySchemeManager
Returns all projects that use the given Issue Security Level Scheme.- Specified by:
getProjectsUsingScheme
in interfaceIssueSecuritySchemeManager
- Parameters:
schemeId
- ID of the Issue Security Level Scheme- Returns:
- all projects that use the given Issue Security Level Scheme.
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long schemeTypeId, String parameter) throws org.ofbiz.core.entity.GenericEntityException Get all Generic Value permission records for a particular scheme and permission Id- Specified by:
getEntities
in interfaceIssueSecuritySchemeManager
- Specified by:
getEntities
in interfaceSchemeManager
- Parameters:
scheme
- The scheme that the permissions belong toschemeTypeId
- The security level Idparameter
- The permission parameter (group name etc)- Returns:
- List of (GenericValue) permissions
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String entityTypeId) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:IssueSecuritySchemeManager
Inherited from SchemeManager.- Specified by:
getEntities
in interfaceIssueSecuritySchemeManager
- Specified by:
getEntities
in interfaceSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
getEntities
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String type, Long schemeTypeId) throws org.ofbiz.core.entity.GenericEntityException Get all Generic Value issue security records for a particular scheme, type and Id- Specified by:
getEntities
in interfaceIssueSecuritySchemeManager
- Specified by:
getEntities
in interfaceSchemeManager
- Parameters:
scheme
- The scheme that the permissions belong totype
- The type of the permission(Group, Current Reporter etc)schemeTypeId
- The security level Id- Returns:
- List of (GenericValue) permissions
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
createSchemeEntity
public org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
createSchemeEntity
in interfaceSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
createSchemeEntityNoEvent
protected org.ofbiz.core.entity.GenericValue createSchemeEntityNoEvent(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) throws org.ofbiz.core.entity.GenericEntityException - Specified by:
createSchemeEntityNoEvent
in classAbstractSchemeManager
- Throws:
org.ofbiz.core.entity.GenericEntityException
-
copyScheme
public org.ofbiz.core.entity.GenericValue copyScheme(org.ofbiz.core.entity.GenericValue oldScheme) throws org.ofbiz.core.entity.GenericEntityException 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- Specified by:
copyScheme
in interfaceSchemeManager
- Overrides:
copyScheme
in classAbstractSchemeManager
- Parameters:
oldScheme
- The permission scheme to be copied- Returns:
- The new permission scheme
- Throws:
org.ofbiz.core.entity.GenericEntityException
- If a DB error occurs
-
createSchemeCopiedEvent
@Nonnull protected AbstractSchemeCopiedEvent createSchemeCopiedEvent(@Nonnull Scheme oldScheme, @Nonnull Scheme newScheme) - Specified by:
createSchemeCopiedEvent
in classAbstractSchemeManager
-
hasSecurityLevelAccess
Description copied from interface:IssueSecuritySchemeManager
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.
- Specified by:
hasSecurityLevelAccess
in interfaceIssueSecuritySchemeManager
- Parameters:
issue
- the Issueuser
- the User (null for anonymous)- Returns:
- true if the user hase Security Level permission for the issue.
-
createSchemeUpdatedEvent
- Specified by:
createSchemeUpdatedEvent
in classAbstractSchemeManager
-
deleteScheme
Deletes a scheme from the database- Specified by:
deleteScheme
in interfaceSchemeManager
- Overrides:
deleteScheme
in classAbstractSchemeManager
- Parameters:
id
- Id of the scheme to be deleted- Throws:
org.ofbiz.core.entity.GenericEntityException
-
deleteEntity
Description copied from interface:SchemeManager
Deletes an entity with the given id from the database.- Specified by:
deleteEntity
in interfaceSchemeManager
- Overrides:
deleteEntity
in classAbstractSchemeManager
- Parameters:
id
- The id of the entity to be deleted- Throws:
DataAccessException
-
deleteEntities
Description copied from interface:SchemeManager
Deletes a collection of entities from the database.- Specified by:
deleteEntities
in interfaceSchemeManager
- Overrides:
deleteEntities
in classAbstractSchemeManager
- Parameters:
ids
- a collection entity ids to be deleted.
-
makeSchemeEntity
- Specified by:
makeSchemeEntity
in classAbstractSchemeManager
-
createSchemeEntityDeletedEvent
- Specified by:
createSchemeEntityDeletedEvent
in classAbstractSchemeManager
-
removeEntities
public boolean removeEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) throws RemoveException Description copied from interface:SchemeManager
Retrieves all the entites for this permission and then removes them.- Specified by:
removeEntities
in interfaceSchemeManager
- Overrides:
removeEntities
in classAbstractSchemeManager
- Parameters:
scheme
- to remove entites from must NOT be nullentityTypeId
- to remove- Returns:
- True all the time (legacy)
- Throws:
RemoveException
- if the delete fails (DB error)
-
createScheme
public org.ofbiz.core.entity.GenericValue createScheme(String name, String description) throws org.ofbiz.core.entity.GenericEntityException Description copied from interface:SchemeManager
Creates a new scheme- Specified by:
createScheme
in interfaceSchemeManager
- Overrides:
createScheme
in classAbstractSchemeManager
- Parameters:
name
- The name of the new schemedescription
- The description of the new scheme- Returns:
- The new scheme object
- Throws:
org.ofbiz.core.entity.GenericEntityException
- If a DB error occurs
-
createSchemeCreatedEvent
- Specified by:
createSchemeCreatedEvent
in classAbstractSchemeManager
-
flushProjectSchemes
protected void flushProjectSchemes()- Overrides:
flushProjectSchemes
in classAbstractSchemeManager
-
removeEntities
This method overrides the super implemntation in order to clear cache.- Specified by:
removeEntities
in interfaceSchemeManager
- Overrides:
removeEntities
in classAbstractSchemeManager
- Parameters:
type
- typeparameter
- parameter- Returns:
- the original result of the call to super method
- Throws:
RemoveException
- if super method throws it
-
createSchemeAddedToProjectEvent
@Nonnull protected AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent(Scheme scheme, Project project) - Specified by:
createSchemeAddedToProjectEvent
in classAbstractSchemeManager
-
createSchemeRemovedFromProjectEvent
@Nonnull protected AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Scheme scheme, Project project) - Specified by:
createSchemeRemovedFromProjectEvent
in classAbstractSchemeManager
-
isGroupUsed
public boolean isGroupUsed(@Nonnull com.atlassian.crowd.embedded.api.Group group) Description copied from interface:GroupConfigurable
Determine whether configuration exists for the specifiedGroup
.- Specified by:
isGroupUsed
in interfaceGroupConfigurable
- Parameters:
group
- that may or may not exist.- Returns:
- true if the group is used in the components configuration.
-