How to enable links for non-logged in Confluence users?

David Harms December 31, 2013

I use Confluence for a subscription-based web site, and at present if users aren't logged in any links to subscriber content are disabled. This is sometimes confusing for my non-logged in users. I would like to enable the links at all times so the users are prompted to log in when necessary. Is this possible?

Thanks,

Dave

2 answers

1 accepted

1 vote
Answer accepted
David Harms January 4, 2014

While not the idea solution, the following is the best option I've come up with so far. I added the following Javascript in Custom HTML at the end of the page. It looks for URLs that end in # (Confluence's convention for hiding inaccessible URLs) and replaces them with one of two publicly-accessible pages on my site, depending on whether or not the user is logged in.

<script type="text/javascript">
AJS.toInit(function ($) {
        for (var ls = document.links, numLinks = ls.length, i=0; i<numLinks; i++){
            if (!!ls){
	        var l = ls[i].href;
                if (l.indexOf("#") + 1 == l.length){
                    if (AJS.params.remoteUser == ''){
                        ls[i].href= "insert login-required URL here";
                    } else {
                        ls[i].href= "insert not-covered-by-subscription URL here";
                    }
                }
            }
        }
});
</script>

0 votes
AmrtaA January 1, 2014

Hi Dave,

I believe you can achieve that by enabling a space to be accessed by anonymous users.

In order to set a space to be accessible by anonymous user, you need to login as confluence admin, then click on Space Tool > Permission. In Anonymous access section you click on Edit Permissions and then you can select the permission as required.

Or if you want your whole site to be accessible by anonymous users you can set your Confluence to do so too.

You might find the following document usefull:

https://confluence.atlassian.com/display/DOC/Setting+Up+Public+Acces

Hope it helps.

David Harms January 1, 2014

Ah, but that's just the problem. I don't want subscriber-only spaces to be accessible by anonymous users, but I want anonymous users to see real links so that when they click on those links they're prompted to log in.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events