One easy tip to avoid nuking production in Atlassian Jira and Confluence

In our previous post we discuss some automated steps you can take to help get your staging environment set up correctly. But once you’re there, new risks come up. In this blog, we focus on what you can do in both your production and staging environments to ensure your admins are less likely to confuse the two and break something.

Did you ever delete a scheme and then freak out when you realize you did it on the wrong system? When you’re heads down trying to get things done, it’s easy to lose track of which system you are on.

We’re no different, and have been guilty of this in the past. To help reduce the risk of this kind of mistake we came up with a simple visual cue to help.

A light red tint* is applied to all pages when viewed by an admin user, reminding them that they are on a production instance. When they switch to staging, we do the same with a light green* tint. Keep in mind that while this article talks about Jira, the same code can be adopted (with a bit of tweaking) to Confluence or any other Atlassian tool that allows you to inject your own code. How did we accomplish this? With a little bit of JS and CSS in each systems announcement banner:

<!-- Update the background color and transparency as you need.
Green: (0,100,0, .12)
Red: (100,0,0, .12)
-->

<style>
#admin-overlay{
  pointer-events: none;
  background: rgba(0,100,0, .12); 
  position:fixed !important;
  position:absolute;
  top:0;
  right:0;
  bottom:0;
  left:0;
  z-index: 11;
}
</style>

<script>
// First check the local UI element to reduce number of requests to server
if($("#system-admin-menu").length){
  // Get user permissions
  $.get( "/rest/api/2/mypermissions", function( data ) {
    // Validate that user has either admin or sysadmin and then append the overlay
    if( data.permissions.SYSTEM_ADMIN.havePermission || data.permissions.ADMINISTER.havePermission){
      $("#page").append( "<div id='admin-overlay'></div>" );
    }
  });
}
</script>

* We understand that this does not work for individuals who are colorblind. If you have any feedback on similar techniques that work just as well for colorblind individuals please share them with us in the comments.


Signup for more Atlassian Jira & Confluence tips and tricks

Leave a Reply