Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner: Show a web panel only for not logged in users

I want to show a web panel with Scriptrunner only to not logged in users and can't find the right condition for this. What I've tried:

if (url.contains('login'))

— works, but is too simple: it doesn't match login forms on the primary dashboard page.

import com.atlassian.jira.component.ComponentAccessor
[…]if (currentUser.key == null)

— doesn't work, never seems to be null. Any ideas?

 

Thanks in avance,

Andreas

 

1 answer

1 accepted

0 votes
Answer accepted
Leonard Chew Community Leader Dec 17, 2019

This should do the job:

import com.atlassian.jira.component.ComponentAccessor

if (!ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser())
{ return true }

This does the trick. Thank you very much!

Like Leonard Chew likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you