You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by me...@apache.org on 2020/12/14 08:57:35 UTC

[ranger] branch master updated: RANGER-3109 : Ranger Access audit improvements.

This is an automated email from the ASF dual-hosted git repository.

mehul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new 8ca158a  RANGER-3109 : Ranger Access audit improvements.
8ca158a is described below

commit 8ca158adcc00d0ef4a5bcba82ec9af9a8737c280
Author: Dhaval Rajpara <dh...@gmail.com>
AuthorDate: Fri Dec 11 20:14:03 2020 +0530

    RANGER-3109 : Ranger Access audit improvements.
    
    Signed-off-by: Mehul Parikh <me...@apache.org>
---
 security-admin/src/main/webapp/index.html          |   1 +
 .../Backgrid.ColumnManager.css                     | 114 +++
 .../Backgrid.ColumnManager.min.js                  | 971 +++++++++++++++++++++
 .../main/webapp/libs/other/backgrid/backgrid.css   |   5 +-
 .../main/webapp/libs/other/backgrid/backgrid.js    | 175 ++--
 security-admin/src/main/webapp/scripts/Init.js     |   6 +-
 .../src/main/webapp/scripts/utils/XAUtils.js       |  13 +
 .../webapp/scripts/views/common/XATableLayout.js   |  44 +-
 .../webapp/scripts/views/reports/AuditLayout.js    |  52 +-
 security-admin/src/main/webapp/styles/xa.css       |   9 +-
 .../webapp/templates/reports/AuditLayout_tmpl.html |  27 +-
 11 files changed, 1317 insertions(+), 100 deletions(-)

diff --git a/security-admin/src/main/webapp/index.html b/security-admin/src/main/webapp/index.html
index 0fc4cb1..6ac8605 100644
--- a/security-admin/src/main/webapp/index.html
+++ b/security-admin/src/main/webapp/index.html
@@ -34,6 +34,7 @@
         <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css">
         <link href="libs/other/jquery-ui/css/jquery-ui.min.css" media="all" rel="stylesheet" type="text/css">
         <link href="libs/other/backgrid/backgrid.css" media="all" rel="stylesheet" type="text/css">
+        <link href="libs/other/backgrid-column-manager/Backgrid.ColumnManager.css" media="all" rel="stylesheet" type="text/css">
         <link href="libs/bower/backgrid-paginator/css/backgrid-paginator.css" media="all" rel="stylesheet" type="text/css">
         <link href="libs/bower/backgrid-filter/css/backgrid-filter.css" media="all" rel="stylesheet" type="text/css">
         <link href="libs/bower/select2/select2.css" media="all" rel="stylesheet" type="text/css">
