public interface StructureConfiguration
StructureConfiguration
provides access to the configuration parameters of the Structure app.
Typically, only Jira administrators have write access to the app 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 |
---|---|
JqlClauseBuilder |
addConfigurationScopeClause(JqlClauseBuilder builder)
Adds to the JQL builder a condition that limits the result set to the projects enabled for Structure.
|
void |
clearUISettings(ApplicationUser user,
Project project)
Completely removes per-user or per-project settings.
|
AttributeSensitivitySettings |
getAttributeSensitivitySettings() |
default 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.
|
Query |
getConfigurationScopeQuery()
Utility method that returns a JQL query that selects all issues in the projects that are available for Structure.
|
default List<PermissionSubject> |
getCreatorPermissionSubjects()
Used to get the list of groups (possibly other permission subjects) that are allowed to create
new structures.
|
List<Project> |
getCurrentlyEnabledProjects() |
long |
getDefaultStructureId(Project project)
Returns the ID of the default structure for a given project.
|
default List<PermissionSubject> |
getEnabledPermissionSubjects()
Used to get the list of groups (possibly other permission subjects) that the app is enabled for.
|
List<PermissionSubject> |
getPermissionSubjects(StructureAppPermission permission)
Returns the list of groups (possibly other permission subjects) that are
granted the given Structure app permission.
|
LongList |
getPickedProjectIds()
This method returns a list of IDs of projects picked by the administrator for the Structure app.
|
List<Project> |
getPickedProjects()
This method returns a list of projects picked by the administrator for the Structure app.
|
default 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(ApplicationUser user,
Project project)
Retrieves user interface settings for the specified user and project.
|
boolean |
isAllowed(StructureAppPermission permission,
ApplicationUser user)
Checks if the user is granted the given Structure app permission.
|
boolean |
isAllowedForAnyone(StructureAppPermission permission)
Checks if the given Structure app permission is granted to all users.
|
default boolean |
isAutomationAccessAllowed(ApplicationUser user)
Checks if the user is allowed to configure and use automation.
|
default boolean |
isAutomationEnabledForAnyone() |
default boolean |
isCreateEnabledForAnyone() |
boolean |
isDefaultStructureSetForProject(Project project)
Used to check whether a specific project has system-level default structure overridden with project-level default structure.
|
boolean |
isEnabledForAllProjects() |
default boolean |
isEnabledForAnyone() |
boolean |
isProjectEnabled(Project project)
Checks if a given project is enabled for Structure
|
boolean |
isStructureAvailable(ApplicationUser user)
Checks if Structure is available for the specified user.
|
default boolean |
isStructureCreationAllowed(ApplicationUser user)
Checks if the user is allowed to create new structures.
|
default boolean |
isSynchronizationAllowed(ApplicationUser user)
Checks if the user is allowed to configure and control synchronizers.
|
default boolean |
isSynchronizationEnabledForAnyone() |
void |
setAllowedForAnyone(StructureAppPermission permission,
boolean allowed)
Grant the given Structure app permission to anyone.
|
void |
setAttributeSensitivitySettings(AttributeSensitivitySettings settings) |
default void |
setAutomationEnabledForAnyone(boolean enabled)
Changes whether the automation is available for all users.
|
default void |
setAutomationPermissionSubjectsEncoded(String subjects)
Changes the list of the users / groups that are allowed to configure and control automation in controlled structures.
|
default void |
setCreateEnabledForAnyone(boolean enabled)
Changes whether the creation of new structures is available for all users.
|
default void |
setCreatorPermissionSubjectsEncoded(String subjects)
Changes the list of the users / groups that are allowed to create new structures.
|
void |
setDefaultStructureId(Project project,
Long structureId)
Changes the ID of the default structure for the specified project.
|
void |
setEnabledForAllProjects(boolean enabled)
Changes whether the app is enabled for all projects.
|
default void |
setEnabledForAnyone(boolean enabled)
Changes whether the app is available for all users.
|
default void |
setEnabledPermissionSubjectsEncoded(String subjects)
Changes the list of the users / groups that the Structure app is enabled for.
|
default void |
setPermissionSubjects(StructureAppPermission permission,
Collection<? extends PermissionSubject> subjects)
Changes the list of the users / groups that are granted the given
Structure app permission.
|
void |
setPermissionSubjectsEncoded(StructureAppPermission permission,
String subjects)
Changes the list of the users / groups that are granted the given
Structure app permission.
|
default void |
setPickedProjectIds(Collection<Long> projectIds)
Changes projects that Structure is enabled for.
|
default void |
setPickedProjectIds(LongIterable projectIds)
Changes projects that Structure is enabled for.
|
void |
setPickedProjectIds(String idList)
Changes projects that Structure is enabled for.
|
default void |
setSynchronizationEnabledForAnyone(boolean enabled)
Changes whether the synchronization is available for all users.
|
default void |
setSynchronizationPermissionSubjectsEncoded(String subjects)
Changes the list of the users / groups that are allowed to configure and control synchronizers in controlled structures.
|
void |
setUISettings(ApplicationUser user,
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 LongList getPickedProjectIds()
getCurrentlyEnabledProjects()
.@NotNull List<Project> getPickedProjects()
getCurrentlyEnabledProjects()
.@NotNull List<Project> getCurrentlyEnabledProjects()
boolean isProjectEnabled(@Nullable Project project)
project
- project to checkgetCurrentlyEnabledProjects()
default boolean isEnabledForAnyone()
@NotNull default List<PermissionSubject> getEnabledPermissionSubjects()
PermissionSubject.JiraGroup
,
Restricting User Access to Structuredefault boolean isCreateEnabledForAnyone()
@NotNull default List<PermissionSubject> getCreatorPermissionSubjects()
PermissionSubject.JiraGroup
,
Changing Permission to Create New Structuresdefault boolean isSynchronizationEnabledForAnyone()
@NotNull default List<PermissionSubject> getSynchronizationPermissionSubjects()
default boolean isAutomationEnabledForAnyone()
@NotNull default List<PermissionSubject> getAutomationPermissionSubjects()
void setEnabledForAllProjects(boolean enabled)
enabled
- if true, Structure will be enabled for all projectsvoid setPickedProjectIds(@Nullable String idList)
isEnabledForAllProjects()
returns false.idList
- a comma-delimited list of project IDsdefault void setPickedProjectIds(@Nullable LongIterable projectIds)
isEnabledForAllProjects()
returns false.projectIds
- collection of project IDsdefault void setPickedProjectIds(@Nullable Collection<Long> projectIds)
isEnabledForAllProjects()
returns false.projectIds
- collection of project IDsdefault void setEnabledForAnyone(boolean enabled)
enabled
- if true, Structure will be available to all users that have access to at least one structure-enabled project.default void setEnabledPermissionSubjectsEncoded(@Nullable String subjects)
subjects
- comma-delimited list of string-encoded permission subjectsPermissionSubject.toEncodedString()
,
Restricting User Access to Structuredefault void setCreateEnabledForAnyone(boolean enabled)
enabled
- if true, anyone who has access to Structure can create new structures.default void setCreatorPermissionSubjectsEncoded(@Nullable String subjects)
subjects
- comma-delimited list of string-encoded permission subjectsPermissionSubject.toEncodedString()
,
Changing Permission to Create New Structuresdefault void setSynchronizationEnabledForAnyone(boolean enabled)
enabled
- if true, anyone who has control access to the structure can configure and control synchronizers.default void setSynchronizationPermissionSubjectsEncoded(@Nullable String subjects)
subjects
- comma-delimited list of string-encoded permission subjectsdefault void setAutomationEnabledForAnyone(boolean enabled)
enabled
- if true, anyone who has control access to the structure can configure and control automation.default void setAutomationPermissionSubjectsEncoded(@Nullable String subjects)
subjects
- comma-delimited list of string-encoded permission subjects@NotNull JqlClauseBuilder addConfigurationScopeClause(@Nullable 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 Query getConfigurationScopeQuery()
addConfigurationScopeClause(com.atlassian.jira.jql.builder.JqlClauseBuilder)
.boolean isStructureAvailable(@Nullable ApplicationUser user)
Checks if Structure is available for the specified user.
This is not the same as isAllowed(CoreAppPermissions.USE, user)
,
because it also checks user's access to enabled projects.
user
- the user, null means anonymousdefault boolean isStructureCreationAllowed(@Nullable ApplicationUser user)
user
- the user, null means anonymousdefault boolean isSynchronizationAllowed(@Nullable ApplicationUser user)
user
- the user, null means anonymousdefault boolean isAutomationAccessAllowed(@Nullable ApplicationUser user)
user
- the user, null means anonymousboolean isAllowedForAnyone(@NotNull StructureAppPermission permission)
permission
- the permissionCoreAppPermissions
@NotNull List<PermissionSubject> getPermissionSubjects(@NotNull StructureAppPermission permission)
permission
- the permissionCoreAppPermissions
void setAllowedForAnyone(@NotNull StructureAppPermission permission, boolean allowed)
permission
- the permissionallowed
- true to grant the permission to anyoneCoreAppPermissions
void setPermissionSubjectsEncoded(@NotNull StructureAppPermission permission, @Nullable String subjects)
permission
- the permissionsubjects
- comma-delimited list of string-encoded permission subjectsCoreAppPermissions
default void setPermissionSubjects(@NotNull StructureAppPermission permission, @Nullable Collection<? extends PermissionSubject> subjects)
permission
- the permissionsubjects
- the collection of permission subjectsCoreAppPermissions
boolean isAllowed(@NotNull StructureAppPermission permission, @Nullable ApplicationUser user)
permission
- the permissionuser
- the user, null means anonymousCoreAppPermissions
long getDefaultStructureId(@Nullable 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.
The Structure app 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 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 Project project)
project
- project to checksetDefaultStructureId(com.atlassian.jira.project.Project, Long)
@NotNull UISettings getUISettings(@Nullable ApplicationUser user, @Nullable 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 ApplicationUser user, @Nullable 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 ApplicationUser user, @Nullable 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
@NotNull AttributeSensitivitySettings getAttributeSensitivitySettings()
void setAttributeSensitivitySettings(@NotNull AttributeSensitivitySettings settings)
Copyright © 2023 ALM Works. All Rights Reserved.