public class DefaultPermissionSchemeManager extends AbstractSchemeManager implements PermissionSchemeManager, Startable, GroupConfigurable
Permission Schemes are created, removed and edited through this class
eventPublisher, groupManager, projectManager, schemeFactory, securityTypeManager
PROJECT_ASSOCIATION
Constructor and Description |
---|
DefaultPermissionSchemeManager(ProjectManager projectManager,
PermissionTypeManager permissionTypeManager,
PermissionContextFactory permissionContextFactory,
OfBizDelegator delegator,
SchemeFactory schemeFactory,
NodeAssociationStore nodeAssociationStore,
GroupManager groupManager,
com.atlassian.event.api.EventPublisher eventPublisher,
com.atlassian.cache.CacheManager cacheManager,
PermissionSchemeAttributeManager permissionSchemeAttributeManager) |
Modifier and Type | Method and Description |
---|---|
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)
Create a new permission record in the database
|
protected AbstractSchemeEntityEvent |
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 a permission from the database
|
void |
deleteScheme(Long id)
Deletes a scheme from the database
|
void |
flushSchemeEntities() |
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 permissionId)
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,
Long permissionId,
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,
Long permissionId,
String type,
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,
ProjectPermissionKey permissionKey) |
List<org.ofbiz.core.entity.GenericValue> |
getEntities(org.ofbiz.core.entity.GenericValue scheme,
ProjectPermissionKey permissionKey,
String parameter) |
List<org.ofbiz.core.entity.GenericValue> |
getEntities(org.ofbiz.core.entity.GenericValue scheme,
ProjectPermissionKey permissionKey,
String type,
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 permissionKey)
Inherited from SchemeManager.
|
List<org.ofbiz.core.entity.GenericValue> |
getEntities(org.ofbiz.core.entity.GenericValue scheme,
String type,
Long permissionId)
Get all Generic Value permission records for a particular scheme and permission Id
|
List<org.ofbiz.core.entity.GenericValue> |
getEntitiesByType(org.ofbiz.core.entity.GenericValue scheme,
ProjectPermissionKey permissionKey,
String type) |
String |
getEntityName() |
Collection<com.atlassian.crowd.embedded.api.Group> |
getGroups(Long entityTypeId,
org.ofbiz.core.entity.GenericValue project) |
Collection<com.atlassian.crowd.embedded.api.Group> |
getGroups(Long entityTypeId,
Project project) |
Collection<com.atlassian.crowd.embedded.api.Group> |
getGroups(ProjectPermissionKey permissionKey,
Project project) |
Collection<PermissionSchemeEntry> |
getPermissionSchemeEntries(long schemeId,
ProjectPermissionKey permissionKey)
Returns the PermissionSchemeEntries for the given Permission Scheme and ProjectPermissionKey.
|
Collection<PermissionSchemeEntry> |
getPermissionSchemeEntries(long schemeId,
ProjectPermissionKey permissionKey,
String type)
Returns the PermissionSchemeEntries for the given Permission Scheme and ProjectPermissionKey.
|
Collection<PermissionSchemeEntry> |
getPermissionSchemeEntries(Scheme scheme,
ProjectPermissionKey permissionKey)
Returns the PermissionSchemeEntries for the given Permission Scheme and ProjectPermissionKey.
|
String |
getSchemeDesc() |
String |
getSchemeEntityName() |
Scheme |
getSchemeFor(Project project)
Get the scheme of this type attached to the given project.
|
Long |
getSchemeIdFor(Project project)
Get the scheme of this type attached to the given project.
|
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.
|
Collection<ApplicationUser> |
getUsers(ProjectPermissionKey permissionKey,
PermissionContext ctx) |
boolean |
hasExtendedProjectAdministration(Project project)
Checks if scheme for project has
com.atlassian.jira.permission.PermissionSchemeAttributeManager.AttributeKeys#EXTENDED_ADMINISTER_PROJECTS_ENABLED_ATTRIBUTE enabled. |
ProjectWidePermission |
hasProjectWidePermission(ProjectPermissionKey permissionKey,
Project project,
ApplicationUser user,
boolean issueCreation) |
boolean |
hasSchemePermission(ProjectPermissionKey permissionKey,
Issue issue)
Checks anonymous permission of the given permission type for the given issue.
|
boolean |
hasSchemePermission(ProjectPermissionKey permissionKey,
Issue issue,
ApplicationUser user,
boolean issueCreation)
Checks the given user's permission of the given permission type for the given issue.
|
boolean |
hasSchemePermission(ProjectPermissionKey permissionKey,
Project project)
Checks anonymous permission of the given permission type for the given project.
|
boolean |
hasSchemePermission(ProjectPermissionKey permissionKey,
Project project,
ApplicationUser user,
boolean issueCreation)
Checks the given user's permission of the given permission type for the given project.
|
boolean |
isGroupUsed(com.atlassian.crowd.embedded.api.Group group)
Determine whether configuration exists for the specified
Group . |
protected SchemeEntity |
makeSchemeEntity(org.ofbiz.core.entity.GenericValue entity) |
void |
onClearCache(ClearCacheEvent event) |
boolean |
removeEntities(org.ofbiz.core.entity.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.
|
void |
swapParameterForEntitiesOfType(String type,
String parameter,
String resultingParameter)
Swaps all parameters of entities with the given type scheme to the given resulting parameter
|
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createScheme, createSchemeAndEntities, createSchemeGenericValue, createSchemeNoEvent, createSchemeObject, flushProjectSchemes, getApplicationI18n, getAssociatedSchemes, getAssociationType, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntitiesByIds, getEntity, getNameForCopy, getProjects, getScheme, getScheme, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme, updateScheme
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAssociationType, getUsers
addDefaultSchemeToProject, addDefaultSchemeToProject, addSchemeToProject, addSchemeToProject, copyScheme, copyScheme, createDefaultScheme, createScheme, createSchemeAndEntities, createSchemeObject, getAssociatedSchemes, getDefaultScheme, getDefaultSchemeObject, getEntities, getEntitiesByIds, getEntity, getProjects, getScheme, getScheme, getSchemeObject, getSchemeObject, getSchemeObjects, getSchemes, getSchemes, getUnassociatedSchemes, getUsers, getUsers, getUsers, removeSchemesFromProject, removeSchemesFromProject, schemeExists, updateScheme, updateScheme
isGroupUsed
public DefaultPermissionSchemeManager(ProjectManager projectManager, PermissionTypeManager permissionTypeManager, PermissionContextFactory permissionContextFactory, OfBizDelegator delegator, SchemeFactory schemeFactory, NodeAssociationStore nodeAssociationStore, GroupManager groupManager, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.cache.CacheManager cacheManager, PermissionSchemeAttributeManager permissionSchemeAttributeManager)
public void start() throws Exception
public void onClearCache(ClearCacheEvent event)
onClearCache
in class AbstractSchemeManager
public String getSchemeEntityName()
getSchemeEntityName
in interface PermissionSchemeManager
getSchemeEntityName
in class AbstractSchemeManager
public String getEntityName()
getEntityName
in interface PermissionSchemeManager
getEntityName
in class AbstractSchemeManager
public String getSchemeDesc()
getSchemeDesc
in interface PermissionSchemeManager
getSchemeDesc
in class AbstractSchemeManager
public String getDefaultNameKey()
getDefaultNameKey
in class AbstractSchemeManager
public String getDefaultDescriptionKey()
getDefaultDescriptionKey
in class AbstractSchemeManager
protected AbstractSchemeEvent createSchemeCreatedEvent(Scheme scheme)
createSchemeCreatedEvent
in class AbstractSchemeManager
@Nonnull protected AbstractSchemeCopiedEvent createSchemeCopiedEvent(@Nonnull Scheme oldScheme, @Nonnull Scheme newScheme)
createSchemeCopiedEvent
in class AbstractSchemeManager
protected AbstractSchemeUpdatedEvent createSchemeUpdatedEvent(Scheme scheme, Scheme originalScheme)
createSchemeUpdatedEvent
in class AbstractSchemeManager
public void deleteScheme(Long id) throws org.ofbiz.core.entity.GenericEntityException
SchemeManager
deleteScheme
in interface SchemeManager
deleteScheme
in class AbstractSchemeManager
id
- Id of the scheme to be deletedorg.ofbiz.core.entity.GenericEntityException
- If a DB error occurs@Nonnull protected AbstractSchemeAddedToProjectEvent createSchemeAddedToProjectEvent(Scheme scheme, Project project)
createSchemeAddedToProjectEvent
in class AbstractSchemeManager
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long permissionId) throws org.ofbiz.core.entity.GenericEntityException
getEntities
in interface PermissionSchemeManager
getEntities
in interface SchemeManager
scheme
- The scheme that the permissions belong topermissionId
- The Id of the permissionorg.ofbiz.core.entity.GenericEntityException
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long permissionId, String parameter) throws org.ofbiz.core.entity.GenericEntityException
getEntities
in interface PermissionSchemeManager
getEntities
in interface SchemeManager
scheme
- The scheme that the permissions belong topermissionId
- The Id of the permissionparameter
- The permission parameter (group name etc)org.ofbiz.core.entity.GenericEntityException
public List<org.ofbiz.core.entity.GenericValue> getEntities(@Nonnull org.ofbiz.core.entity.GenericValue scheme, @Nonnull ProjectPermissionKey permissionKey, @Nonnull String parameter) throws org.ofbiz.core.entity.GenericEntityException
getEntities
in interface PermissionSchemeManager
org.ofbiz.core.entity.GenericEntityException
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long permissionId, String type, String parameter) throws org.ofbiz.core.entity.GenericEntityException
getEntities
in interface PermissionSchemeManager
scheme
- The scheme that the permissions belong topermissionId
- The Id of the permissionparameter
- The permission parameter (group name etc)type
- The type of the permission(Group, Current Reporter etc)org.ofbiz.core.entity.GenericEntityException
public List<org.ofbiz.core.entity.GenericValue> getEntities(@Nonnull org.ofbiz.core.entity.GenericValue scheme, @Nonnull ProjectPermissionKey permissionKey, @Nonnull String type, @Nonnull String parameter) throws org.ofbiz.core.entity.GenericEntityException
PermissionSchemeManager
getEntities
in interface PermissionSchemeManager
scheme
- The scheme that the permissions belong topermissionKey
- The key of the permissiontype
- The type of the permission(Group, Current Reporter etc)parameter
- The permission parameter (group name etc)org.ofbiz.core.entity.GenericEntityException
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String type, Long permissionId) throws org.ofbiz.core.entity.GenericEntityException
getEntities
in interface PermissionSchemeManager
getEntities
in interface SchemeManager
scheme
- The scheme that the permissions belong totype
- The type of the permission(Group, Current Reporter etc)permissionId
- The Id of the permissionorg.ofbiz.core.entity.GenericEntityException
public List<org.ofbiz.core.entity.GenericValue> getEntitiesByType(@Nonnull org.ofbiz.core.entity.GenericValue scheme, @Nonnull ProjectPermissionKey permissionKey, @Nonnull String type) throws org.ofbiz.core.entity.GenericEntityException
getEntitiesByType
in interface PermissionSchemeManager
org.ofbiz.core.entity.GenericEntityException
public List<org.ofbiz.core.entity.GenericValue> getEntities(@Nonnull org.ofbiz.core.entity.GenericValue scheme, @Nonnull ProjectPermissionKey permissionKey) throws org.ofbiz.core.entity.GenericEntityException
getEntities
in interface PermissionSchemeManager
org.ofbiz.core.entity.GenericEntityException
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String permissionKey) throws org.ofbiz.core.entity.GenericEntityException
PermissionSchemeManager
getEntities
in interface PermissionSchemeManager
getEntities
in interface SchemeManager
org.ofbiz.core.entity.GenericEntityException
public Collection<PermissionSchemeEntry> getPermissionSchemeEntries(@Nonnull Scheme scheme, @Nonnull ProjectPermissionKey permissionKey)
PermissionSchemeManager
getPermissionSchemeEntries
in interface PermissionSchemeManager
scheme
- The permission schemepermissionKey
- The permission typePermissionSchemeManager.getPermissionSchemeEntries(long, ProjectPermissionKey)
public Collection<PermissionSchemeEntry> getPermissionSchemeEntries(long schemeId, @Nonnull ProjectPermissionKey permissionKey)
PermissionSchemeManager
getPermissionSchemeEntries
in interface PermissionSchemeManager
schemeId
- The permission schemepermissionKey
- The permission typePermissionSchemeManager.getPermissionSchemeEntries(Scheme, ProjectPermissionKey)
public Collection<PermissionSchemeEntry> getPermissionSchemeEntries(long schemeId, @Nonnull ProjectPermissionKey permissionKey, @Nonnull String type)
PermissionSchemeManager
getPermissionSchemeEntries
in interface PermissionSchemeManager
schemeId
- The permission schemepermissionKey
- The permission typePermissionSchemeManager.getPermissionSchemeEntries(long, ProjectPermissionKey)
public org.ofbiz.core.entity.GenericValue createSchemeEntity(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) throws org.ofbiz.core.entity.GenericEntityException
createSchemeEntity
in interface SchemeManager
scheme
- The scheme that the permission record is associated withschemeEntity
- The scheme entity object that is to be added to the schemeorg.ofbiz.core.entity.GenericEntityException
protected org.ofbiz.core.entity.GenericValue createSchemeEntityNoEvent(org.ofbiz.core.entity.GenericValue scheme, SchemeEntity schemeEntity) throws org.ofbiz.core.entity.GenericEntityException
createSchemeEntityNoEvent
in class AbstractSchemeManager
org.ofbiz.core.entity.GenericEntityException
public void deleteEntity(Long id) throws DataAccessException
deleteEntity
in interface SchemeManager
deleteEntity
in class AbstractSchemeManager
id
- The id of the permission to be deletedDataAccessException
public void deleteEntities(Iterable<Long> ids)
SchemeManager
deleteEntities
in interface SchemeManager
deleteEntities
in class AbstractSchemeManager
ids
- a collection entity ids to be deleted.protected AbstractSchemeEntityEvent createSchemeEntityDeletedEvent(org.ofbiz.core.entity.GenericValue entity)
createSchemeEntityDeletedEvent
in class AbstractSchemeManager
protected SchemeEntity makeSchemeEntity(org.ofbiz.core.entity.GenericValue entity)
makeSchemeEntity
in class AbstractSchemeManager
public List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException
SchemeManager
getEntities
in interface PermissionSchemeManager
getEntities
in interface SchemeManager
getEntities
in class AbstractSchemeManager
scheme
- The scheme that the entities belong toorg.ofbiz.core.entity.GenericEntityException
- If a DB error occurspublic boolean removeEntities(String type, String parameter) throws RemoveException
removeEntities
in interface SchemeManager
removeEntities
in class AbstractSchemeManager
type
- the type of scheme entity you wish to remove 'user', 'group', 'projectrole'parameter
- must NOT be nullRemoveException
- if the delete fails (DB error)public boolean removeEntities(org.ofbiz.core.entity.GenericValue scheme, Long permissionId) throws RemoveException
removeEntities
in interface SchemeManager
removeEntities
in class AbstractSchemeManager
scheme
- to remove entites from must NOT be nullpermissionId
- to remove must NOT be a global permissionRemoveException
public boolean hasSchemePermission(@Nonnull ProjectPermissionKey permissionKey, @Nonnull Project project)
PermissionSchemeManager
hasSchemePermission
in interface PermissionSchemeManager
permissionKey
- permission key.project
- the project to which permission is being checked.public boolean hasSchemePermission(@Nonnull ProjectPermissionKey permissionKey, @Nonnull Issue issue)
PermissionSchemeManager
hasSchemePermission
in interface PermissionSchemeManager
permissionKey
- permission key.issue
- the issue to which permission is being checked.public boolean hasSchemePermission(@Nonnull ProjectPermissionKey permissionKey, @Nonnull Project project, @Nullable ApplicationUser user, boolean issueCreation)
PermissionSchemeManager
hasSchemePermission
in interface PermissionSchemeManager
permissionKey
- permission key.project
- the project to which permission is being checked.user
- the user.issueCreation
- whether the permission is for creating an issue.public ProjectWidePermission hasProjectWidePermission(@Nonnull ProjectPermissionKey permissionKey, @Nonnull Project project, @Nonnull ApplicationUser user, boolean issueCreation)
hasProjectWidePermission
in interface PermissionSchemeManager
public boolean hasSchemePermission(@Nonnull ProjectPermissionKey permissionKey, @Nonnull Issue issue, @Nullable ApplicationUser user, boolean issueCreation)
PermissionSchemeManager
hasSchemePermission
in interface PermissionSchemeManager
permissionKey
- permission key.issue
- the issue to check permission againstuser
- the user.issueCreation
- whether the permission is for creating an issue.@Nullable public Scheme getSchemeFor(Project project)
SchemeManager
getSchemeFor
in interface SchemeManager
getSchemeFor
in class AbstractSchemeManager
project
- The projectSchemeManager.getSchemeIdFor(Project)
@Nullable public Long getSchemeIdFor(Project project)
SchemeManager
getSchemeIdFor
in interface SchemeManager
getSchemeIdFor
in class AbstractSchemeManager
project
- The projectSchemeManager.getSchemeFor(Project)
public Collection<com.atlassian.crowd.embedded.api.Group> getGroups(Long entityTypeId, Project project)
getGroups
in interface PermissionSchemeManager
getGroups
in interface SchemeManager
getGroups
in class AbstractSchemeManager
public Collection<com.atlassian.crowd.embedded.api.Group> getGroups(@Nonnull ProjectPermissionKey permissionKey, @Nonnull Project project)
getGroups
in interface PermissionSchemeManager
public Collection<com.atlassian.crowd.embedded.api.Group> getGroups(Long entityTypeId, org.ofbiz.core.entity.GenericValue project)
getGroups
in interface SchemeManager
getGroups
in class AbstractSchemeManager
public Collection<ApplicationUser> getUsers(@Nonnull ProjectPermissionKey permissionKey, @Nonnull PermissionContext ctx)
getUsers
in interface PermissionSchemeManager
public boolean hasExtendedProjectAdministration(@Nullable Project project)
PermissionSchemeManager
com.atlassian.jira.permission.PermissionSchemeAttributeManager.AttributeKeys#EXTENDED_ADMINISTER_PROJECTS_ENABLED_ATTRIBUTE
enabled.hasExtendedProjectAdministration
in interface PermissionSchemeManager
com.atlassian.jira.permission.PermissionSchemeAttributeManager.AttributeKeys#EXTENDED_ADMINISTER_PROJECTS_ENABLED_ATTRIBUTE
enabled, false otherwise.@Nonnull protected AbstractSchemeRemovedFromProjectEvent createSchemeRemovedFromProjectEvent(Scheme scheme, Project project)
createSchemeRemovedFromProjectEvent
in class AbstractSchemeManager
public void flushSchemeEntities()
flushSchemeEntities
in interface PermissionSchemeManager
public Collection<org.ofbiz.core.entity.GenericValue> getSchemesContainingEntity(String type, String parameter)
PermissionSchemeManager
getSchemesContainingEntity
in interface PermissionSchemeManager
type
- is the entity typeparameter
- is the scheme entries parameter valuepublic void swapParameterForEntitiesOfType(String type, String parameter, String resultingParameter)
SchemeManager
swapParameterForEntitiesOfType
in interface SchemeManager
swapParameterForEntitiesOfType
in class AbstractSchemeManager
type
- the 'type' of entity you are swapping, eg 'group', 'user', 'projectrole'parameter
- must NOT be nullpublic boolean isGroupUsed(@Nonnull com.atlassian.crowd.embedded.api.Group group)
GroupConfigurable
Group
.isGroupUsed
in interface GroupConfigurable
group
- that may or may not exist.Copyright © 2002-2019 Atlassian. All Rights Reserved.