com.atlassian.jira.permission
Class DefaultPermissionSchemeManager

java.lang.Object
  extended by com.atlassian.jira.scheme.AbstractSchemeManager
      extended by com.atlassian.jira.permission.DefaultPermissionSchemeManager
All Implemented Interfaces:
PermissionSchemeManager, SchemeManager
Direct Known Subclasses:
WorkflowBasedPermissionSchemeManager

public class DefaultPermissionSchemeManager
extends AbstractSchemeManager
implements PermissionSchemeManager

This class is used to handle Permission Schemes.

Permission Schemes are created, removed and edited through this class


Field Summary
 
Fields inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
projectManager
 
Fields inherited from interface com.atlassian.jira.scheme.SchemeManager
PROJECT_ASSOCIATION
 
Constructor Summary
DefaultPermissionSchemeManager(ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, OfBizDelegator delegator, SchemeFactory schemeFactory)
           
 
Method Summary
 org.ofbiz.core.entity.GenericValue copySchemeEntity(org.ofbiz.core.entity.GenericValue scheme, org.ofbiz.core.entity.GenericValue entity)
           
 org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity)
          Create a new permission record in the database
 void deleteEntity(java.lang.Long id)
          Deletes a permission from the database
 void flushSchemeEntities()
           
 java.lang.String getAssociationType()
           
 java.lang.String getDefaultDescriptionKey()
           
 java.lang.String getDefaultNameKey()
           
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme)
          Get all Scheme entity records for a particular scheme
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.Long permissionId)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.Long permissionId, java.lang.String parameter)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.Long permissionId, java.lang.String type, java.lang.String parameter)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.String entityTypeId)
           
 java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.String type, java.lang.Long permissionId)
          Get all Generic Value permission records for a particular scheme and permission Id
 java.lang.String getEntityName()
           
 java.util.Collection<com.opensymphony.user.Group> getGroups(java.lang.Long entityTypeId, org.ofbiz.core.entity.GenericValue project)
           
 java.lang.String getSchemeDesc()
           
 java.lang.String getSchemeEntityName()
           
 java.util.Collection<org.ofbiz.core.entity.GenericValue> getSchemesContainingEntity(java.lang.String type, java.lang.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.
 java.util.Collection<com.opensymphony.user.User> getUsers(java.lang.Long permissionId, org.ofbiz.core.entity.GenericValue projectOrIssue)
           
 boolean hasSchemeAuthority(java.lang.Long permissionId, org.ofbiz.core.entity.GenericValue project)
          Checks to see if there is an anyone permission for that permission type.
 boolean hasSchemeAuthority(java.lang.Long permissionId, org.ofbiz.core.entity.GenericValue project, com.opensymphony.user.User user, boolean issueCreation)
          Checks to see if the user has any specific permissions for that permission type.
 void onClearCache(ClearCacheEvent event)
           
 boolean removeEntities(org.ofbiz.core.entity.GenericValue scheme, java.lang.Long permissionId)
          Retrieves all the entites for this permission and then removes them.
 boolean removeEntities(java.lang.String type, java.lang.String parameter)
          Removes all scheme entities with this parameter
 
Methods inherited from class com.atlassian.jira.scheme.AbstractSchemeManager
addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createScheme, createSchemeAndEntities, createSchemeGenericValue, deleteScheme, flushProjectSchemes, getAssociatedSchemes, getDefaultScheme, getEntities, getEntity, getProjectAndValidate, getProjects, getProjects, getScheme, getScheme, getSchemes, getSchemes, getUnassociatedSchemes, 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.scheme.SchemeManager
addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, createDefaultScheme, createScheme, createSchemeAndEntities, deleteScheme, getAssociatedSchemes, getDefaultScheme, getEntities, getEntity, getProjects, getProjects, getScheme, getScheme, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme, updateScheme
 

Constructor Detail

DefaultPermissionSchemeManager

public DefaultPermissionSchemeManager(ProjectManager projectManager,
                                      PermissionTypeManager permissionTypeManager,
                                      PermissionContextFactory permissionContextFactory,
                                      OfBizDelegator delegator,
                                      SchemeFactory schemeFactory)
Method Detail

onClearCache

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

getSchemeEntityName

public java.lang.String getSchemeEntityName()
Specified by:
getSchemeEntityName in interface PermissionSchemeManager
Specified by:
getSchemeEntityName in class AbstractSchemeManager

getEntityName

public java.lang.String getEntityName()
Specified by:
getEntityName in interface PermissionSchemeManager
Specified by:
getEntityName in class AbstractSchemeManager

getAssociationType

public java.lang.String getAssociationType()
Specified by:
getAssociationType in interface PermissionSchemeManager
Specified by:
getAssociationType in class AbstractSchemeManager

getSchemeDesc

public java.lang.String getSchemeDesc()
Specified by:
getSchemeDesc in interface PermissionSchemeManager
Specified by:
getSchemeDesc in class AbstractSchemeManager

getDefaultNameKey

public java.lang.String getDefaultNameKey()
Specified by:
getDefaultNameKey in class AbstractSchemeManager

getDefaultDescriptionKey

public java.lang.String getDefaultDescriptionKey()
Specified by:
getDefaultDescriptionKey in class AbstractSchemeManager

getEntities

public java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.Long permissionId)
                                                               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
