com.atlassian.jira.issue.security
Class IssueSecuritySchemeManagerImpl

java.lang.Object
  extended by com.atlassian.jira.scheme.AbstractSchemeManager
      extended by com.atlassian.jira.issue.security.IssueSecuritySchemeManagerImpl
All Implemented Interfaces:
Startable, IssueSecuritySchemeManager, SchemeManager

public class IssueSecuritySchemeManagerImpl
extends AbstractSchemeManager
implements IssueSecuritySchemeManager, Startable


Field Summary
 
Fields inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
eventPublisher, schemeFactory, securityTypeManager
 
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
 
Constructor Summary
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)
           
 
Method Summary
 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 scheme
protected  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 deleteEntity(Long id)
          Deletes an entity with the given id from the database.
 void deleteScheme(Long id)
          Deletes a scheme from the database
protected  void flushProjectSchemes()
           
 String getDefaultDescriptionKey()
           
 String getDefaultNameKey()
           
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme)
          Get all Scheme entity records for a particular scheme
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long securityLevelId)
           
 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 Id
 List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String entityTypeId)
           
 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 Id
 List<org.ofbiz.core.entity.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<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 hasSchemeAuthority(Long entityType, org.ofbiz.core.entity.GenericValue entity)
          Checks anonymous permission of the given permission type for the given entity.
 boolean hasSchemeAuthority(Long entityType, org.ofbiz.core.entity.GenericValue issue, com.atlassian.crowd.embedded.api.User user, boolean issueCreation)
          Checks to see if the user has access to issues of this security level.
protected  SchemeEntity makeSchemeEntity(org.ofbiz.core.entity.GenericValue entity)
           
 void onClearCache(ClearCacheEvent event)
           
 boolean removeEntities(org.ofbiz.core.entity.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.
 
Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createSchemeAndEntities, createSchemeGenericValue, createSchemeNoEvent, createSchemeObject, getAssociatedSchemes, getAssociationType, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntity, getGroups, getGroups, getNameForCopy, getProjects, getProjects, getScheme, getScheme, getSchemeFor, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, 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.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, getEntity, getGroups, getGroups, getProjects, getProjects, getScheme, getScheme, getSchemeFor, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme, updateScheme
 

Constructor Detail

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)
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)
Overrides:
onClearCache in class AbstractSchemeManager

getSchemeEntityName

public String getSchemeEntityName()
Specified by:
getSchemeEntityName in class AbstractSchemeManager

getEntityName

public String getEntityName()
Specified by:
getEntityName in class AbstractSchemeManager

getSchemeDesc

public String getSchemeDesc()
Specified by:
getSchemeDesc in class AbstractSchemeManager

getDefaultNameKey

public String getDefaultNameKey()
Specified by:
getDefaultNameKey in class AbstractSchemeManager

getDefaultDescriptionKey

public String getDefaultDescriptionKey()
Specified by:
getDefaultDescriptionKey in class AbstractSchemeManager

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 interface SchemeManager
Overrides:
getEntities in class AbstractSchemeManager
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
Specified by:
getEntities in interface IssueSecuritySchemeManager
Specified by:
getEntities in interface SchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getIssueSecurityLevelScheme

public IssueSecurityLevelScheme getIssueSecurityLevelScheme(Long issueSecuritySchemeId)
Description copied from interface: IssueSecuritySchemeManager
Returns the IssueSecurityLevelScheme for the given ID.

Specified by:
getIssueSecurityLevelScheme in interface IssueSecuritySchemeManager
Parameters:
issueSecuritySchemeId - Scheme ID
Returns:
the IssueSecurityLevelScheme for the given ID.

getEntitiesBySecurityLevel

public List<org.ofbiz.core.entity.GenericValue> getEntitiesBySecurityLevel(Long securityLevelId)
Description copied from interface: IssueSecuritySchemeManager
Returns the configured permissions for the given Security Level.

Specified by:
getEntitiesBySecurityLevel in interface IssueSecuritySchemeManager
Parameters:
securityLevelId - the Security Level
Returns:
the configured permissions for the given Security Level.

getPermissionsBySecurityLevel

public List<IssueSecurityLevelPermission> getPermissionsBySecurityLevel(Long securityLevelId)
Description copied from interface: IssueSecuritySchemeManager
Returns the configured permissions for the given Security Level.

Specified by:
getPermissionsBySecurityLevel in interface IssueSecuritySchemeManager
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 interface IssueSecuritySchemeManager
Parameters:
type - is the entity type
parameter - is the scheme entries parameter value
Returns:
Collection of GenericValues that represents a scheme

setSchemeForProject

public void setSchemeForProject(Project project,
                                Long schemeId)
Description copied from interface: IssueSecuritySchemeManager
Set the issue security level scheme to be used by the given Project.

