You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ni...@apache.org on 2020/09/16 15:18:23 UTC

[ranger] branch ranger-2.2 updated: RANGER-2995 : Add 'exclude service users' option in URL param

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

ni3galave pushed a commit to branch ranger-2.2
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.2 by this push:
     new bf7f3b2  RANGER-2995 : Add 'exclude service users' option in URL param
bf7f3b2 is described below

commit bf7f3b26895845f3726a1bc8e0f5f2db5a9544a3
Author: Nitin Galave <ni...@apache.org>
AuthorDate: Wed Sep 16 17:06:18 2020 +0530

    RANGER-2995 : Add 'exclude service users' option in URL param
---
 security-admin/src/main/webapp/scripts/utils/XAUtils.js    |  5 +++++
 .../src/main/webapp/scripts/views/reports/AuditLayout.js   | 14 +++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index 2769594..8d0f9e1 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -832,6 +832,11 @@ define(function(require) {
                     collection.state.order == 1 ? sortparams['sortType'] = "descending" : sortparams['sortType'] = "ascending";
                     urlLabelParam = _.extend(urlLabelParam, sortparams)
                 }
+                //set excludeServiceUser value to url
+                if(!_.isUndefined(collection.queryParams) && _.has(collection.queryParams, 'excludeServiceUser')) {
+                    var sortparams = _.pick(collection.queryParams, 'excludeServiceUser');
+                    urlLabelParam = _.extend(urlLabelParam, sortparams)
+                }
             }
             XAUtils.changeParamToUrlFragment(urlLabelParam, collection.modelName);
 			collection.fetch({
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 043d725..16b70f4 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -142,8 +142,11 @@ define(function(require) {
             if(!_.isUndefined(this.urlQueryParams)) {
                 App.vsHistory[that.tab.split('?')[0]] = [];
                 var searchFregment = XAUtils.changeUrlToSearchQuery(decodeURIComponent(this.urlQueryParams));
+                if (this.urlQueryParams && _.has(searchFregment, 'excludeServiceUser')) {
+                    App.excludeServiceUser = searchFregment.excludeServiceUser == "true";
+                }
                 _.map (searchFregment, function(val, key) {
-                    if (key !== "sortBy" && key !== "sortType" && key !== "sortKey") {
+                    if (key !== "sortBy" && key !== "sortType" && key !== "sortKey" && key !== "excludeServiceUser") {
                         if (_.isArray(val)) {
                             _.map(val, function (v) {
                                 App.vsHistory[that.tab.split('?')[0]].push(new Backbone.Model( {'category': key, 'value' : v}));
@@ -545,10 +548,8 @@ define(function(require) {
 					}
                 }
 			};
-            if(App.excludeServiceUser){
-                this.accessAuditList.queryParams.excludeServiceUser = true;
-                this.ui.serviceUsersExclude.prop('checked', true);
-            }
+            this.accessAuditList.queryParams.excludeServiceUser = App.excludeServiceUser || false;
+            this.ui.serviceUsersExclude.prop('checked', App.excludeServiceUser || false);
             this.visualSearch = XAUtils.addVisualSearch(searchOpt,serverAttrName, this.accessAuditList, pluginAttr);
             this.setEventsToFacets(this.visualSearch, App.vsHistory.bigData);
         },
@@ -2251,6 +2252,9 @@ define(function(require) {
                 App.excludeServiceUser = e.currentTarget.checked;
                 this.accessAuditList.state.currentPage = this.accessAuditList.state.firstPage;
                 XAUtils.blockUI();
+                var urlParams = XAUtils.changeUrlToSearchQuery(decodeURIComponent(XAUtils.urlQueryParams()))
+                urlParams['excludeServiceUser'] = e.currentTarget.checked;
+                XAUtils.changeParamToUrlFragment(urlParams);
                 this.accessAuditList.fetch({
                     reset : true,
                     cache : false,