permissionId - The Id of the permission
Returns:
List of (GenericValue) permissions
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.Long permissionId,
                                                                      java.lang.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
permissionId - The Id of the permission
parameter - The permission parameter (group name etc)
Returns:
List of (GenericValue) permissions
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.Long permissionId,
                                                                      java.lang.String type,
                                                                      java.lang.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 PermissionSchemeManager
Parameters:
scheme - The scheme that the permissions belong to
permissionId - The Id of the permission
parameter - The permission parameter (group name etc)
type - The type of the permission(Group, Current Reporter etc)
Returns:
List of (GenericValue) permissions
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.String type,
                                                                      java.lang.Long permissionId)
                                                               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
type - The type of the permission(Group, Current Reporter etc)
permissionId - The Id of the permission
Returns:
List of (GenericValue) permissions
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme,
                                                                      java.lang.String entityTypeId)
                                                               throws org.ofbiz.core.entity.GenericEntityException
Specified by:
getEntities in interface SchemeManager
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
Create a new permission record in the database

Specified by:
createSchemeEntity in interface SchemeManager
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:
org.ofbiz.core.entity.GenericEntityException

deleteEntity

public void deleteEntity(java.lang.Long id)
                  throws org.ofbiz.core.entity.GenericEntityException
Deletes a permission from the database

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

copySchemeEntity

public org.ofbiz.core.entity.GenericValue copySchemeEntity(org.ofbiz.core.entity.GenericValue scheme,
                                                           org.ofbiz.core.entity.GenericValue entity)
                                                    throws org.ofbiz.core.entity.GenericEntityException
Specified by:
copySchemeEntity in class AbstractSchemeManager
Throws:
org.ofbiz.core.entity.GenericEntityException

getEntities

public java.util.List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme)
                                                               throws org.ofbiz.core.entity.GenericEntityException
Description copied from class: AbstractSchemeManager
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
Throws:
org.ofbiz.core.entity.GenericEntityException

removeEntities

public boolean removeEntities(java.lang.String type,
                              java.lang.String parameter)
                       throws RemoveException
Removes all scheme entities with this parameter

Specified by:
removeEntities in interface SchemeManager
Overrides:
removeEntities in class AbstractSchemeManager
Parameters:
type - the type of scheme entity you wish to remove 'user', 'group', 'projectrole'
parameter - must NOT be null
Throws:
RemoveException

removeEntities

public boolean removeEntities(org.ofbiz.core.entity.GenericValue scheme,
                              java.lang.Long permissionId)
                       throws RemoveException
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
permissionId - to remove must NOT be a global permission
Returns:
True is all the entities are removed
Throws:
RemoveException

hasSchemeAuthority

public boolean hasSchemeAuthority(java.lang.Long permissionId,
                                  org.ofbiz.core.entity.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.

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

hasSchemeAuthority

public boolean hasSchemeAuthority(java.lang.Long permissionId,
                                  org.ofbiz.core.entity.GenericValue project,
                                  com.opensymphony.user.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.

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

getGroups

public java.util.Collection<com.opensymphony.user.Group> getGroups(java.lang.Long entityTypeId,
                                                                   org.ofbiz.core.entity.GenericValue project)
Specified by:
getGroups in interface SchemeManager
Overrides:
getGroups in class AbstractSchemeManager

getUsers

public java.util.Collection<com.opensymphony.user.User> getUsers(java.lang.Long permissionId,
                                                                 org.ofbiz.core.entity.GenericValue projectOrIssue)
Specified by:
getUsers in interface SchemeManager
Overrides:
getUsers in class AbstractSchemeManager

flushSchemeEntities

public void flushSchemeEntities()
Specified by:
flushSchemeEntities in interface PermissionSchemeManager

getSchemesContainingEntity

public java.util.Collection<org.ofbiz.core.entity.GenericValue> getSchemesContainingEntity(java.lang.String type,
                                                                                           java.lang.String parameter)
Description copied from interface: PermissionSchemeManager
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 PermissionSchemeManager
Parameters:
type - is the entity type
parameter - is the scheme entries parameter value
Returns:
Collection of GenericValues that represents a scheme


Copyright © 2002-2010 Atlassian. All Rights Reserved.