Disable share "Any Logged-in User"

Rilwan Ahmed
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 22, 2018

Is it possible to disable the share option "Any Logged-In User" from dashboard and filters?
I am using jira 7.3.3 version

 

Share.png

3 answers

1 accepted

3 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 23, 2018

There is not a setting within Jira that you can set to disable this option.   However there is a KB on a related issue that provides a javascript that will allow you to hide an element in this view.  You can see more details on this in the KB: How to Remove the 'Everyone' Share Option from Filters.

 

While that KB is about removing the 'everyone' or public sharing option, we can alter the script on that page in order to also hide this 'Any logged-in user' option if you so desire.

To do this, you will need to be using Jira Server.  As Jira Cloud may not have the announcement banner any more going forward.   What I did was take the script on that page and then alter it to look like this:

 

<script type='text/javascript'>

// To use just place in JIRA Announcement Banner
// Disables 'Any logged-in user' option when sharing filters
// Fires on page load

AJS.toInit(function()
{
    // Scrapes URL path    
    var urlPath = $(location).attr('pathname');
    // Sets variable for later use to disable checking for tag presence
    var intervalID;

    // check url if we are editing a filter
    if (urlPath.toLowerCase().indexOf("editfilter") >= 0) {
        intervalID = window.setInterval(callBack, 10);
    }
    // Listens for edit filter dialog
    AJS.$(".edit-filter").click(function() {
        intervalID = window.setInterval(callBack, 10);
    });

    // Removes unwanted elements
    function callBack()
    {
        var loggedin = AJS.$("#share_type_selector option[value='loggedin']");
        var warning = AJS.$("#share_warning");
        var addGlobal = AJS.$("#share_add_global");
        var desc = AJS.$("#share_type_description");
        var groupShare = AJS.$("#share_group");

        if (loggedin.length > 0) {
        clearInterval(intervalID);
        loggedin.remove();
        warning.remove();
        addGlobal.remove();
        desc.remove();
        groupShare.removeAttr("style");
        }
    }
});
</script>

When I posted this script into the announcement banner (set to public mode), then each time that page is loaded, you won't see the option to share the filter with that specific entity.  

That said this work-around might be helpful.  Something to note about this:  This only would prevent your web users of Jira from being able to do this.  It does not effect users that make calls to Jira using the REST API as a means to share filters.   In most cases, I don't expect that to be something commonly done via REST, but just to make you aware of how it could still be done even with this work-around.

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 23, 2018

So after writing this up, I realized that this would only work on the filter edit dialog.  In your screenshot it was for the dashboard sharing, which technically has some different element names which would not work for that.  So I tweaked the script some more and I believe this one below will remove that option from both dashboards and filter edit screens:

<script type='text/javascript'>

// To use just place in JIRA Announcement Banner
// Disables 'Any Logged in user' option when sharing filters AND dashboards
// Fires on page load

AJS.toInit(function()
{
    // Scrapes URL path    
    var urlPath = $(location).attr('pathname');
    // Sets variable for later use to disable checking for tag presence
    var intervalID;

    // check url if we are editing a filter
    if (urlPath.toLowerCase().indexOf("editfilter") >= 0){
        intervalID = window.setInterval(callBack, 10);
    }
    // Listens for edit filter dialog
    AJS.$(".edit-filter").click(function() {
        intervalID = window.setInterval(callBack, 10);
    })

    //check url for dashboard edit
    if (urlPath.toLowerCase().indexOf("editportalpage") >= 0){
        intervalID = window.setInterval(callBack, 10);
    }
    // Listens for edit dashboard dialog
    AJS.$(".edit-dashboard").click(function() {
        intervalID = window.setInterval(callBack, 10);
    });

    // Removes unwanted elements
    function callBack()
    {
        var loggedin = AJS.$("#share_type_selector option[value='loggedin']");
        var warning = AJS.$("#share_warning");
        var addGlobal = AJS.$("#share_add_global");
        var desc = AJS.$("#share_type_description");
        var groupShare = AJS.$("#share_group");

        if (loggedin.length > 0) {
        clearInterval(intervalID);
        loggedin.remove();
        warning.remove();
        addGlobal.remove();
        desc.remove();
        groupShare.removeAttr("style");
        }
    }
});
</script>

 

