1 package com.atlassian.plugin.scope;
2
3 import com.atlassian.plugin.ScopeAware;
4
5 /**
6 * Entry point for scope checks.
7 * <p>
8 * Scope key is accessible from all {@link com.atlassian.plugin.ScopeAware} classes.
9 * <p>
10 * Typical users of this class are module descriptor resolvers which will expose/hide
11 * module functionality based on whenever given scope is enabled for current tenant.
12 * <p>
13 * For example serving JIRA Service Desk rest request would need to pass `jira-service-desk` license scope verification
14 * and if product happened not to be licensed for current tenant then rest module descriptor resolver will intercept
15 * request and return 404 instead of serving normal response by underlying plugin's rest endpoint.
16 * <p>
17 * Return values of this class must not be cached and underlying implementation will guarantee
18 * acceptable performance for multiple per-request invocations.
19 *
20 * @see com.atlassian.plugin.ScopeAware
21 * @since 4.1
22 * @deprecated in 5.0 for removal in 6.0
23 */
24 @Deprecated
25 public interface ScopeManager {
26 /**
27 * @param scopeKey the scope key
28 * @return true if scope identified by scope key is active
29 */
30 boolean isScopeActive(String scopeKey);
31
32 static boolean isActive(ScopeManager scopeManager, ScopeAware scopeAware) {
33 return scopeAware.getScopeKey().map(scopeManager::isScopeActive).orElse(true);
34 }
35 }