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
This should do the job:
import com.atlassian.jira.component.ComponentAccessor
if (!ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser())
{ return true }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot! this works also for "script fragments" - useful for writing a message about login that only not-yet-logged-in users should see.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had to blur company information. Basically our banner says, when inside our network, please use SSO auto login, instead of typing again the credentials:
Condition
import com.atlassian.jira.component.ComponentAccessor
if (!ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser())
{ return true }
Code:
writer.write("<div style='background-color: white; border: 1px solid #C1C7D0; 4px; padding: 2px; font-weight: normal; text-align: center;'>ℹ️ Passwortloser Login: Bitte verwenden Sie <span style='background-color: rgba(9, 30, 66, 0.08); border-radius: 3.01px'>Auto-Login</span>, ohne Benutzernamen und Passwort anzugeben (nur innerhalb des ••••••••••••••).</div>")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.