Specified by:
setSchemeForProject in interface IssueSecuritySchemeManager
Parameters:
project - The Project
schemeId - The desired new security level scheme to use - null indicates "no issue security levels".

getProjectsUsingScheme

public List<Project> getProjectsUsingScheme(long schemeId)
Description copied from interface: IssueSecuritySchemeManager
Returns all projects that use the given Issue Security Level Scheme.

Specified by:
getProjectsUsingScheme in interface IssueSecuritySchemeManager
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 interface SchemeManager
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:
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
Specified by:
getEntities in interface SchemeManager
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 interface SchemeManager
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:
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 interface SchemeManager
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 class AbstractSchemeManager
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 interface SchemeManager
Overrides:
copyScheme in class AbstractSchemeManager
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

protected AbstractSchemeCopiedEvent createSchemeCopiedEvent(@Nonnull
                                                            Scheme oldScheme,
                                                            @Nonnull
                                                            Scheme newScheme)
Specified by:
createSchemeCopiedEvent in class AbstractSchemeManager

hasSchemeAuthority

public boolean hasSchemeAuthority(Long entityType,
                                  org.ofbiz.core.entity.GenericValue entity)
Description copied from interface: SchemeManager
Checks anonymous permission of the given permission type for the given entity.

Specified by:
hasSchemeAuthority in interface SchemeManager
Parameters:
entityType - permission type.
entity - the entity to which permission is being checked.
Returns:
true only if the anonymous user is permitted.

hasSchemeAuthority

public boolean hasSchemeAuthority(Long entityType,
                                  org.ofbiz.core.entity.GenericValue issue,
                                  com.atlassian.crowd.embedded.api.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

Specified by:
hasSchemeAuthority in interface SchemeManager
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

createSchemeUpdatedEvent

protected AbstractSchemeUpdatedEvent createSchemeUpdatedEvent(Scheme scheme,
                                                              Scheme originalScheme)
Specified by:
createSchemeUpdatedEvent in class AbstractSchemeManager

deleteScheme

public void deleteScheme(Long id)
                  throws org.ofbiz.core.entity.GenericEntityException
Deletes a scheme from the database

Specified by:
deleteScheme in interface SchemeManager
Overrides:
deleteScheme in class AbstractSchemeManager
Parameters:
id - Id of the scheme to be deleted
Throws:
org.ofbiz.core.entity.GenericEntityException

deleteEntity

public void deleteEntity(Long id)
                  throws DataAccessException
Description copied from interface: SchemeManager
Deletes an entity with the given id from the database.

Specified by:
deleteEntity in interface SchemeManager
Overrides:
deleteEntity in class AbstractSchemeManager
Parameters:
id - The id of the entity to be deleted
Throws:
DataAccessException

makeSchemeEntity

protected SchemeEntity makeSchemeEntity(org.ofbiz.core.entity.GenericValue entity)
Specified by:
makeSchemeEntity in class AbstractSchemeManager

createSchemeEntityDeletedEvent

protected Object createSchemeEntityDeletedEvent(org.ofbiz.core.entity.GenericValue entity)
Specified by:
createSchemeEntityDeletedEvent in class AbstractSchemeManager

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 interface SchemeManager
Overrides:
removeEntities in class AbstractSchemeManager
Parameters:
scheme - to remove entites from must NOT be null
entityTypeId - 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 interface SchemeManager
Overrides:
createScheme in class AbstractSchemeManager
Parameters:
name - The name of the new scheme
description - The description of the new scheme
Returns:
The new scheme object
Throws:
org.ofbiz.core.entity.GenericEntityException - If a DB error occurs

createSchemeCreatedEvent

protected AbstractSchemeEvent createSchemeCreatedEvent(Scheme scheme)
Specified by:
createSchemeCreatedEvent in class AbstractSchemeManager

flushProjectSchemes

protected void flushProjectSchemes()
Overrides:
flushProjectSchemes in class AbstractSchemeManager

removeEntities

public boolean removeEntities(String type,
                              String parameter)
                       throws RemoveException
This method overrides the super implemntation in order to clear cache.

Specified by:
removeEntities in interface SchemeManager
Overrides:
removeEntities in class AbstractSchemeManager
Parameters:
type - type
parameter - parameter
Returns:
the original result of the call to super method
Throws:
RemoveException - if super method throws it

createSchemeAddedToProjectEvent

protected AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent(Scheme scheme,
                                                                            Project project)
Specified by:
createSchemeAddedToProjectEvent in class AbstractSchemeManager

createSchemeRemovedFromProjectEvent

protected AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Scheme scheme,
                                                                                    Project project)
Specified by:
createSchemeRemovedFromProjectEvent in class AbstractSchemeManager


Copyright © 2002-2014 Atlassian. All Rights Reserved.