public interface StructureConfiguration
StructureConfiguration
provides access to the configuration parameters of the Structure plugin.
Typically, only JIRA administrators have write access to the plugin configuration, so before changing anything you should check if the user has enough privileges - no checking is done by this component.
This service also provides some utility methods that are based on the Structure configuration.
All methods in this component are thread-safe.
Modifier and Type | Method and Description |
---|---|
com.atlassian.jira.jql.builder.JqlClauseBuilder |
addConfigurationScopeClause(com.atlassian.jira.jql.builder.JqlClauseBuilder builder)
Adds to the JQL builder a condition that limits the result set to the projects enabled for Structure.
|
void |
clearUISettings(com.atlassian.jira.user.ApplicationUser user,
com.atlassian.jira.project.Project project)
Completely removes per-user or per-project settings.
|
List<PermissionSubject> |
getAutomationPermissionSubjects()
Used to get the list of groups (possibly other permission subjects) that are allowed to configure and control automation of controlled structures.
|
com.atlassian.query.Query |
getConfigurationScopeQuery()
Utility method that returns a JQL query that selects all issues in the projects that are available for Structure.
|
List<PermissionSubject> |
getCreatorPermissionSubjects()
Used to get the list of groups (possibly other permission subjects) that are allowed to create
new structures.
|
List<com.atlassian.jira.project.Project> |
getCurrentlyEnabledProjects() |
long |
getDefaultStructureId(com.atlassian.jira.project.Project project)
Returns the ID of the default structure for a given project.
|
List<PermissionSubject> |
getEnabledPermissionSubjects()
Used to get the list of groups (possibly other permission subjects) that the plugin is enabled for.
|
com.almworks.integers.LongList |
getPickedProjectIds()
This method returns a list of IDs of projects picked by the administrator for the Structure plugin.
|
List<com.atlassian.jira.project.Project> |
getPickedProjects()
This method returns a list of projects picked by the administrator for the Structure plugin.
|
List<PermissionSubject> |
getSynchronizationPermissionSubjects()
Used to get the list of groups (possibly other permission subjects) that are allowed to configure and control synchronizers of controlled structures.
|
UISettings |
getUISettings(com.atlassian.jira.user.ApplicationUser user,
com.atlassian.jira.project.Project project)
Retrieves user interface settings for the specified user and project.
|
boolean |
isAutomationAccessAllowed(com.atlassian.jira.user.ApplicationUser user)
Checks if the user is allowed to configure and use automation.
|
boolean |
isAutomationEnabledForAnyone() |
boolean |
isCreateEnabledForAnyone() |
boolean |
isDefaultStructureSetForProject(com.atlassian.jira.project.Project project)
Used to check whether a specific project has system-level default structure overridden with project-level default structure.
|
boolean |
isEnabledForAllProjects() |
boolean |
isEnabledForAnyone() |
boolean |
isProjectEnabled(com.atlassian.jira.project.Project project)
Checks if a given project is enabled for Structure
|
boolean |
isStructureAvailable(com.atlassian.jira.user.ApplicationUser user)
Checks if Structure plugin is available for the specified user.
|
boolean |
isStructureCreationAllowed(com.atlassian.jira.user.ApplicationUser user)
Checks if the user is allowed to create new structures.
|
boolean |
isSynchronizationAllowed(com.atlassian.jira.user.ApplicationUser user)
Checks if the user is allowed to configure and control synchronizers.
|
boolean |
isSynchronizationEnabledForAnyone() |
void |
setAutomationEnabledForAnyone(boolean enabled)
Changes whether the automation is available for all users.
|
void |
setAutomationPermissionSubjectsEncoded(String subjects)
Changes the list of the users / groups that are allowed to configure and control automation in controlled structures.
|
void |
setCreateEnabledForAnyone(boolean enabled)
Changes whether the creation of new structures is available for all users.
|
void |
setCreatorPermissionSubjectsEncoded(String subjects)
Changes the list of the users / groups that are allowed to create new structures.
|
void |
setDefaultStructureId(com.atlassian.jira.project.Project project,
Long structureId)
Changes the ID of the default structure for the specified project.
|
void |
setEnabledForAllProjects(boolean enabled)
Changes whether the plugin is enabled for all projects.
|
void |
setEnabledForAnyone(boolean enabled)
Changes whether the plugin is available for all users.
|
void |
setEnabledPermissionSubjectsEncoded(String subjects)
Changes the list of the users / groups that the Structure plugin is enabled for.
|
void |
setPickedProjectIds(String idList)
Changes projects that Structure plugin is enabled for.
|
void |
setSynchronizationEnabledForAnyone(boolean enabled)
Changes whether the synchronization is available for all users.
|
void |
setSynchronizationPermissionSubjectsEncoded(String subjects)
Changes the list of the users / groups that are allowed to configure and control synchronizers in controlled structures.
|
void |
setUISettings(com.atlassian.jira.user.ApplicationUser user,
com.atlassian.jira.project.Project project,
UISettings settings)
This method is used to update the user interface settings - either system-wide default
settings or per-user settings or per-project settings.
|
boolean isEnabledForAllProjects()
@NotNull com.almworks.integers.LongList getPickedProjectIds()
getCurrentlyEnabledProjects()
.@NotNull List<com.atlassian.jira.project.Project> getPickedProjects()
getCurrentlyEnabledProjects()
.@NotNull List<com.atlassian.jira.project.Project> getCurrentlyEnabledProjects()
boolean isProjectEnabled(@Nullable com.atlassian.jira.project.Project project)
project
- project to checkgetCurrentlyEnabledProjects()
boolean isEnabledForAnyone()
@NotNull List<PermissionSubject> getEnabledPermissionSubjects()
PermissionSubject.JiraGroup
,
Restricting User Access to Structureboolean isCreateEnabledForAnyone()
@NotNull List<PermissionSubject> getCreatorPermissionSubjects()
PermissionSubject.JiraGroup
,
Changing Permission to Create New Structuresboolean isSynchronizationEnabledForAnyone()
@NotNull List<PermissionSubject> getSynchronizationPermissionSubjects()
boolean isAutomationEnabledForAnyone()
@NotNull List<PermissionSubject> getAutomationPermissionSubjects()
void setEnabledForAllProjects(boolean enabled)
enabled
- if true, Structure plugin will be enabled for all projectsvoid setPickedProjectIds(@Nullable String idList)
isEnabledForAllProjects()
returns false.idList
- a comma-delimited list of project IDsvoid setEnabledForAnyone(boolean enabled)
enabled
- if true, Structure plugin will be available to all users that have access to at least one structure-enabled project.void setEnabledPermissionSubjectsEncoded(@Nullable String subjects)
subjects
- comma-delimited list of string-encoded permission subjectsPermissionSubject.toEncodedString()
,
Restricting User Access to Structurevoid setCreateEnabledForAnyone(boolean enabled)
enabled
- if true, anyone who has access to Structure can create new structures.void setCreatorPermissionSubjectsEncoded(@Nullable String subjects)
subjects
- comma-delimited list of string-encoded permission subjectsPermissionSubject.toEncodedString()
,
Changing Permission to Create New Structuresvoid setSynchronizationEnabledForAnyone(boolean enabled)
enabled
- if true, anyone who has control access to the structure can configure and control synchronizers.void setSynchronizationPermissionSubjectsEncoded(@Nullable String subjects)
subjects
- comma-delimited list of string-encoded permission subjectsvoid setAutomationEnabledForAnyone(boolean enabled)
enabled
- if true, anyone who has control access to the structure can configure and control automation.void setAutomationPermissionSubjectsEncoded(@Nullable String subjects)
subjects
- comma-delimited list of string-encoded permission subjects@NotNull com.atlassian.jira.jql.builder.JqlClauseBuilder addConfigurationScopeClause(@Nullable com.atlassian.jira.jql.builder.JqlClauseBuilder builder)
Adds to the JQL builder a condition that limits the result set to the projects enabled for Structure.
This method adds JQL constraint project IN (....)
in case Structure is allowed only for
specific projects and does nothing if Structure is allowed for all projects. The condition is added at the
current level in the clause builder.
builder
- a clause builder to be modified; if null, a new clause builder is created@Nullable com.atlassian.query.Query getConfigurationScopeQuery()
addConfigurationScopeClause(com.atlassian.jira.jql.builder.JqlClauseBuilder)
.boolean isStructureAvailable(@Nullable com.atlassian.jira.user.ApplicationUser user)
user
- the user, null means anonymousboolean isStructureCreationAllowed(@Nullable com.atlassian.jira.user.ApplicationUser user)
user
- the user, null means anonymousboolean isSynchronizationAllowed(@Nullable com.atlassian.jira.user.ApplicationUser user)
user
- the user, null means anonymousboolean isAutomationAccessAllowed(@Nullable com.atlassian.jira.user.ApplicationUser user)
user
- the user, null means anonymouslong getDefaultStructureId(@Nullable com.atlassian.jira.project.Project project)
Returns the ID of the default structure for a given project. If project
is null
, return system-wide
default structure.
Returns 0 if there's no default structure available.
Structure plugin stores a system default structure. It also allows project administrator to change default structure for a project.
Structure user interface can be configured to switch to the project default structure when that project or issue from that project is opened.
Important: It is not guaranteed that the structure with this given ID exists! The preference is stored independently from the structures.
project
- the project for which default structure is requested; null
to get a system-wide default structureStructureManager.getStructure(Long, PermissionLevel)
,
setDefaultStructureId(com.atlassian.jira.project.Project, Long)
void setDefaultStructureId(@Nullable com.atlassian.jira.project.Project project, @Nullable Long structureId)
Changes the ID of the default structure for the specified project. If project
is null
,
updates system-wide default structure.
See getDefaultStructureId(com.atlassian.jira.project.Project)
for more details about default structures.
project
- the project for which to set the default structure, null
to set system-wide defaultstructureId
- the ID of the default structure, null
to clear the value (project-level default structure
will use system-level default structure, and system-level default structure ID will be reset to 0 - no structure)getDefaultStructureId(com.atlassian.jira.project.Project)
boolean isDefaultStructureSetForProject(@NotNull com.atlassian.jira.project.Project project)
project
- project to checksetDefaultStructureId(com.atlassian.jira.project.Project, Long)
@NotNull UISettings getUISettings(@Nullable com.atlassian.jira.user.ApplicationUser user, @Nullable com.atlassian.jira.project.Project project)
Retrieves user interface settings for the specified user and project.
UI settings are typically defined at a system level by JIRA administrator and can be overridden by each user and for each project. This method calculates the final UI settings given which user is viewing Structure widget and the project context (such as viewing an issue or a project tab).
The following is the order in which settings are applied:
user
- the user to retrieve UI settings for, or null
for anonymous userproject
- the project to retrieve UI settings for, or null
for non-project-specific settingsUISettings
that details how Structure Widget should workvoid setUISettings(@Nullable com.atlassian.jira.user.ApplicationUser user, @Nullable com.atlassian.jira.project.Project project, @NotNull UISettings settings)
This method is used to update the user interface settings - either system-wide default
settings or per-user settings or per-project settings. See getUISettings(ApplicationUser, Project)
for details.
Per-project UI settings are not yet supported.
Using project
argument currently has no effect -
it would work as if project
was null
. The argument is added for
the sake of forward compatibility as we expect to support it soon.
Use UISettingsBean
to
specify the settings you want to change. If a certain setting has null
value, it is treated as "not set" and the value is inherited from generic settings.
To unset a specific setting and make it inherit a default value, use clearUISettings(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.project.Project)
to clear all settings and then this method to restore all overridden settings you'd like to keep.
user
- the user to apply the settings for, or null
to apply globallyproject
- (currently not used) the project to apply settings for, or null
to apply across all projectssettings
- an instance of settingsvoid clearUISettings(@Nullable com.atlassian.jira.user.ApplicationUser user, @Nullable com.atlassian.jira.project.Project project)
Completely removes per-user or per-project settings. Next time settings are retrieved, default/inherited settings will take effect.
Either user
or project
settings must be specified. This method
has no effect on the system defaults.
user
- the user to clear settings forproject
- the project to clear settings forsetUISettings(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.project.Project, com.almworks.jira.structure.api.settings.UISettings)
,
UISettings
Copyright © 2019 ALM Works. All Rights Reserved.