public interface ProjectSettingsRestrictionService
project settings restrictions.| Modifier and Type | Method and Description |
|---|---|
ProjectSettingsRestriction |
create(ProjectSettingsRestrictionCreateRequest restrictionRequest)
Creates a new
restriction. |
void |
delete(Project project,
SettingsKey settingsKey)
Deletes the specified
restriction, if it exists. |
Optional<ProjectSettingsRestriction> |
get(Project project,
SettingsKey settingsKey)
|
Set<ProjectSettingsRestriction> |
getAll(Project project,
String namespace,
String featureKey)
|
boolean |
hasRestriction(Project project,
SettingsKey settingsKey)
Retrieves a flag indicating whether a
restriction exists, specified by its
projects and settings key. |
boolean |
hasRestrictions(Collection<Project> projects,
SettingsKey settingsKey)
Retrieves a flag indicating whether any
restrictions exists for the provided
projects, matching the provided settings key. |
<T> T |
withRestriction(Project project,
SettingsKey settingsKey,
ProjectSettingsRestrictionAction action,
Supplier<T> operation)
A wrapper method for the specified
operation that
updates the restriction for
the specified project and settingsKey. |
@Nonnull ProjectSettingsRestriction create(@Nonnull ProjectSettingsRestrictionCreateRequest restrictionRequest)
restriction.restrictionRequest - the request containing the information to storeAuthorisationException - if the currently authenticated user does not have
Permission.PROJECT_ADMIN permission for the provided projectIntegrityException - if a project settings restriction matching the request already existsvoid delete(@Nonnull Project project, @Nonnull SettingsKey settingsKey)
restriction, if it exists.
If no restriction exists for the given key and project no operation is taken and no error is reported.project - the project to check the restriction forsettingsKey - the settings key to check the restriction forArgumentValidationException - if the project is a personal projectAuthorisationException - if the currently authenticated user does not have
Permission.PROJECT_ADMIN permission for the
provided projectUnprocessedProjectSettingsRestrictionException - if the project setting restriction is unprocessed@Nonnull Optional<ProjectSettingsRestriction> get(@Nonnull Project project, @Nonnull SettingsKey settingsKey)
project - the project to check the restriction forsettingsKey - the settings key to check the restriction forrestriction, or Optional.empty() if
the restriction does not existAuthorisationException - if the currently authenticated user does not have Permission.PROJECT_VIEW
permission for the provided project@Nonnull Set<ProjectSettingsRestriction> getAll(@Nonnull Project project, @Nonnull String namespace, @Nonnull String featureKey)
restrictions by their project with a matching
namespace and feature key.
This method will return all matching restrictions including restrictions with or without
component keys.
project - the project to check the restrictions fornamespace - the namespace of the settings key to check restrictions forfeatureKey - the feature key of the settings key to check restrictions forAuthorisationException - if the currently authenticated user does not have Permission.PROJECT_VIEW
permission for the provided projectboolean hasRestriction(@Nonnull Project project, @Nonnull SettingsKey settingsKey)
restriction exists, specified by its
projects and settings key.
This method will only return true if a restriction is found for the specified project that matches all of
SettingsKey.getNamespace(), SettingsKey.getFeatureKey() and
SettingsKey.getComponentKey().
project - the project to check restrictions forsettingsKey - the settings key to check restrictions fortrue if the project has a restriction for the specified settings key, otherwise
falseAuthorisationException - if the currently authenticated user does not have Permission.PROJECT_VIEW
permission for the provided projectboolean hasRestrictions(@Nonnull Collection<Project> projects, @Nonnull SettingsKey settingsKey)
restrictions exists for the provided
projects, matching the provided settings key.
This method will only return true if a restriction is found for the specified project that matches all of
SettingsKey.getNamespace(), SettingsKey.getFeatureKey() and
SettingsKey.getComponentKey().
projects - the projects to check restrictions forsettingsKey - the settings key to check restrictions fortrue if at least one project has a restriction for the specified settings key, otherwise
falseAuthorisationException - if the currently authenticated user does not have Permission.PROJECT_VIEW
permission for the provided projects@Nonnull <T> T withRestriction(@Nonnull Project project, @Nonnull SettingsKey settingsKey, @Nonnull ProjectSettingsRestrictionAction action, @Nonnull Supplier<T> operation)
operation that
updates the restriction for
the specified project and settingsKey.T - the return type of the supplied operationproject - the project that the restriction will be applied tosettingsKey - the settings key that the restriction will be applied toaction - the restriction update action to performoperation - the operation that is executedoperationCopyright © 2023 Atlassian. All rights reserved.