Getting warning in logs while creating permissions by using SharePermissionUtils class

Hi Community Members,

We have developed a customized plugin in Jira using Atlassian SDK 6.3.12. This plugin creates projects in Jira instance. Somewhere in the code, we need to create permissions. Below is the code snippet for the same.

public SharedEntity.SharePermissions createSharePermissions(Project project)
{
SharedEntity.SharePermissions sharePermissions = null;
try
{
JSONArray jsonpermissionArray = new JSONArray();
String jsonText= “{“type”:“project”,“param1”:”"+project.getId()+""}";
JSONObject jsonObjectProject = new JSONObject(jsonText);
Map<String,Boolean> map=new HashMap<>();
map.put(“view”, true);
jsonObjectProject.put(“rights”, map);
System.out.println(jsonObjectProject.get(“rights”));
jsonpermissionArray.put(jsonObjectProject);
sharePermissions = SharePermissionUtils.fromJsonArray(jsonpermissionArray);

} catch (JSONException e) {
log.error(e.getMessage());
}catch (Exception e) {
log.error(e.getMessage());
}
return sharePermissions;
}

After the above-underlined line, I am getting a warning in logs which says:-

Rights object could not be found in the Share Permission JSON. Right to ‘view’ will be assigned as the default.

In order to resolve this issue when I am manually trying to add the rights object like below

jsonObjectProject.append(“rights”,“VIEW”);

I am again getting an error which states: -

com.atlassian.jira.util.json.JSONException: JSONObject[“rights”] is not a JSONObject.
at com.atlassian.jira.util.json.JSONObject.getJSONObject(JSONObject.java:500)
at com.atlassian.jira.sharing.SharePermissionUtils.fromJsonObject(SharePermissionUtils.java:98)