public class

DefaultPermissionSchemeManager

extends AbstractSchemeManager
implements Startable PermissionSchemeManager
java.lang.Object
   ↳ com.atlassian.jira.scheme.AbstractSchemeManager
     ↳ com.atlassian.jira.permission.DefaultPermissionSchemeManager
Known Direct Subclasses

Class Overview

This class is used to handle Permission Schemes.

Permission Schemes are created, removed and edited through this class

Summary

[Expand]
Inherited Constants
From interface com.atlassian.jira.scheme.SchemeManager
[Expand]
Inherited Fields
From class com.atlassian.jira.scheme.AbstractSchemeManager
Public Constructors
DefaultPermissionSchemeManager(ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, OfBizDelegator delegator, SchemeFactory schemeFactory, NodeAssociationStore nodeAssociationStore, GroupManager groupManager, EventPublisher eventPublisher, CacheManager cacheManager)
Public Methods
GenericValue createSchemeEntity(GenericValue scheme, SchemeEntity schemeEntity)
Create a new permission record in the database
void deleteEntity(Long id)
Deletes a permission from the database
void deleteScheme(Long id)
Deletes a scheme from the database
void flushSchemeEntities()
String getDefaultDescriptionKey()
String getDefaultNameKey()
List<GenericValue> getEntities(GenericValue scheme, ProjectPermissionKey permissionKey, String type, String parameter)
Get all Generic Value permission records for a particular scheme and permission Id
List<GenericValue> getEntities(GenericValue scheme)
Get all Scheme entity records for a particular scheme
List<GenericValue> getEntities(GenericValue scheme, String permissionKey)
List<GenericValue> getEntities(GenericValue scheme, Long permissionId, String type, String parameter)
Get all Generic Value permission records for a particular scheme and permission Id
List<GenericValue> getEntities(GenericValue scheme, Long permissionId, String parameter)
Get all Generic Value permission records for a particular scheme and permission Id
List<GenericValue> getEntities(GenericValue scheme, ProjectPermissionKey permissionKey)
List<GenericValue> getEntities(GenericValue scheme, String type, Long permissionId)
Get all Generic Value permission records for a particular scheme and permission Id
List<GenericValue> getEntities(GenericValue scheme, ProjectPermissionKey permissionKey, String parameter)
List<GenericValue> getEntities(GenericValue scheme, Long permissionId)
Get all Generic Value permission records for a particular scheme and permission Id
List<GenericValue> getEntitiesByType(GenericValue scheme, ProjectPermissionKey permissionKey, String type)
String getEntityName()
Collection<Group> getGroups(Long entityTypeId, Project project)
Collection<Group> getGroups(Long entityTypeId, GenericValue project)
Collection<Group> getGroups(ProjectPermissionKey permissionKey, Project project)
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.
Collection<User> getUsers(ProjectPermissionKey permissionKey, PermissionContext ctx)
boolean hasSchemeAuthority(Long permissionId, GenericValue project, User user, boolean issueCreation)
Checks to see if the user has any specific permissions for that permission type.
boolean hasSchemeAuthority(ProjectPermissionKey permissionKey, GenericValue project)
Checks to see if there is an anyone permission for that permission type.
boolean hasSchemeAuthority(Long permissionId, GenericValue project)
Checks to see if there is an anyone permission for that permission type.
boolean hasSchemeAuthority(ProjectPermissionKey permissionKey, GenericValue project, User user, boolean issueCreation)
Checks the given user's permission of the given permission type for the given entity.
void onClearCache(ClearCacheEvent event)
boolean removeEntities(GenericValue scheme, Long permissionId)
Retrieves all the entites for this permission and then removes them.
boolean removeEntities(String type, String parameter)
Removes all scheme entities with this parameter
void start()
Registers this CachingFieldConfigContextPersister's cache in the JIRA instrumentation.
Protected Methods
AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent(Scheme scheme, Project project)
@Nonnull AbstractSchemeCopiedEvent createSchemeCopiedEvent(Scheme oldScheme, Scheme newScheme)
AbstractSchemeEvent createSchemeCreatedEvent(Scheme scheme)
AbstractSchemeEntityEvent createSchemeEntityDeletedEvent(GenericValue entity)
GenericValue createSchemeEntityNoEvent(GenericValue scheme, SchemeEntity schemeEntity)
AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Scheme scheme, Project project)
AbstractSchemeUpdatedEvent createSchemeUpdatedEvent(Scheme scheme, Scheme originalScheme)
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.permission.PermissionSchemeManager
From interface com.atlassian.jira.scheme.SchemeManager

Public Constructors

