I am creating a Jira software server plugin for v7.13.0. I am creating an API to get all the issue security levels of a user.
My code for the same is as follows:
UserManager userManager = ComponentAccessor.getComponentOfType(UserManager.class);
@GET
@Produces({MediaType.APPLICATION_JSON})
@Path("user-security-levels")
public Response getUserSecurityLevels(@QueryParam("user") String user) {
log.error("entering getSecurityLevels function");
log.error("name of the user: " + user);
ApplicationUser targetUser = userManager.getUserByName(user);
log.error("value of targetUser: " + targetUser);
IssueSecurityLevelManager issueSecurityLevelManager = ComponentAccessor.getComponentOfType(IssueSecurityLevelManager.class);
Collection<IssueSecurityLevel> securityLevelsOfUser = issueSecurityLevelManager.getAllSecurityLevelsForUser(targetUser);
log.error("user security levels: " + securityLevelsOfUser);
return securityLevelsOfUser == null ? Response.status(Response.Status.NOT_FOUND)
.build() : Response.ok(securityLevelsOfUser).build();
}
But, this code is not working and is giving the following error:
2022-10-27 16:00:35,623 http-nio-8080-exec-13 ERROR [o.a.c.c.C.[.[localhost].[/].[default]] Servlet.service() for servlet [default] in context with path [] threw exception
org.codehaus.jackson.map.JsonMappingException: No serializer found for class com.atlassian.jira.issue.security.IssueSecurityLevelImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.HashSet[0])
Can anyone please help me to fix this issue?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.