public final class RestHelper extends Object
Modifier and Type | Method and Description |
---|---|
static javax.ws.rs.core.UriInfo |
addAutoExpand(javax.ws.rs.core.UriInfo uriInfo,
String expandable) |
static boolean |
areBuildPositionsRequested(javax.ws.rs.core.UriInfo uriInfo) |
static void |
assertExecutePermission(PlanKey planKey) |
static void |
assertGlobalPermission(BambooPermission permission)
Asserts that current user has the specified permission.
|
static void |
assertGlobalPermission(BambooPermission permission,
String errorMessage)
Asserts that current user has the specified permission.
|
static void |
assertIpAddressIsLocal(String address) |
static void |
assertPlanPermission(BambooPermission permission,
PlanKey planKey)
Check user has provided or ADMINISTRATION permission on given plan
|
static void |
assertReadPermission() |
static void |
assertRestrictedAdminPermission() |
static void |
assertSystemAdminPermission() |
static javax.ws.rs.core.CacheControl |
cacheNever()
Removes caching in response
|
static boolean |
containsFavouriteQueryParam(javax.ws.rs.core.UriInfo uriInfo) |
static boolean |
containsMyOnlyQueryParam(javax.ws.rs.core.UriInfo uriInfo) |
static boolean |
containsPermissionQueryParam(javax.ws.rs.core.UriInfo uriInfo) |
static String |
formatDateTime(long datetime) |
static BuildState |
getBuildStateQueryParam(javax.ws.rs.core.UriInfo uriInfo) |
static Map<String,String> |
getFormParamsMap(javax.ws.rs.core.MultivaluedMap<String,String> formParams)
Returns first occurrence of parameters map
|
static I18nBean |
getI18nBean() |
static Class<? extends ImmutablePlan> |
getPlanType(javax.ws.rs.core.UriInfo uriInfo) |
static List<String> |
getQueryParamAsList(javax.ws.rs.core.UriInfo uriInfo,
String key) |
static Map<String,String> |
getQueryParamsMap(javax.ws.rs.core.UriInfo uriInfo)
Returns first occurrence of parameters map
|
static URI |
getReturnUri(javax.ws.rs.core.UriInfo uriInfo)
Content of 'returnUrl' request parameter or null if empty.
|
static boolean |
hasCloverEnabledQueryParam(javax.ws.rs.core.UriInfo uriInfo) |
static boolean |
hasQueryParam(javax.ws.rs.core.UriInfo uriInfo,
String key) |
static boolean |
hasWithBuildPermissionOnlyParam(javax.ws.rs.core.UriInfo uriInfo) |
public static I18nBean getI18nBean()
public static javax.ws.rs.core.UriInfo addAutoExpand(javax.ws.rs.core.UriInfo uriInfo, String expandable)
public static boolean containsFavouriteQueryParam(javax.ws.rs.core.UriInfo uriInfo)
public static boolean containsPermissionQueryParam(javax.ws.rs.core.UriInfo uriInfo)
public static boolean containsMyOnlyQueryParam(javax.ws.rs.core.UriInfo uriInfo)
public static boolean areBuildPositionsRequested(javax.ws.rs.core.UriInfo uriInfo)
public static Class<? extends ImmutablePlan> getPlanType(javax.ws.rs.core.UriInfo uriInfo)
public static boolean hasCloverEnabledQueryParam(javax.ws.rs.core.UriInfo uriInfo)
public static boolean hasWithBuildPermissionOnlyParam(javax.ws.rs.core.UriInfo uriInfo)
public static boolean hasQueryParam(javax.ws.rs.core.UriInfo uriInfo, String key)
@Nullable public static List<String> getQueryParamAsList(javax.ws.rs.core.UriInfo uriInfo, String key)
@NotNull public static Map<String,String> getQueryParamsMap(javax.ws.rs.core.UriInfo uriInfo)
uriInfo
- @NotNull public static Map<String,String> getFormParamsMap(javax.ws.rs.core.MultivaluedMap<String,String> formParams)
formParams
- public static BuildState getBuildStateQueryParam(@NotNull javax.ws.rs.core.UriInfo uriInfo)
public static String formatDateTime(long datetime)
public static javax.ws.rs.core.CacheControl cacheNever()
@Nullable public static URI getReturnUri(javax.ws.rs.core.UriInfo uriInfo)
uriInfo
- public static void assertPlanPermission(@NotNull BambooPermission permission, @NotNull PlanKey planKey)
permission
- planKey
- public static void assertReadPermission()
public static void assertExecutePermission(PlanKey planKey)
public static void assertSystemAdminPermission()
public static void assertRestrictedAdminPermission()
public static void assertGlobalPermission(@NotNull BambooPermission permission)
AccessDeniedException
with a
generic error message.permission
- permission to verifyorg.acegisecurity.AccessDeniedException
- if user lacks the specified permissionpublic static void assertGlobalPermission(@NotNull BambooPermission permission, @NotNull String errorMessage)
AccessDeniedException
with the
specified messagepermission
- permission to verifyerrorMessage
- exception message to be used if user lacks the specified permissionorg.acegisecurity.AccessDeniedException
- if user lacks the specified permissionpublic static void assertIpAddressIsLocal(@NotNull String address) throws UnknownHostException
UnknownHostException
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.