@PublicApi public class

SharePermissionUtils

extends Object
java.lang.Object
   ↳ com.atlassian.jira.sharing.SharePermissionUtils

@PublicApi

This class is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Some utility functions for dealing with SharePermission instances.

TODO move to UI package

Summary

Public Methods
static SharedEntity.SharePermissions fromJsonArray(JSONArray array)
Convert the passed array into SharePermissions.
static SharedEntity.SharePermissions fromJsonArrayString(String jsonString)
static SharePermission fromJsonObject(JSONObject json)
Return a SharePermission from a JSON object.
static SharePermission fromJsonObjectString(String jsonString)
Create a SharePermission from the passed JSON string.
static JSONObject toJson(SharePermission permission)
Convert the passed permission into a JSON object.
static JSONArray toJsonArray(Collection<SharePermission> permissions)
Converts the passed SharePermissions into a JSON array.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static SharedEntity.SharePermissions fromJsonArray (JSONArray array)

Convert the passed array into SharePermissions.

Parameters
array the JSON array to convert.
Returns
  • the converted SharePermission.
Throws
JSONException if an error occurs during convertion.

public static SharedEntity.SharePermissions fromJsonArrayString (String jsonString)

Throws
JSONException

public static SharePermission fromJsonObject (JSONObject json)

Return a SharePermission from a JSON object.

Parameters
json the JSON object to convert.
Returns
  • the converted SharePermission.
Throws
JSONException if an error occurs while converting the object.

public static SharePermission fromJsonObjectString (String jsonString)

Create a SharePermission from the passed JSON string.

Parameters
jsonString the JSON string make a SharePermission from.
Returns
  • the new SharePermission.
Throws
JSONException if an error occurs while converting the object.

public static JSONObject toJson (SharePermission permission)

Convert the passed permission into a JSON object.

Parameters
permission the permission to convert.
Returns
  • A JSON object representing the permission.
Throws
JSONException if an error occurs while creating the JSON object.

public static JSONArray toJsonArray (Collection<SharePermission> permissions)

Converts the passed SharePermissions into a JSON array.

Parameters
permissions the permissions to convert.
Returns
  • the JSON array.
Throws
JSONException if an error occurs while creating the JSONArray.