Cheers,

Rilwan Ahmed
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 27, 2018

Thanks, this works for filter and dashboard

Paul Benario April 24, 2019

This is really helpful for us as well, but I think we're going to need to do this as well, but what would be the easiest way to edit this to work for BOTH 'Everyone' and "Any logged in user"? 

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 24, 2019

@Paul Benario What version of Jira are you using where you see both 'any logged in user' and everyone as an entity?  My understanding was that Jira would show you one or the other depending on your version of Jira.  But maybe I'm mistaken here.

Or are you asking how to remove everyone this ability from both filter and dashboards instead of the 'any logged in user'?

Paul Benario April 25, 2019

@Andy Heinzer we're on 7.5.0.

Sorry - I was wrong on the terminology. I mean removing both 'public' and 'any logged-in user' from the drop down. Screenshot kept failing to upload, but I can try again.

Is removing public just a system setting? 

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2019

Hi Paul,

Yes the Public setting became a system option in Jira 7.2 and higher.  It's something you can find in the system settings under JIRA Admin > System > General Configuration > Edit Settings.  The setting is called 'Public sharing'.  From that description:

Allows users to share dashboards and filters with all users including those that are not logged in. Disabling this will not change sharing for dashboards and filters that are already shared with the public. See related knowledge base article.

So the public setting only affects users without a login account for Jira (aka anonymous users).   It's the 'Any Logged in user' role that can only really be hidden from end users via the scripts above.

I hope that helps to clarify here.

Andy

Like metzo4102 likes this
Administrator August 6, 2019

Hi Andy,

Try to use this script on Jira 8.02 - is not working. Added this to announcement banner,  go to the Issue--> manage filters-->my filters-->edit filter and i still see option "Any Logged in user". Any ideas? 

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2019

Hi @Administrator 

Thanks for bringing this up.  It appears that the element name has changed since I first answered this post.  I think I know why now.  In Jira 7.12 Atlassian introduced some changes to the elements names here.  It was part of the enhancements made to filters to allow them to be shared out to other users more easily. More details in Jira 7.12 Release notes. Try this instead:

<script type='text/javascript'>

// To use just place in JIRA Announcement Banner
// Disables 'Any Logged in user' option when sharing filters AND dashboards
// Fires on page load
// Last tested for Jira 7.12.1 - 8.2.3

AJS.toInit(function()
{
// Scrapes URL path
var urlPath = $(location).attr('pathname');
// Sets variable for later use to disable checking for tag presence
var intervalID;

// check url if we are editing a filter
if (urlPath.toLowerCase().indexOf("editfilter") >= 0){
intervalID = window.setInterval(callBack, 10);
}
// Listens for edit filter dialog
AJS.$(".edit-filter").click(function() {
intervalID = window.setInterval(callBack, 10);
})

//check url for dashboard edit
if (urlPath.toLowerCase().indexOf("editportalpage") >= 0){
intervalID = window.setInterval(callBack, 10);
}
// Listens for edit dashboard dialog
AJS.$(".edit-dashboard").click(function() {
intervalID = window.setInterval(callBack, 10);
});

// Removes unwanted elements
function callBack()
{
var loggedin = AJS.$("#share_type_selector_viewers option[value='loggedin']");
var warning = AJS.$("#share_warning");
var addGlobal = AJS.$("#share_add_global");
var desc = AJS.$("#share_type_description");
var groupShare = AJS.$("#share_group");

if (loggedin.length > 0) {
clearInterval(intervalID);
loggedin.remove();
warning.remove();
addGlobal.remove();
desc.remove();
groupShare.removeAttr("style");
}
}
});
</script>
Administrator August 8, 2019

Thanks! Now it works great!

Uladzislau Khevuk August 14, 2019
<script type='text/javascript'>
// To use just place in JIRA Announcement Banner
// Disables 'Any Logged in user' option when sharing filters AND dashboards
// Fires on page load
// Last tested for Jira 7.12.1 - 8.2.3

