Web Item under the user hover menu - can I access the username of the hovered user from my custom Java class I use in condition?

I have a Web Item that I want to conditionally show under the user hover menu (system.user.hover.links section).

I have my custom Java class that implements com.atlassian.plugin.web.Condition and it works nice for other condition checks that I also need, but I am stuck on this next one.

The condition I want depends on what group the hovered user is a member of. I can access the username when forming the link itself (as velocity context variable ${profileUser}). How would and can I access this in my condition Java class as well?

1 Like

After revisiting my need I saw, that the answer was staring right at me. The context was being passed to shouldDisplay() all along.

public class ConditionCheck implements Condition {
    public boolean shouldDisplay(Map<String,Object> context)  {
      // the context variable holds what I was after