JQL custom function passing currentUser() to scope precomputations

We are looking to make a custom JQL function we could use to see a dashboard as an other user. This would allow us to check if permissions were properly given.

The function would replace currentUser() in our filters and we could change the user being impersonated with a dashboard widget.

From my understanding, due to precomputation if I want each user to have a different selected value I must pass the current user as an argument to the function. I am unable to do so or find any alternative way to allow each user to select a different user.

Thank you!

Hi @LucAllaire, thank you for reaching out!

It’s important to remember that permissions will still affect the final result of a JQL query. A user will never receive issues they don’t have permission to see. We describe it in detail here: https://developer.atlassian.com/cloud/jira/platform/jql-functions/#precomputations-and-users

Considering that, your function would probably work only for a user who has access to all issues in a system (for example, an admin user) and wants to see the dashboard with the subset of issues from the “basic” user perspective.


Regarding the second part of your question. To differentiate the behavior of your function based on the user, you could pass a user ID as an argument, for example:

issue in issuesForTheUser("user-id")

Best regards,
Łukasz

Hi Łukasz,
Thank you for the reply !
The idea would effectivly be for admins to see what other users see. I have though of passing a user id to the function, but the use case is to use the function in the dashboard of the user and use a widget to select the user we are “impersonating” so it would not allow that.

Thank you for the quick reply !
Luc

I’m not sure how the widget you are referring to works, but usually, the user picker component returns accountId, which is, in fact, the user ID you could pass to your function.
Is this dashboard widget your custom component?

Best regards,
Łukasz

Exactly, it would be a custom widget. We want every filter on the dashboard to switch to the selected user’s view !