AJS.toInit(function()
{
// Scrapes URL path
var urlPath = $(location).attr('pathname');
// Sets variable for later use to disable checking for tag presence
var intervalID;

// check url if we are editing a filter
if (urlPath.toLowerCase().indexOf("editfilter") >= 0){
intervalID = window.setInterval(callBack, 10);
}
// Listens for edit filter dialog
AJS.$(".edit-filter").click(function() {
intervalID = window.setInterval(callBack, 10);
})

//check url for dashboard create
if (urlPath.toLowerCase().indexOf("addportalpage") >= 0){
intervalID = window.setInterval(callBack, 10);
}
//check url for dashboard edit
if (urlPath.toLowerCase().indexOf("editportalpage") >= 0){
intervalID = window.setInterval(callBack, 10);
}
// Listens for edit dashboard dialog
AJS.$(".edit-dashboard").click(function() {
intervalID = window.setInterval(callBack, 10);
});

// Removes unwanted elements
function callBack()
{
var loggedin = AJS.$("#share_type_selector_viewers option[value='loggedin']");
var warning = AJS.$("#share_warning");
var addGlobal = AJS.$("#share_add_global");
var desc = AJS.$("#share_type_description");
var groupShare = AJS.$("#share_group");

if (loggedin.length > 0) {
clearInterval(intervalID);
loggedin.remove();
warning.remove();
addGlobal.remove();
desc.remove();
groupShare.removeAttr("style");
}
}
});
</script>

 I've added "dashboard create" block, because you can find the same construction there as well.

Cloud Services September 6, 2019

Thanks - We're in the process of updating from 7.5.2 to 8.3.3 and just came across the same issue that the previously implemented workaround wasn't functioning in the newer version.

Updated as above and functionality is restored.

Can confirm it still works for Jira 8.3.3, if you wanted to update the script text.

ARUN MA September 8, 2021

any changes required for 8.13.7 ?

0 votes
Rodrigo Martinez
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 10, 2023

Hi folks!

Another alternative may be just through CSS in the Banner:

<style>
#share_type_selector_viewers > option[value="loggedin"] {
  display: none;
}
</style>

(validated in Jira 9.11 but should work on many versions from 8 to 9)

Cheers

0 votes
Rilwan Ahmed
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 8, 2019

We did it as part of a plugin. 

M Vijay Kumar December 9, 2020

Which plug-in did you use ?

ARUN MA April 21, 2021

@Andy Heinzer - Could you please let me know , where to add this Script ?

ARUN MA April 21, 2021

please ignore i have added in announcement banner

ARUN MA July 12, 2021

we are using Jira Software 8.13.7 , the script not helped any  changes required ?

 

<script type='text/javascript'>

// To use just place in JIRA Announcement Banner
// Disables 'Any Logged in user' option when sharing filters AND dashboards
// Fires on page load
// Last tested for Jira 7.12.1 - 8.2.3

AJS.toInit(function()
{
// Scrapes URL path
var urlPath = $(location).attr('pathname');
// Sets variable for later use to disable checking for tag presence
var intervalID;

// check url if we are editing a filter
if (urlPath.toLowerCase().indexOf("editfilter") >= 0){
intervalID = window.setInterval(callBack, 10);
}
// Listens for edit filter dialog
AJS.$(".edit-filter").click(function() {
intervalID = window.setInterval(callBack, 10);
})

//check url for dashboard edit
if (urlPath.toLowerCase().indexOf("editportalpage") >= 0){
intervalID = window.setInterval(callBack, 10);
}
// Listens for edit dashboard dialog
AJS.$(".edit-dashboard").click(function() {
intervalID = window.setInterval(callBack, 10);
});

// Removes unwanted elements
function callBack()
{
var loggedin = AJS.$("#share_type_selector_viewers option[value='loggedin']");
var warning = AJS.$("#share_warning");
var addGlobal = AJS.$("#share_add_global");
var desc = AJS.$("#share_type_description");
var groupShare = AJS.$("#share_group");

if (loggedin.length > 0) {
clearInterval(intervalID);
loggedin.remove();
warning.remove();
addGlobal.remove();
desc.remove();
groupShare.removeAttr("style");
}
}
});
</script>

Suggest an answer

Log in or Sign up to answer