Customising "You can't view this issue" screen

cameronshiell November 21, 2019

If a user attempts to view an issue they don't have permission for, say they're following a link from a document to an old project that has had the 'Browse Project' permission removed, they currently get a page saying "You can't view this issue, It may have been deleted or you don't have permission to view it."

Is there anyway to customise this screen?  We're required to have access to all old issues for safety reasons, but we also have about 70 projects that are no longer being worked on and haven't been for years.  I'd like to hide them from general users, but in the rare case somebody does need to access one I want to make it clear what to do.

1 answer

1 accepted

1 vote
Answer accepted
Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 21, 2019

Hi @cameronshiell ,

Actually a good question

There might be a page (template) that you can probably modify on the server, but without impacting the files you can try to create a redirection to a page or something that would give you information about projects, contact information, etc.

You should achieve it by adding a piece of JS code into your Announcement Banner..

How would the JS look like?

The idea behind the code is that when you load that error page containing specific element that is unique (in that case DIV with ID):

error-image.error-image-canNotBeViewed

you can do something (in that case whatever you want). I suggest a redirection somewhere (to a Confluence page for example), but you can also try to modify the page using JS if you know how to do it (of course)

So the final code would be something simple like this..

<script type="text/javascript">
jQuery(window).load(function(){

if (AJS.$("span.error-image.error-image-canNotBeViewed").length !== 0) {

var new_path = "https://google.com"

window.location.replace(new_path);
console.log("Redirection to a new page");
return false;

}
});
</script>

I hope it helps :)

Ravi Sagar _Sparxsys_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 21, 2019

This is a cool trick.

Like Mirek likes this
cameronshiell November 21, 2019

That's a really elegant answer, thanks!

Like Mirek likes this

Suggest an answer

Log in or Sign up to answer