public DefaultPermissionSchemeManager (ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, OfBizDelegator delegator, SchemeFactory schemeFactory, NodeAssociationStore nodeAssociationStore, GroupManager groupManager, EventPublisher eventPublisher, CacheManager cacheManager)

Public Methods

public GenericValue createSchemeEntity (GenericValue scheme, SchemeEntity schemeEntity)

Create a new permission record in the database

Parameters
scheme The scheme that the permission record is associated with
schemeEntity The scheme entity object that is to be added to the scheme
Returns
  • The permission object
Throws
GenericEntityException

public void deleteEntity (Long id)

Deletes a permission from the database

Parameters
id The id of the permission 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 void flushSchemeEntities ()

public String getDefaultDescriptionKey ()

public String getDefaultNameKey ()

public List<GenericValue> getEntities (GenericValue scheme, ProjectPermissionKey permissionKey, String type, String parameter)

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

Parameters
scheme The scheme that the permissions belong to
permissionKey The key of the permission
type The type of the permission(Group, Current Reporter etc)
parameter The permission parameter (group name etc)
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
Throws
GenericEntityException

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

Throws
GenericEntityException

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

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

Parameters
scheme The scheme that the permissions belong to
permissionId The Id of the permission
type The type of the permission(Group, Current Reporter etc)
parameter The permission parameter (group name etc)
Returns
  • List of (GenericValue) permissions
Throws
GenericEntityException

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

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

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

public List<GenericValue> getEntities (GenericValue scheme, ProjectPermissionKey permissionKey)

Throws
GenericEntityException

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

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

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

public List<GenericValue> getEntities (GenericValue scheme, ProjectPermissionKey permissionKey, String parameter)

Throws
GenericEntityException

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

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

Parameters
scheme The scheme that the permissions belong to
permissionId The Id of the permission
Returns
  • List of (GenericValue) permissions
Throws
GenericEntityException

public List<GenericValue> getEntitiesByType (GenericValue scheme, ProjectPermissionKey permissionKey, String type)

Throws
GenericEntityException

public String getEntityName ()

public Collection<Group> getGroups (Long entityTypeId, Project project)

public Collection<Group> getGroups (Long entityTypeId, GenericValue project)

public Collection<Group> getGroups (ProjectPermissionKey permissionKey, Project project)

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 Collection<User> getUsers (ProjectPermissionKey permissionKey, PermissionContext ctx)

public boolean hasSchemeAuthority (Long permissionId, GenericValue project, User user, boolean issueCreation)

Checks to see if the user has any specific permissions for that permission type. Specific permissions can things such as Current Reporter, Project Lead, Single User etc.

Parameters
permissionId The permission to check against, must not be global permission
project The entity to check for the permission. This entity must be a project
user The user to check for the permission. The user must NOT be null
issueCreation true if this call is for a "Create Issue" permission.
Returns
  • true if the user has the permission otherwise false

public boolean hasSchemeAuthority (ProjectPermissionKey permissionKey, GenericValue project)

Checks to see if there is an anyone permission for that permission type. Specific permissions can things such as Current Reporter, Project Lead, Single User etc.

Parameters
permissionKey The permission to check against, must not be global permission
project The entity to check for the permission. This entity must be a project
Returns
  • true if the user has the permission otherwise false

public boolean hasSchemeAuthority (Long permissionId, GenericValue project)

Checks to see if there is an anyone permission for that permission type. Specific permissions can things such as Current Reporter, Project Lead, Single User etc.

Parameters
permissionId The permission to check against, must not be global permission
project The entity to check for the permission. This entity must be a project
Returns
  • true if the user has the permission otherwise false

public boolean hasSchemeAuthority (ProjectPermissionKey permissionKey, GenericValue project, User user, boolean issueCreation)

Checks the given user's permission of the given permission type for the given entity.

Parameters
permissionKey permission key.
project the entity to which permission is being checked.
user the user.
issueCreation whether the permission is for creating an issue.
Returns
  • true only if the user is permitted.

public void onClearCache (ClearCacheEvent event)

public boolean removeEntities (GenericValue scheme, Long permissionId)

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

Parameters
scheme to remove entites from must NOT be null
permissionId to remove must NOT be a global permission
Returns
  • True is all the entities are removed

public boolean removeEntities (String type, String parameter)

Removes all scheme entities with this parameter

Parameters
type the type of scheme entity you wish to remove 'user', 'group', 'projectrole'
parameter must NOT be null
Returns
  • true always (legacy)

public void start ()

Registers this CachingFieldConfigContextPersister's cache in the JIRA instrumentation.

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 AbstractSchemeEntityEvent 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 SchemeEntity makeSchemeEntity (GenericValue entity)