diff --git a/security-admin/src/main/webapp/libs/other/backgrid-column-manager/Backgrid.ColumnManager.css b/security-admin/src/main/webapp/libs/other/backgrid-column-manager/Backgrid.ColumnManager.css
new file mode 100644
index 0000000..d897fd9
--- /dev/null
+++ b/security-admin/src/main/webapp/libs/other/backgrid-column-manager/Backgrid.ColumnManager.css
@@ -0,0 +1,114 @@
+#control {
+    margin: 0 0 10px 0;
+}
+
+div.columnmanager-visibilitycontrol {
+    margin: 0 auto;
+    position: relative;
+}
+
+div.columnmanager-visibilitycontrol > button.dropdown-button {
+    background-image: -moz-linear-gradient(top, #ffffff, #dbdbdb);
+    background-image: -webkit-gradient(linear,left top,left bottom,
+    color-stop(0, #ffffff),color-stop(1, #dbdbdb));
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#dbdbdb');
+    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#dbdbdb')";
+    border: 1px solid #fff;
+    -moz-box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.4);
+    -webkit-box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.4);
+    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.4);
+    text-decoration: none;
+    text-shadow: #fff 0 1px 0;
+    color: #597390;
+    font-weight: bold;
+}
+
+div.columnmanager-visibilitycontrol > button.dropdown-button:hover {
+    background-image: -moz-linear-gradient(top, #ffffff, #eeeeee);
+    background-image: -webkit-gradient(linear,left top,left bottom,
+    color-stop(0, #ffffff),color-stop(1, #eeeeee));
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#eeeeee');
+    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#eeeeee')";
+    color: #000;
+}
+
+div.columnmanager-visibilitycontrol > button.dropdown-button:active {
+    background-image: -moz-linear-gradient(top, #dbdbdb, #ffffff);
+    background-image: -webkit-gradient(linear,left top,left bottom,
+    color-stop(0, #dbdbdb),color-stop(1, #ffffff));
+    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#dbdbdb', EndColorStr='#ffffff');
+    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#dbdbdb', EndColorStr='#ffffff')";
+    text-shadow: 0px -1px 0 rgba(255, 255, 255, 0.5);
+}
+
+div.columnmanager-dropdown-container {
+    cursor: default;
+    position: absolute;
+    z-index: 10;
+    top: 0;
+    left: 0;
+    background: #fff;
+    border: solid 1px #bbb;
+    -webkit-box-shadow: #999999 0 1px 3px;
+    -moz-box-shadow: #999999 0 1px 3px;
+    box-shadow: #999999 0 1px 3px;
+    width: 200px;
+    display: none !important;
+    min-height: 20px;
+    max-height: 400px;
+    font-size: 14px;
+    line-height: 1.1em;
+    font-weight: normal;
+    text-align: left;
+    color: #444;
+    text-transform: none;
+    -webkit-border-radius: 3px;
+    -moz-border-radius: 3px;
+    border-radius: 3px;
+    -moz-background-clip: padding;
+    -webkit-background-clip: padding-box;
+    background-clip: padding-box;
+    pointer-events: none;
+}
+
+div.columnmanager-dropdown-container.open {
+    display: block !important;
+    pointer-events: auto;
+    overflow-y: auto;
+}
+
+.columnmanager-dropdown-container > li {
+    list-style-type:none;
+    padding: 5px 0px 0px 20px;
+    border-bottom: solid 1px lightgray;
+    cursor: pointer;
+}
+
+.columnmanager-dropdown-container > li:hover {
+    background-color: #f0f0f0;
+}
+
+.columnmanager-dropdown-container > li:last-child {
+    border-bottom: none;
+}
+
+.columnmanager-dropdown-container > li > span.indicator {
+    width: 20px;
+    display: inline-block;
+}
+.columnmanager-dropdown-container > li.visible > span.indicator::before {
+    content: "✓";
+    color: blue;
+}
+
+.columnmanager-dropdown-container > li > span.column-label {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    display: inline-block;
+    width: 142px;
+ }
+
+th.columnVisibility {
+    overflow: visible;
+}
diff --git a/security-admin/src/main/webapp/libs/other/backgrid-column-manager/Backgrid.ColumnManager.min.js b/security-admin/src/main/webapp/libs/other/backgrid-column-manager/Backgrid.ColumnManager.min.js
new file mode 100644
index 0000000..2918d0f
--- /dev/null
+++ b/security-admin/src/main/webapp/libs/other/backgrid-column-manager/Backgrid.ColumnManager.min.js
@@ -0,0 +1,971 @@
+"use strict";
+
+/**
+ * A column manager for backgrid
+ *
+ * @module Backgrid.ColumnManager
+ */
+
+// Dependencies
+var _ = require("underscore");
+var $ = require("jquery");
+var Backbone = require("backbone");
+var Backgrid = require("backgrid");
+var COLUMN_MANAGER_PREFIX = "columnmanager";
+
+/**
+ * Manages visibility of columns.
+ *
+ * @class Backgrid.Extension.ColumnManager ColumnManager
+ * @constructor
+ * @param {Backgrid.Columns} columns
+ * @param {Object} [options]
+ * @param {number} [options.initialColumnCount] Initial amount of columns to show. Default is null (All visible).
+ * @param {boolean} [options.trackSize]
+ * @param {boolean} [options.trackOrder]
+ * @param {boolean} [options.trackVisibility]
+ * @param {string} [options.stateChecking] can be "strict" or "loose".
+ * @param {boolean} [options.saveState]
+ * @param {string} [options.saveStateKey] Storage key. Must be unique for location. Can be left out if this plugin is only used in one place.
+ * @param {string} [options.saveStateLocation] Can be "localStorage" (default) or "sessionStorage" (be aware, session stored values are lost when window is closed)
+ * @param {boolean} [options.loadStateOnInit]
+ * @param {Array} [state]
+ */
+Backgrid.Extension.ColumnManager = function (columns, options, state) {
+  // Bind backbone events
+  _.extend(this, Backbone.Events);
+
+  // Save options and merge with defaults
+  var defaults = {
+    initialColumnsVisible: null,
+
+    // State options
+    trackSize: true,
+    trackOrder: true,
+    trackVisibility: true,
+    stateChecking: "strict",
+    saveState: false,
+    saveStateKey: "",
+    saveStateLocation: "localStorage",
+    loadStateOnInit: false
+  };
+  this.options = _.extend({}, defaults, options);
+  this.state = [];
+
+  // Check if columns is instance of Backgrid.Columns
+  if (columns instanceof Backgrid.Columns) {
+    // Save columns
+    this.columns = columns;
+
+    // Add columnManager to columns (instance)
+    columns.columnManager = this;
+    this.addManagerToColumns();
+
+    // Set state if provided
+    var storedState = (this.options.loadStateOnInit) ? this.loadState() : false;
+    if (state && this.checkStateValidity(state)) {
+      this.setState(state, true);
+    }
+    else if (storedState) {
+      this.setState(storedState, true);
+    }
+    else {
+      // If no initial state is provided, adhere to initial column visibility settings
+      this.setInitialColumnVisibility();
+
+      // Set current state
+      this.setState(this.getStateFromColumns());
+    }
+
+    // Listen to column events
+    if (this.options.trackVisibility || this.options.trackSize || this.options.trackOrder) {
+      //this.stateUpdateHandler = _.bind(this.stateUpdateHandler, this);
+      var events = "" +
+          ((this.options.trackVisibility) ? "change:renderable " : "") +
+          ((this.options.trackSize) ? "resize " : "") +
+          ((this.options.trackOrder) ? "ordered" : "");
+      this.columns.on(events, _.bind(this.stateUpdateHandler, this));
+    }
+  }
+  else {
+    // Issue warning
+    console.error("Backgrid.ColumnManager: options.columns is not an instance of Backgrid.Columns");
+  }
+};
+
+/**
+ * Loops over all columns and sets the visibility according to provided options.
+ *
+ * @method setInitialColumnVisibility
+ */
+Backgrid.Extension.ColumnManager.prototype.setInitialColumnVisibility = function () {
+  var self = this;
+
+  // Loop columns and set renderable property according to settings
+  var initialColumnsVisible = self.options.initialColumnsVisible;
+
+  if (initialColumnsVisible) {
+    self.columns.each(function (col, index) {
+      col.set("renderable", (col.get("alwaysVisible")) ? true : index < initialColumnsVisible);
+    });
+  }
+};
+
+/**
+ * Loops over all columns and adds the columnManager instance to VisibilityHeaderCell columns.
+ *
+ * @method addManagerToColumns
+ */
+Backgrid.Extension.ColumnManager.prototype.addManagerToColumns = function () {
+  var self = this;
+
+  self.columns.each(function (col) {
+    // Look for header cell
+    if (col.get("headerCell") === Backgrid.Extension.ColumnManager.ColumnVisibilityHeaderCell) {
+      col.set("headerCell", col.get("headerCell").extend({
+        columnManager: self
+      }));
+    }
+
+    if (col.get("headerCell") instanceof Backgrid.Extension.ColumnManager.ColumnVisibilityHeaderCell) {
+      col.get("headerCell").columnManager = self;
+    }
+  });
+};
+
+/**
+ * Convenience function to retrieve a column either directly or by its id.
+ * Returns false if no column is found.
+ *
+ * @method getColumn
+ * @param {string|number|Backgrid.Column} col
+ * @return {Backgrid.Column|boolean}
+ */
+Backgrid.Extension.ColumnManager.prototype.getColumn = function (col) {
+  // If column is a string or number, try to find a column which has that ID
+  if (_.isNumber(col) || _.isString(col)) {
+    col = this.columns.get(col);
+  }
+  return (col instanceof Backgrid.Column) ? col : false;
+};
+
+/**
+ * Hides a column
+ *
+ * @method hidecolumn
+ * @param {string|number|Backgrid.Column} col
+ */
+Backgrid.Extension.ColumnManager.prototype.hideColumn = function (col) {
+  // If column is a valid backgrid column, set the renderable property to false
+  var column = this.getColumn(col);
+  if (column) {
+    column.set("renderable", false);
+  }
+};
+
+/**
+ * Shows a column
+ *
+ * @method showColumn
+ * @param {string|number|Backgrid.Column} col
+ */
+Backgrid.Extension.ColumnManager.prototype.showColumn = function (col) {
+  // If column is a valid backgrid column, set the renderable property to true
+  var column = this.getColumn(col);
+  if (column) {
+    column.set("renderable", true);
+  }
+};
+
+/**
+ * Toggles a columns' visibility
+ *
+ * @method toggleColumnVisibility
+ * @param {string|number|Backgrid.Column} col
+ */
+Backgrid.Extension.ColumnManager.prototype.toggleColumnVisibility = function (col) {
+  // If column is a valid backgrid column, set the renderable property to true
+  var column = this.getColumn(col);
+  if (column) {
+    if (column.get("renderable")) {
+      this.hideColumn(column);
+    }
+    else {
+      this.showColumn(column);
+    }
+  }
+};
+
+/**
+ * Returns the managed column collection
+ *
+ * @method getColumnCollection
+ * @return {Backgrid.Columns}
+ */
+Backgrid.Extension.ColumnManager.prototype.getColumnCollection = function () {
+  return this.columns;
+};
+
+/**
+ *
+ * @method setState
+ * @param {Array} state
+ * @param {boolean} applyState
+ * @return {boolean}
+ */
+Backgrid.Extension.ColumnManager.prototype.setState = function (state, applyState) {
+  var self = this;
+
+  // Filter state
+  _.filter(state, function(columnState) {
+    if (!_.has(columnState, "name")) {
+      return false;
+    }
+
+    var column = self.columns.findWhere({
+      name: state.name
+    });
+
+    return typeof column !== "undefined";
+  });
+
+  // Check if state is valid
+  if (self.checkStateValidity(state) && state !== self.state) {
+    // Apply and save state
+    self.state = state;
+    self.trigger("state-changed", state);
+
+    if (applyState) {
+      return self.applyStateToColumns();
+    }
+    else {
+      return self.saveState();
+    }
+  }
+  return false;
+};
+
+/**
+ * @method getState
+ * @return {Array}
+ */
+Backgrid.Extension.ColumnManager.prototype.getState = function () {
+  return this.state;
+};
+
+/**
+ *
+ * @method checkStateValidity
+ * @return {boolean}
+ */
+Backgrid.Extension.ColumnManager.prototype.checkStateValidity = function (state) {
+  // Has to be array
+  if (!_.isArray(state) && _.isEmpty(state)) {
+    return false;
+  }
+
+  function checkValidityColumnState() {
+    return _.every(state, function(column) {
+      var valid = true;
+
+      // We require a name key
+      if (!_.has(column, "name")) {
+        valid = false;
+      }
+
+      // If renderable is set, should be boolean
+      if (_.has(column, "renderable")) {
+        if (!_.isBoolean(column.renderable)) {
+          valid = false;
+        }
+      }
+
+      // If displayOrder is set, should be a number
+      if (_.has(column, "displayOrder")) {
+        if (!_.isNumber(column.displayOrder)) {
+          valid = false;
+        }
+      }
+
+      // If width is set, should be a number or a string
+      if (_.has(column, "width")) {
+        if (!_.isNumber(column.width) && !_.isString(column.width)) {
+          valid = false;
+        }
+      }
+
+      return valid;
+    });
+  }
+
+  // Check if state is valid
+  if (this.options.stateChecking === "loose") {
+    // At least we require 'name' keys in every objec
+    return checkValidityColumnState();
+  }
+  else {
+    // Strict check
+    // Requires same length and valid name keys.
+    if (state.length !== this.columns.length && !checkValidityColumnState()) {
+      return false;
+    }
+
+    var columnNameKeys = this.columns.map(function (column) {
+      return column.get("name");
+    });
+
+    var newStateNameKeys = _.map(state, function (column) {
+      return column.name;
+    });
+
+    return columnNameKeys.sort().toString() === newStateNameKeys.sort().toString();
+  }
+};
+
+
+/**
+ *
+ * @method loadState
+ * @return {boolean}
+ */
+Backgrid.Extension.ColumnManager.prototype.loadState = function () {
+  // Get state from storage
+  var state = JSON.parse(this.getStorage().getItem(this.getStorageKey()));
+  if (this.checkStateValidity(state)) {
+    return state;
+  }
+  return false;
+};
+
+/**
+ *
+ * @method saveState
+ * @param {boolean} [force] Override save settings.
+ * @return {boolean}
+ */
+Backgrid.Extension.ColumnManager.prototype.saveState = function (force) {
+  if (this.options.saveState || force) {
+    this.getStorage().setItem(this.getStorageKey(), JSON.stringify(this.state));
+    this.trigger("state-saved");
+    return true;
+  }
+  return false;
+};
+
+/**
+ * @method getStorage
+ * @return {boolean|Storage}
+ * @private
+ */
+Backgrid.Extension.ColumnManager.prototype.getStorage = function () {
+  // Check if storage functionality is available
+  if (typeof Storage !== "undefined") {
+    return (this.options.saveStateLocation === "sessionStorage") ? sessionStorage : localStorage;
+  }
+  else {
+    console.error("ColMrg: No storage support detected. State won't be saved.");
+    return false;
+  }
+};
+
+/**
+ * @method getStorageKey
+ * @return {string}
+ * @private
+ */
+Backgrid.Extension.ColumnManager.prototype.getStorageKey = function () {
+  return (this.options.saveStateKey) ? "backgrid-colmgr-" + this.options.saveStateKey : "backgrid-colmgr";
+};
+
+/**
+ * @method stateUpdateHandler
+ * @return {boolean}
+ * @private
+ */
+Backgrid.Extension.ColumnManager.prototype.stateUpdateHandler = function () {
+  var state = this.getStateFromColumns();
+  return this.setState(state);
+};
+
+/**
+ * @method getStateFromColumn
+ * @return {Array}
+ */
+Backgrid.Extension.ColumnManager.prototype.getStateFromColumns = function() {
+  var self = this;
+
+  // Map state from columns
+  return this.columns.map(function(column) {
+    var columnState = {
+      name: column.get("name")
+    };
+
+    if (self.options.trackVisibility) {
+      columnState.renderable = column.get("renderable");
+    }
+    if (self.options.trackOrder) {
+      columnState.displayOrder = column.get("displayOrder");
+    }
+    if (self.options.trackSize) {
+      columnState.width = column.get("width");
+    }
+    return columnState;
+  });
+};
+
+/**
+ * @method applyStateToColumns
+ * @private
+ */
+Backgrid.Extension.ColumnManager.prototype.applyStateToColumns = function () {
+  var self = this;
+
+  // Loop state
+  var ordered = false;
+  _.each(this.state, function(columnState) {
+    // Find column
+    var column = self.columns.findWhere({
+      name: columnState.name
+    });
+
+    if (_.has(columnState, "renderable")) {
+      column.set("renderable", columnState.renderable);
+    }
+    if (_.has(columnState, "width")) {
+      var oldWidth = column.get("width");
+      column.set("width", columnState.width, {silent: true});
+      if (oldWidth !== columnState.width) {
+        column.trigger("resize", column, columnState.width, oldWidth);
+      }
+    }
+
+    if (_.has(columnState, "displayOrder")) {
+      if (columnState.displayOrder !== column.get("displayOrder")) {
+        ordered = true;
+      }
+      column.set("displayOrder", columnState.displayOrder, {silent: true});
+    }
+  });
+
+  if (ordered) {
+    self.columns.sort();
+    self.columns.trigger("ordered");
+  }
+};
+
+//////////////////////////////////////////////
+/////////////// UI Controls //////////////////
+//////////////////////////////////////////////
+
+/**
+ * A dropdown item view
+ *
+ * @class DropDownItemView
+ * @extends Backbone.View
+ */
+var DropDownItemView = Backbone.View.extend({
+  className: "columnmanager-dropdown-item",
+  tagName: "li",
+
+  /**
+   * @method initialize
+   * @param {object} opts
+   * @param {Backgrid.Extension.ColumnManager} opts.columnManager ColumnManager instance.
+   * @param {Backgrid.Column} opts.column A backgrid column.
+   */
+  initialize: function (opts) {
+    this.columnManager = opts.columnManager;
+    this.column = opts.column;
+    this.template = opts.template;
+
+    _.bindAll(this, "render", "toggleVisibility");
+    this.column.on("change:renderable", this.render, this);
+    this.el.addEventListener("click", this.toggleVisibility, true);
+  },
+
+  /**
+   * @method render
+   * @return {DropDownItemView}
+   */
+  render: function () {
+    this.$el.empty();
+
+    this.$el.append(this.template({
+      label: this.column.get("label")
+    }));
+
+    if (this.column.get("renderable")) {
+      this.$el.addClass((this.column.get("renderable")) ? "visible" : null);
+    }
+    else {
+      this.$el.removeClass("visible");
+    }
+
+    return this;
+  },
+
+  /**
+   * Toggles visibility of column.
+   *
+   * @method toggleVisibility
+   * @param {object} e
+   */
+  toggleVisibility: function (e) {
+    if (e) {
+      this.stopPropagation(e);
+    }
+    this.columnManager.toggleColumnVisibility(this.column);
+  },
+
+  /**
+   * Convenience function to stop event propagation.
+   *
+   * @method stopPropagation
+   * @param {object} e
+   * @private
+   */
+  stopPropagation: function (e) {
+    e.stopPropagation();
+    e.stopImmediatePropagation();
+    e.preventDefault();
+  }
+});
+
+
+/**
+ * Dropdown view container.
+ *
+ * @class DropDownView
+ * @extends Backbone.view
+ */
+var DropDownView = Backbone.View.extend({
+  /**
+   * @property className
+   * @type String
+   * @default "columnmanager-dropdown-container"
+   */
+  className: "columnmanager-dropdown-container",
+
+  /**
+   * @method initialize
+   * @param {object} opts
+   * @param {Backgrid.Extension.ColumnManager} opts.columnManager ColumnManager instance.
+   * @param {Backbone.View} opts.DropdownItemView View to be used for the items.
+   * @param {Function} opts.dropdownItemTemplate
+   */
+  initialize: function (opts) {
+    this.options = opts;
+    this.columnManager = opts.columnManager;
+    this.ItemView = (opts.DropdownItemView instanceof Backbone.View) ? opts.DropdownItemView : DropDownItemView;
+    this.$dropdownButton = opts.$dropdownButton;
+
+    this.on("dropdown:opened", this.open, this);
+    this.on("dropdown:closed", this.close, this);
+    this.columnManager.columns.on("add remove", this.render, this);
+  },
+
+  /**
+   * @method render
+   * @return {DropDownView}
+   */
+  render: function () {
+    var view = this;
+    view.$el.empty();
+
+    // List all columns
+    this.columnManager.columns.each(function (col) {
+      if (!col.get("alwaysVisible")) {
+        view.$el.append(new view.ItemView({
+          column: col,
+          columnManager: view.columnManager,
+          template: view.options.dropdownItemTemplate
+        }).render().el);
+      }
+    });
+
+    return this;
+  },
+
+  /**
+   * Opens the dropdown.
+   *
+   * @method open
+   */
+  open: function () {
+    this.$el.addClass("open");
+
+    // Get button
+    var $button = this.$dropdownButton;
+
+    // Align
+    var align;
+    if (this.options.align === "auto") {
+      // Determine what alignment fits
+      var viewPortWidth = document.body.clientWidth || document.body.clientWidth;
+      align = (($button.offset().left + this.$el.outerWidth()) > viewPortWidth) ? "left" : "right";
+    }
+    else {
+      align = (this.options.align === "left" || this.options.align === "right") ?
+        (this.options.align === "right" ? "right" : "left") : "right";
+    }
+
+    var offset;
+    if (align === "left") {
+      // Align right by default
+      offset = $button.offset().left + $button.outerWidth() - this.$el.outerWidth();
+      this.$el.css("left", offset + "px");
+    }
+    else {
+      offset = $button.offset().left;
+      this.$el.css("left", offset + "px");
+    }
+
+    // Height position
+    var offsetHeight = $button.offset().top + $button.outerHeight();
+    this.$el.css("top", offsetHeight + "px");
+  },
+
+  /**
+   * Closes the dropdown.
+   *
+   * @method close
+   */
+  close: function () {
+    this.$el.removeClass("open");
+  }
+});
+
+/**
+ * UI control which manages visibility of columns.
+ * Inspired by: https://github.com/kjantzer/backbonejs-dropdown-view.
+ *
+ * @class Backgrid.Extension.ColumnManagerVisibilityControl
+ * @extends Backbone.View
+ */
+Backgrid.Extension.ColumnManagerVisibilityControl = Backbone.View.extend({
+  /**
+   * @property tagName
+   * @type String
+   * @default "div"
+   */
+  tagName: "div",
+
+  /**
+   * @property className
+   * @type String
+   * @default "columnmanager-visibilitycontrol"
+   */
+  className: "columnmanager-visibilitycontrol",  
+
+  /**
+   * @property defaultEvents
+   * @type Object
+   */
+  defaultEvents: {
+    "click": "stopPropagation"
+  },
+
+  /**
+   * @property defaultOpts
+   * @type Object
+   */
+  defaultOpts: {
+    width: null,
+    closeOnEsc: true,
+    closeOnClick: true,
+    openOnInit: false,
+    columnManager: null,
+
+    // Button
+    buttonTemplate: _.template("<button class='dropdown-button'>...</button>"),
+
+    // Container
+    DropdownView: DropDownView,
+    dropdownAlign: "auto",
+
+    // Item view
+    DropdownItemView: DropDownItemView,
+    dropdownItemTemplate: _.template("<span class='indicator'></span><span class='column-label'><%= label %></span>")
+  },
+
+  /**
+   * @method initialize
+   * @param {Object} opts
+   * @param {Backgrid.Extension.ColumnManager} opts.columnManager ColumnManager instance
+   */
+  initialize: function (opts) {
+    this.options = _.extend({}, this.defaultOpts, opts);
+    this.events = _.extend({}, this.defaultEvents, this.events || {});
+    this.columnManager = opts.columnManager;
+
+    // Option checking
+    if (!this.columnManager instanceof Backgrid.Extension.ColumnManager) {
+      console.error("Backgrid.ColumnManager: options.columns is not an instance of Backgrid.Columns");
+    }
+
+    // Bind scope to events
+    _.bindAll(this, "deferClose", "stopDeferClose", "closeOnEsc", "toggle", "render");
+
+    // UI events
+    document.body.addEventListener("click", this.deferClose, true);
+    this.el.addEventListener("click", this.stopDeferClose, true);
+    if (this.options.closeOnEsc) {
+      document.body.addEventListener("keyup", this.closeOnEsc, false);
+    }
+    this.el.addEventListener("click", this.toggle, false);
+
+    // Create elements
+    this.setup();
+
+    // Listen for dropdown view events indicating to open and/or close
+    this.view.on("dropdown:close", this.close, this);
+    this.view.on("dropdown:open", this.open, this);
+  },
+
+  /**
+   * @method delayStart
+   * @private
+   */
+  delayStart: function () {
+    clearTimeout(this.closeTimeout);
+    this.delayTimeout = setTimeout(this.open.bind(this), this.options.delay);
+  },
+
+  /**
+   * @method delayEnd
+   * @private
+   */
+  delayEnd: function () {
+    clearTimeout(this.delayTimeout);
+    this.closeTimeout = setTimeout(this.close.bind(this), 300);
+  },
+
+  /**
+   * @method setup
+   * @private
+   */
+  setup: function () {
+    // Override element width
+    if (this.options.width) {
+      this.$el.width(this.options.width + "px");
+    }
+
+    // Create button element
+    this.$dropdownButton = $(this.options.buttonTemplate());
+
+    var viewOptions = {
+      columnManager: this.columnManager,
+      DropdownItemView: this.options.DropdownItemView,
+      dropdownItemTemplate: this.options.dropdownItemTemplate,
+      align: this.options.dropdownAlign,
+      $dropdownButton: this.$dropdownButton
+    };
+
+    // Check if a different childView has been provided, if not, use default dropdown view
+    this.view = (this.options.DropdownView instanceof Backbone.View) ?
+      new this.options.DropdownView(viewOptions) :
+      new DropDownView(viewOptions);
+  },
+
+  /**
+   * @method setup
+   */
+  render: function () {
+    this.$el.empty();
+
+    // Render button
+    this.$el.append(this.$dropdownButton);
+
+    // Render inner view
+    this.view.render(); // tell the inner view to render itself
+    $(document.body).append(this.view.el);
+    return this;
+  },
+
+  /**
+   * Convenience function to stop event propagation
+   *
+   * @method stopPropagation
+   * @param {object} e
+   * @private
+   */
+  stopPropagation: function (e) {
+    e.stopPropagation();
+    e.stopImmediatePropagation();
+    e.preventDefault();
+  },
+
+  /**
+   * Toggle the dropdown visibility
+   *
+   * @method toggle
+   * @param {object} [e]
+   */
+  toggle: function (e) {    
+    if (this.isOpen !== true) {
+      this.open(e);
+    }
+    else {
+      this.close(e);
+    }
+  },
+
+  /**
+   * Open the dropdown
+   *
+   * @method open
+   * @param {object} [e]
+   */
+  open: function (e) {
+    clearTimeout(this.closeTimeout);
+    clearTimeout(this.deferCloseTimeout);
+
+    if (e) {
+      if (e.stopPropagation) {
+        e.stopPropagation();
+      }
+      if (e.preventDefault) {
+        e.preventDefault();
+      }
+      e.cancelBubble = true;
+    }
+
+    // Don't do anything if already open
+    if (this.isOpen) {
+      return;
+    }
+
+    this.isOpen = true;
+    this.$el.addClass("open");
+    this.trigger("dropdown:opened");
+
+    // Notify child view
+    this.view.trigger("dropdown:opened");
+  },
+
+  /**
+   * Close the dropdown
+   *
+   * @method close
+   * @param {object} [e]
+   */
+  close: function (e) {
+    // Don't do anything if already closed
+    if (!this.isOpen) {
+      return;
+    }
+    this.isOpen = false;
+    this.$el.removeClass("open");
+    this.trigger("dropdown:closed");
+
+    // Notify child view
+    this.view.trigger("dropdown:closed");
+  },
+
+  /**
+   * Close the dropdown on esc
+   *
+   * @method closeOnEsc
+   * @param {object} e
+   * @private
+   */
+  closeOnEsc: function (e) {
+    if (e.which === 27) {
+      this.deferClose();
+    }
+  },
+
+  /** 
+   * Close dropdown only if control was not clicked 
+   *
+   * @method deferClose
+   * @private
+   */
+  deferClose: function (e) {    
+    if(this.options.closeOnClick) this.deferCloseTimeout = setTimeout(this.close.bind(this), 0);
+
+    var clickedClassName = e.target.parentElement.classList.item(0);
+    var columnManagerClassPrefix = (clickedClassName) ? clickedClassName.split("-")[0] : "";    
+    var controlClicked = columnManagerClassPrefix === COLUMN_MANAGER_PREFIX;    
+    if(!controlClicked && this.isOpen === true) {
+      this.deferCloseTimeout = setTimeout(this.close.bind(this), 0);
+    } else if(this.className === clickedClassName && this.isOpen === true){
+      this.deferCloseTimeout = setTimeout(this.close.bind(this), 0);
+    }    
+  },
+
+  /**
+   * @method stopDeferClose
+   * @private
+   */
+  stopDeferClose: function (e) {
+    clearTimeout(this.deferCloseTimeout);
+  },
+
+  /**
+   * Clean up this control
+   *
+   * @method remove
+   * @chainable
+   */
+  remove: function () {
+    // Remove event listeners
+    document.body.removeEventListener("click", this.deferClose);
+    this.el.removeEventListener("click", this.stopDeferClose);
+    if (this.options.closeOnEsc) {
+      document.body.removeEventListener("keyup", this.closeOnEsc);
+    }
+    this.el.removeEventListener("click", this.toggle);
+
+    // Remove DOM element
+    $(this.view.el).remove();
+
+    // Invoke original backbone methods
+    return Backbone.View.prototype.remove.apply(this, arguments);
+  }
+});
+
+/**
+ * Backgrid HeaderCell containing ColumnManagerVisibilityControl
+ *
+ * @class Backgrid.Extension.ColumnVisibilityHeaderCell
+ * @extends Backgrid.HeaderCell
+ */
+
+Backgrid.Extension.ColumnManager.ColumnVisibilityHeaderCell = Backgrid.HeaderCell.extend({
+  initialize: function (options) {
+    Backgrid.HeaderCell.prototype.initialize.apply(this, arguments);
+
+    // Add class
+    this.$el.addClass(this.column.get("name"));
+  },
+  render: function () {
+    this.$el.empty();
+
+    // Add control
+    var colVisibilityControl = this.colVisibilityControl = new Backgrid.Extension.ColumnManagerVisibilityControl({
+      columnManager: this.columnManager
+    });
+
+    // Add to header
+    this.$el.html(colVisibilityControl.render().el);
+
+    this.delegateEvents();
+    return this;
+  },
+
+  /**
+   * Clean up this cell.
+   *
+   * @method remove
+   * @chainable
+   */
+  remove: function () {
+    // Remove UI control
+    this.colVisibilityControl.remove();
+
+    // Invoke super
+    /*eslint no-underscore-dangle:0*/
+    return Backgrid.HeaderCell.__super__.remove.apply(this, arguments);
+  }
+});
\ No newline at end of file
diff --git a/security-admin/src/main/webapp/libs/other/backgrid/backgrid.css b/security-admin/src/main/webapp/libs/other/backgrid/backgrid.css
index c90451d..a6bee09 100644
--- a/security-admin/src/main/webapp/libs/other/backgrid/backgrid.css
+++ b/security-admin/src/main/webapp/libs/other/backgrid/backgrid.css
@@ -77,8 +77,11 @@
   background-color: #f9f9f9;
 }
 
-.backgrid thead th a {
+.backgrid thead th button {
   display: block;
+  padding: 0;
+  background: none;
+  border: none;
 }
 
 .backgrid.backgrid-striped tbody tr:nth-child(even) {
diff --git a/security-admin/src/main/webapp/libs/other/backgrid/backgrid.js b/security-admin/src/main/webapp/libs/other/backgrid/backgrid.js
index 8e34334..9830db5 100644
--- a/security-admin/src/main/webapp/libs/other/backgrid/backgrid.js
+++ b/security-admin/src/main/webapp/libs/other/backgrid/backgrid.js
@@ -1,16 +1,9 @@
-/*
-  backgrid
-  http://github.com/wyuenho/backgrid
+/*!
+  backgrid 0.3.8
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2017 Cloudflare, Inc. and contributors <jw...@cloudflare.com>
   Licensed under the MIT license.
-
-
-  Copyright 2009, 2010 Kristopher Michael Kowal
-  https://github.com/kriskowal/es5-shim
-  ES5 15.5.4.20
-  http://es5.github.com/#x15.5.4.20
-  MIT License
 */
 
 (function (root, factory) {
@@ -30,6 +23,18 @@
 
   "use strict";
 
+/*
+  backgrid
+  http://github.com/cloudflare/backgrid
+
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
+  Licensed under the MIT license.
+*/
+
+// Copyright 2009, 2010 Kristopher Michael Kowal
+// https://github.com/kriskowal/es5-shim
+// ES5 15.5.4.20
+// http://es5.github.com/#x15.5.4.20
 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
   "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
   "\u2029\uFEFF";
@@ -169,9 +174,9 @@ _.extend(Command.prototype, {
 
 /*
   backgrid
-  http://github.com/wyuenho/backgrid
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
   Licensed under the MIT license.
 */
 
@@ -274,7 +279,7 @@ _.extend(NumberFormatter.prototype, {
   fromRaw: function (number, model) {
     if (_.isNull(number) || _.isUndefined(number)) return '';
 
-    number = number.toFixed(~~this.decimals);
+    number = parseFloat(number).toFixed(~~this.decimals);
 
     var parts = number.split('.');
     var integerPart = parts[0];
@@ -614,9 +619,9 @@ _.extend(SelectFormatter.prototype, {
 
 /*
   backgrid
-  http://github.com/wyuenho/backgrid
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
   Licensed under the MIT license.
 */
 
@@ -862,9 +867,16 @@ var Cell = Backgrid.Cell = Backbone.View.extend({
                     }
                   });
 
-    if (Backgrid.callByNeed(column.editable(), column, model)) $el.addClass("editable");
-    if (Backgrid.callByNeed(column.sortable(), column, model)) $el.addClass("sortable");
-    if (Backgrid.callByNeed(column.renderable(), column, model)) $el.addClass("renderable");
+    this.updateStateClassesMaybe();
+  },
+
+  updateStateClassesMaybe: function () {
+    var model = this.model;
+    var column = this.column;
+    var $el = this.$el;
+    $el.toggleClass("editable", Backgrid.callByNeed(column.editable(), column, model));
+    $el.toggleClass("sortable", Backgrid.callByNeed(column.sortable(), column, model));
+    $el.toggleClass("renderable", Backgrid.callByNeed(column.renderable(), column, model));
   },
 
   /**
@@ -872,9 +884,13 @@ var Cell = Backgrid.Cell = Backbone.View.extend({
      model's raw value for this cell's column.
   */
   render: function () {
-    this.$el.empty();
+    var $el = this.$el;
+    $el.empty();
     var model = this.model;
-    this.$el.text(this.formatter.fromRaw(model.get(this.column.get("name")), model));
+    var columnName = this.column.get("name");
+    $el.text(this.formatter.fromRaw(model.get(columnName), model));
+    $el.addClass(columnName);
+    this.updateStateClassesMaybe();
     this.delegateEvents();
     return this;
   },
@@ -1397,7 +1413,15 @@ var SelectCellEditor = Backgrid.SelectCellEditor = CellEditor.extend({
   },
 
   /** @property {function(Object, ?Object=): string} template */
-  template: _.template('<option value="<%- value %>" <%= selected ? \'selected="selected"\' : "" %>><%- text %></option>', null, {variable: null}),
+  template: _.template(
+    '<option value="<%- value %>" <%= selected ? \'selected="selected"\' : "" %>><%- text %></option>',
+    null,
+    {
+        variable    : null,
+        evaluate    : /<%([\s\S]+?)%>/g,
+        interpolate : /<%=([\s\S]+?)%>/g,
+        escape      : /<%-([\s\S]+?)%>/g
+    }),
 
   setOptionValues: function (optionValues) {
     this.optionValues = optionValues;
@@ -1640,9 +1664,9 @@ var SelectCell = Backgrid.SelectCell = Cell.extend({
 
 /*
   backgrid
-  http://github.com/wyuenho/backgrid
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
   Licensed under the MIT license.
 */
 
@@ -1695,19 +1719,20 @@ var Column = Backgrid.Column = Backbone.Model.extend({
      this column is sortable. If the value is a string, a method will the same
      name will be looked up from the column instance to determine whether the
      column should be sortable. The method's signature must be `function
-     (Backgrid.Column, Backbone.Model): boolean`.
+     (Backbone.Model): boolean`. The function's context is the column instance.
 
      @cfg {boolean|string|function(): boolean} [defaults.editable=true] Whether
      this column is editable. If the value is a string, a method will the same
      name will be looked up from the column instance to determine whether the
      column should be editable. The method's signature must be `function
-     (Backgrid.Column, Backbone.Model): boolean`.
+     (Backbone.Model): boolean`. The function's context is the column instance.
 
      @cfg {boolean|string|function(): boolean} [defaults.renderable=true]
      Whether this column is renderable. If the value is a string, a method will
      the same name will be looked up from the column instance to determine
      whether the column should be renderable. The method's signature must be
-     `function (Backrid.Column, Backbone.Model): boolean`.
+     `function (Backbone.Model): boolean`. The function's context is the column
+     instance.
 
      @cfg {Backgrid.CellFormatter | Object | string} [defaults.formatter] The
      formatter to use to convert between raw model values and user input.
@@ -1813,24 +1838,33 @@ var Column = Backgrid.Column = Backbone.Model.extend({
   }
 
   /**
+     If you cannot always determine whether a column should be sortable before
+     the grid get initialized, you can override this method.
+
      @member Backgrid.Column
      @protected
      @method sortable
-     @return {function(Backgrid.Column, Backbone.Model): boolean | boolean}
+     @return {function(Backbone.Model): boolean | boolean}
   */
 
   /**
+     If you cannot always determine whether a column should be editable before
+     the grid get initialized, you can override this method.
+
      @member Backgrid.Column
      @protected
      @method editable
-     @return {function(Backgrid.Column, Backbone.Model): boolean | boolean}
+     @return {function(Backbone.Model): boolean | boolean}
   */
 
   /**
+     If you cannot always determine whether a column should be renderable before
+     the grid get initialized, you can override this method.
+
      @member Backgrid.Column
      @protected
      @method renderable
-     @return {function(Backgrid.Column, Backbone.Model): boolean | boolean}
+     @return {function(Backbone.Model): boolean | boolean}
   */
 });
 
@@ -1860,9 +1894,9 @@ var Columns = Backgrid.Columns = Backbone.Collection.extend({
 
 /*
   backgrid
-  http://github.com/wyuenho/backgrid
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
   Licensed under the MIT license.
 */
 
@@ -2009,7 +2043,9 @@ var EmptyRow = Backgrid.EmptyRow = Backbone.View.extend({
 
     var td = document.createElement("td");
     td.setAttribute("colspan", this.columns.length);
-    td.appendChild(document.createTextNode(_.result(this, "emptyText")));
+    var span = document.createElement("span");
+    span.innerHTML = _.result(this, "emptyText");
+    td.appendChild(span);
 
     this.el.className = "empty";
     this.el.appendChild(td);
@@ -2020,9 +2056,9 @@ var EmptyRow = Backgrid.EmptyRow = Backbone.View.extend({
 
 /*
   backgrid
-  http://github.com/wyuenho/backgrid
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
   Licensed under the MIT license.
 */
 
@@ -2041,7 +2077,7 @@ var HeaderCell = Backgrid.HeaderCell = Backbone.View.extend({
 
   /** @property */
   events: {
-    "click a": "onClick"
+    "click button": "onClick"
   },
 
   /**
@@ -2076,12 +2112,12 @@ var HeaderCell = Backgrid.HeaderCell = Backbone.View.extend({
     if (Backgrid.callByNeed(column.sortable(), column, collection)) $el.addClass("sortable");
     if (Backgrid.callByNeed(column.renderable(), column, collection)) $el.addClass("renderable");
 
-    this.listenTo(collection.fullCollection || collection, "sort", this.removeCellDirection);
+    this.listenTo(collection.fullCollection || collection, "backgrid:sorted", this.removeCellDirection);
   },
 
   /**
-     Event handler for the collection's `sort` event. Removes all the CSS
-     direction classes.
+     Event handler for the collection's `backgrid:sorted` event. Removes
+     all the CSS direction classes.
    */
   removeCellDirection: function () {
     this.$el.removeClass("ascending").removeClass("descending");
@@ -2140,7 +2176,7 @@ var HeaderCell = Backgrid.HeaderCell = Backbone.View.extend({
     var sortable = Backgrid.callByNeed(column.sortable(), column, this.collection);
     var label;
     if(sortable){
-      label = $("<a>").text(column.get("label")).append("<b class='sort-caret'></b>");
+      label = $("<button>").text(column.get("label")).append("<span class='sort-caret' aria-hidden='true'></span>");
     } else {
       label = document.createTextNode(column.get("label"));
     }
@@ -2246,9 +2282,9 @@ var Header = Backgrid.Header = Backbone.View.extend({
 
 /*
   backgrid
-  http://github.com/wyuenho/backgrid
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
   Licensed under the MIT license.
 */
 
@@ -2285,7 +2321,7 @@ var Body = Backgrid.Body = Backbone.View.extend({
       this.columns = new Columns(this.columns);
     }
 
-    this.row = options.row || Row;
+    this.row = options.row || this.row || Row;
     this.rows = this.collection.map(function (model) {
       var row = new this.row({
         columns: this.columns,
@@ -2305,14 +2341,19 @@ var Body = Backgrid.Body = Backbone.View.extend({
     this.listenTo(collection, "reset", this.refresh);
     this.listenTo(collection, "backgrid:sort", this.sort);
     this.listenTo(collection, "backgrid:edited", this.moveToNextCell);
+
+    this.listenTo(this.columns, "add remove", this.updateEmptyRow);
   },
 
   _unshiftEmptyRowMayBe: function () {
     if (this.rows.length === 0 && this.emptyText != null) {
-      this.rows.unshift(new EmptyRow({
+      this.emptyRow = new EmptyRow({
         emptyText: this.emptyText,
         columns: this.columns
-      }));
+      });
+
+      this.rows.unshift(this.emptyRow);
+      return true
     }
   },
 
@@ -2400,7 +2441,9 @@ var Body = Backgrid.Body = Backbone.View.extend({
     // removeRow() is called directly
     if (!options) {
       this.collection.remove(model, (options = collection));
-      this._unshiftEmptyRowMayBe();
+      if (this._unshiftEmptyRowMayBe()) {
+        this.render();
+      }
       return;
     }
 
@@ -2409,12 +2452,25 @@ var Body = Backgrid.Body = Backbone.View.extend({
     }
 
     this.rows.splice(options.index, 1);
-    this._unshiftEmptyRowMayBe();
+    if (this._unshiftEmptyRowMayBe()) {
+      this.render();
+    }
 
     return this;
   },
 
   /**
+     Rerender the EmptyRow which empties the DOM element, creates the td with the
+     updated colspan, and appends it back into the DOM
+  */
+
+  updateEmptyRow: function () {
+    if (this.emptyRow != null) {
+      this.emptyRow.render();
+    }
+  },
+
+  /**
      Reinitialize all the rows inside the body and re-render them. Triggers a
      Backbone `backgrid:refresh` event from the collection along with the body
      instance as its sole parameter when done.
@@ -2532,19 +2588,20 @@ var Body = Backgrid.Body = Backbone.View.extend({
         }
         collection.fullCollection.sort();
         collection.trigger("backgrid:sorted", column, direction, collection);
+        column.set("direction", direction);
       }
       else collection.fetch({reset: true, success: function () {
         collection.trigger("backgrid:sorted", column, direction, collection);
+        column.set("direction", direction);
       }});
     }
     else {
       collection.comparator = comparator;
       collection.sort();
       collection.trigger("backgrid:sorted", column, direction, collection);
+      column.set("direction", direction);
     }
 
-    column.set("direction", direction);
-
     return this;
   },
 
@@ -2583,6 +2640,9 @@ var Body = Backgrid.Body = Backbone.View.extend({
     var j = this.columns.indexOf(column);
     var cell, renderable, editable, m, n;
 
+    // return if model being edited in a different grid
+    if (j === -1) return this;
+
     this.rows[i].cells[j].exitEditMode();
 
     if (command.moveUp() || command.moveDown() || command.moveLeft() ||
@@ -2631,9 +2691,9 @@ var Body = Backgrid.Body = Backbone.View.extend({
 
 /*
   backgrid
-  http://github.com/wyuenho/backgrid
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
   Licensed under the MIT license.
 */
 
@@ -2671,9 +2731,9 @@ var Footer = Backgrid.Footer = Backbone.View.extend({
 
 /*
   backgrid
-  http://github.com/wyuenho/backgrid
+  http://github.com/cloudflare/backgrid
 
-  Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
+  Copyright (c) 2013-present Cloudflare, Inc. and contributors
   Licensed under the MIT license.
 */
 
@@ -2747,6 +2807,7 @@ var Grid = Backgrid.Grid = Backbone.View.extend({
      @param {Object} options
      @param {Backbone.Collection.<Backgrid.Columns>|Array.<Backgrid.Column>|Array.<Object>} options.columns Column metadata.
      @param {Backbone.Collection} options.collection The collection of tabular model data to display.
+     @param {string} [options.caption=string] An optional caption to be added to the table.
      @param {Backgrid.Header} [options.header=Backgrid.Header] An optional Header class to override the default.
      @param {Backgrid.Body} [options.body=Backgrid.Body] An optional Body class to override the default.
      @param {Backgrid.Row} [options.row=Backgrid.Row] An optional Row class to override the default.
@@ -2759,6 +2820,8 @@ var Grid = Backgrid.Grid = Backbone.View.extend({
       options.columns = new Columns(options.columns || this.columns);
     }
     this.columns = options.columns;
+    
+    this.caption = options.caption;
 
     var filteredOptions = _.omit(options, ["el", "id", "attributes",
                                            "className", "tagName", "events"]);
@@ -2838,12 +2901,16 @@ var Grid = Backgrid.Grid = Backbone.View.extend({
   },
 
   /**
-     Renders the grid's header, then footer, then finally the body. Triggers a
+     Renders the grid's caption, then header, then footer, then finally the body. Triggers a
      Backbone `backgrid:rendered` event along with a reference to the grid when
      the it has successfully been rendered.
    */
   render: function () {
     this.$el.empty();
+    
+    if (this.caption) {
+      this.$el.append($("<caption>").text(this.caption));
+    }
 
     if (this.header) {
       this.$el.append(this.header.render().$el);
diff --git a/security-admin/src/main/webapp/scripts/Init.js b/security-admin/src/main/webapp/scripts/Init.js
index e8e7875..aa970be 100644
--- a/security-admin/src/main/webapp/scripts/Init.js
+++ b/security-admin/src/main/webapp/scripts/Init.js
@@ -92,6 +92,9 @@ require.config({
         'daterangepicker': {
             deps: ['jquery', 'bootstrap', 'moment', 'momentTz']
         },
+        'Backgrid.ColumnManager' : {
+            deps: ['backbone', 'backgrid', 'underscore', 'jquery']
+        },
     },
 
     paths: {
@@ -140,7 +143,8 @@ require.config({
         'i18nprecompile': '../libs/bower/require-handlebars-plugin/js/i18nprecompile',
         'hbs': '../libs/bower/require-handlebars-plugin/js/hbs',
         'esprima': '../libs/bower/esprima/esprima',
-        'tmpl': '../templates'
+        'tmpl': '../templates',
+        'Backgrid.ColumnManager': '../libs/other/backgrid-column-manager/Backgrid.ColumnManager.min',
     },
 
     hbs: {
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index 8d0f9e1..600a0fe 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -1893,5 +1893,18 @@ define(function(require) {
     	return urlHash.indexOf("?") !== -1 ? urlHash.substring(urlHash.indexOf("?") + 1) : undefined;
     }
 
+    XAUtils.resizeableColumn = function (self, columnName) {
+        self.rTableList.$el.find('.'+columnName).resizable({
+            maxHeight : 20,
+            stop: function (event, ui) {
+                ui.element.css('min-width', ui.size.width);
+                localStorage.setItem(columnName+'ColWidth', ui.size.width);
+            }
+        });
+        if(localStorage.getItem(columnName+'ColWidth') !== null) {
+            self.rTableList.$el.find('.'+columnName).css('min-width', +localStorage.getItem(columnName+'ColWidth'));
+        }
+    }
+
 	return XAUtils;
 });
\ No newline at end of file
diff --git a/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js b/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js
index 58f5a73..49ebf66 100644
--- a/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/common/XATableLayout.js
@@ -33,6 +33,7 @@ define(function(require){
 
 	require('backgrid-filter');
 	require('backgrid-paginator');
+	require('Backgrid.ColumnManager');
 
 	var XATableLayout = Backbone.Marionette.Layout.extend(
 	/** @lends XATableLayout */
@@ -56,6 +57,16 @@ define(function(require){
 			emptyText : 'No Records found!'
 		},
 
+		columnManagerOpts: {
+            opts: {
+                // State settings
+                saveState: true,
+                loadStateOnInit: true
+            },
+            visibilityControlOpts: {},
+            el: null
+        },
+
 		filterOpts : {
 			placeholder: localization.tt('plcHldr.searchByResourcePath'),
 			wait: 150
@@ -102,8 +113,8 @@ define(function(require){
 			 * }
 			 *
 			 */
-			_.extend(this, _.pick(options,	'collection', 'columns', 'includePagination', 
-											'includeHeaderSearch', 'includeFilter' ,'scrollToTop', 'paginationCache'));
+			_.extend(this, _.pick(options,	'collection', 'columns', 'includePagination', 'columnManagerOpts',
+											'includeHeaderSearch', 'includeFilter' ,'scrollToTop', 'paginationCache', 'backgridColumnManager'));
 
 			_.extend(this.gridOpts, options.gridOpts, { collection : this.collection, columns : this.columns } );
 			_.extend(this.filterOpts, options.filterOpts);
@@ -137,13 +148,33 @@ define(function(require){
 			if(this.includePagination) {
 				this.renderPagination();
 			}
-			/*if(this.includeFilter){
-				this.renderFilter();
-			}*/
 		},
 
 		/** all post render plugin initialization */
 		initializePlugins: function(){
+			if (this.backgridColumnManager) {
+				this.includeColumnManager()
+			}
+		},
+
+		includeColumnManager : function() {
+			var that = this;
+			var $el = this.columnManagerOpts.el
+			// Create column collection
+			this.columns = new Backgrid.Columns(this.columns);
+			var colManager = new Backgrid.Extension.ColumnManager(this.columns, this.columnManagerOpts.opts);
+			var colVisibilityControl = new Backgrid.Extension.ColumnManagerVisibilityControl(_.extend({
+                columnManager: colManager,
+            }, this.columnManagerOpts.visibilityControlOpts));
+            if (!$el.jquery) {
+                $el = $($el)
+            }
+            if (this.columnManagerOpts.el) {
+                $el.html(colVisibilityControl.render().el);
+            } else {
+                $el.append(colVisibilityControl.render().el);
+            }
+			this.gridOpts.columns = this.columns;
 		},
 
         getGridObj : function(){
@@ -155,7 +186,8 @@ define(function(require){
 
 		renderTable : function(){
 			var that = this;
-			this.rTableList.show(new Backgrid.Grid(this.gridOpts));
+			this.grid = new Backgrid.Grid(this.gridOpts);
+			this.rTableList.show(this.grid);
 		},
 		renderPagination : function(){
 			this.rPagination.show(new Backgrid.Extension.Paginator({
diff --git a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
index a068ad8..0f8315b 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -54,6 +54,7 @@ define(function(require) {
 	require('bootstrap-datepicker');
 	require('Backbone.BootstrapModal');
 	require('visualsearch');
+	require('Backgrid.ColumnManager');
 	
 	var AuditLayout = Backbone.Marionette.Layout.extend(
 	/** @lends AuditLayout */
@@ -101,6 +102,7 @@ define(function(require) {
             excludeServiceUser : '[data-id="excludeServiceUser"]',
             serviceUsersExclude:'[data-id="serviceUsersExclude"]',
             showPageDetail:'[data-id="showPageDetail"]',
+            colManager: "[data-id='colManager']",
 		},
 
 		/** ui events hash */
@@ -193,6 +195,7 @@ define(function(require) {
 		},
 		/** on render callback */
 		onRender : function() {
+			var that = this;
 			this.ui.tab.find('[href="'+this.currentTab+'"]').addClass('active');
 			if(this.currentTab != '#bigData'){
 				this.onTabChange();
@@ -209,32 +212,11 @@ define(function(require) {
                 }
 				this.renderBigDataTable();
 				this.addSearchForBigDataTab();
-				this.modifyTableForSubcolumns();
+				XAUtils.resizeableColumn(this, 'resourceType');
 			}
 			this.showTagsAttributes();
 
 		},
-		modifyTableForSubcolumns : function(){
-			this.$el.find('[data-id="r_tableList"] table thead').prepend('<tr>\
-					<th class="renderable pid"></th>\
-					<th class="renderable cip"></th>\
-					<th class="renderable ruser"></th>\
-					<th class="renderable ruser"></th>\
-					<th class="renderable cip"></th>\
-					<th class="renderable cip">Service</th>\
-					<th class="renderable name">Resource</th>\
-					<th class="renderable cip"></th>\
-					<th class="renderable cip"></th>\
-					<th class="renderable cip"></th>\
-					<th class="renderable cip"> </th>\
-					<th class="renderable aip" > </th>\
-					<th class="renderable aip" > </th>\
-					<th class="renderable aip" > </th>\
-					<th class="renderable ruser"></th>\
-                                        <th class="renderable ruser"></th>\
-                                        <th class="renderable ruser"></th>\
-                    </tr>');
-		},
 		modifyPluginStatusTableSubcolumns : function(){
 			this.$el.find('[data-id="r_tableList"] table thead').prepend('<tr>\
 					<th class="renderable pid"></th>\
@@ -277,12 +259,13 @@ define(function(require) {
 					this.ui.visualSearch.show();
 					this.ui.visualSearch.parents('.well').show();
 					this.renderBigDataTable();
-					this.modifyTableForSubcolumns();
 					this.addSearchForBigDataTab();
+					XAUtils.resizeableColumn(this, 'resourceType');
                     this.listenTo(this.accessAuditList, "request", that.updateLastRefresh);
                     this.ui.iconSearchInfo.show();
                     this.showTagsAttributes();
                     this.ui.excludeServiceUser.show();
+                    this.ui.colManager.show();
 					break;
 				case "#admin":
 					this.currentTab = '#admin';
@@ -303,6 +286,7 @@ define(function(require) {
                     this.ui.iconSearchInfo.hide();
                     $('.popover').remove();
                     this.ui.excludeServiceUser.hide();
+                    this.ui.colManager.hide();
 					break;
 				case "#loginSession":
 					this.currentTab = '#loginSession';
@@ -327,6 +311,7 @@ define(function(require) {
                     this.ui.iconSearchInfo.hide();
                     $('.popover').remove();
                     this.ui.excludeServiceUser.hide();
+                    this.ui.colManager.hide();
 					break;
 				case "#agent":
 					this.currentTab = '#agent';
@@ -352,6 +337,7 @@ define(function(require) {
                     this.ui.iconSearchInfo.hide();
                     $('.popover').remove();
                     this.ui.excludeServiceUser.hide();
+                    this.ui.colManager.hide();
 					break;
 				case "#pluginStatus":
 					 this.currentTab = '#pluginStatus';
@@ -378,6 +364,7 @@ define(function(require) {
 					 this.ui.iconSearchInfo.hide();
                      $('.popover').remove();
                      this.ui.excludeServiceUser.hide();
+                     this.ui.colManager.hide();
 					 break;
                 case "#userSync":
                      this.currentTab = '#userSync';
@@ -399,6 +386,7 @@ define(function(require) {
                      this.listenTo(this.userSyncAuditList, "sync reset", that.showPageDetail);
                      this.ui.iconSearchInfo.hide();
                      this.ui.excludeServiceUser.hide();
+                     this.ui.colManager.hide();
                      break;
 			}
 			var lastUpdateTime = Globalize.format(new Date(),  "MM/dd/yyyy hh:mm:ss tt");
@@ -1228,11 +1216,23 @@ define(function(require) {
 				columns: this.getColumns(),
 				collection: this.accessAuditList,
 				includeFilter : false,
+				backgridColumnManager: true,
 				gridOpts : {
 					row: TableRow,
 					header : XABackgrid,
 					emptyText : 'No Access Audit found!'
-				}
+				},
+				columnManagerOpts: {
+                    opts: {
+                        // initialColumnsVisible: null,
+                        saveState: true,
+                        loadStateOnInit: true,
+                    },
+                    visibilityControlOpts: {
+                        buttonTemplate: _.template("<span class='btn btn-sm'>&nbspColumns&nbsp<i class='fa fa-caret-down'></i></span>")
+                    },
+                    el: this.ui.colManager
+                },
 			}));
             XAUtils.backgridSort(this.accessAuditList);
 		},
@@ -1310,7 +1310,7 @@ define(function(require) {
                         sortable : false,
 					},
 					repoName : {
-						label : 'Name / Type',
+						label : 'Service (Name / Type)',
 						cell: "html",
 						click : false,
 						drag : false,
@@ -1324,7 +1324,7 @@ define(function(require) {
 						})
 					},
 					resourceType: {
-						label : 'Name / Type',
+						label : 'Resource (Name / Type)',
 						cell: "html",
 						click: false,
 						formatter: _.extend({},Backgrid.CellFormatter.prototype,{
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index 3c7a7b8..2e2ca76 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -2406,6 +2406,10 @@ textarea:read-only{
   margin-left:10px;
 }
 
+.m-l-xsm {
+  margin-left : 5px;
+}
+
 .m-r-sm{
   margin-right: 10px;
 }
@@ -4502,7 +4506,10 @@ input.textFiledInputPadding:disabled {
     margin-left:750px;
   }
 }
-/*[fieldclass="resorces-css"] .control-label {
+
+.backgrid th:not(.renderable), .backgrid td:not(.renderable){
+    display: none;
+}/*[fieldclass="resorces-css"] .control-label {
   margin-top: 0px;
   margin-right: -15px
 }*/
diff --git a/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html b/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
index 63d0188..c52c28b 100644
--- a/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
@@ -48,23 +48,28 @@
         </div>
     </div>
     <div class="row">
-        <div class="col-md-12" data-id="refreshTable">
-            <button class="btn-right link-tag" data-id="refresh" style="margin-top: -3px;" title="Refresh">
-                <i class="fa-fw fa fa-refresh"></i>
-            </button>
+        <div class="col-md-4">
+            <div data-id="excludeServiceUser">
+                <span>Exclude Service Users:</span>
+                <input type="checkbox" data-id="serviceUsersExclude" style="vertical-align: middle;">
+            </div>
+        </div>
+        <div class="col-md-8 m-b-sm">
             <div class="text-right">
-                <span class="pull-right" data-id="lastUpdateTime">Last Updated Time: <label data-id="lastUpdateTimeLabel" class="badge badge-info">{{currentDate}}</label> </span>
-                <span class="pull-right"> &nbsp;|&nbsp; </span>
-                <span class="pull-right">Entries:
+                <span class="m-l-xsm" data-id="lastUpdateTime">Last Updated Time: <label data-id="lastUpdateTimeLabel" class="badge badge-info">{{currentDate}}</label> </span>
+                <span class="m-l-xsm"> &nbsp;|&nbsp; </span>
+                <span class="m-l-xsm">Entries:
                     <label class="badge badge-info" data-id="showPageDetail"></label>
                 </span>
-                <div class="pull-left" data-id="excludeServiceUser">
-                    <span>Exclude Service Users:</span>
-                    <input type="checkbox" data-id="serviceUsersExclude" style="vertical-align: middle;">
+                <button class="link-tag m-l-xsm" data-id="refresh" style="margin-top: -3px;" title="Refresh">
+                    <i class="fa-fw fa fa-refresh"></i>
+                </button>
+                <div class="inline-block m-l-xsm" data-id="colManager">
+                    <div class="columnmanager-visibilitycontrol"></div>
                 </div>
             </div>
         </div>
-      </div>
+    </div>
         <div class="row">
           <div class="col-md-12">
             <div data-id="r_tableLists" class=""></div>