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 2017/09/18 12:36:43 UTC
ranger git commit: RANGER-1682: Clicking on export service after
session timeout gets stuck indefinitely.
Repository: ranger
Updated Branches:
refs/heads/master dbc84c18a -> 7d4f652c8
RANGER-1682: Clicking on export service after session timeout gets stuck indefinitely.
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/7d4f652c
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/7d4f652c
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/7d4f652c
Branch: refs/heads/master
Commit: 7d4f652c8cfa12e5bad7b28049bdd85ba37e14ad
Parents: dbc84c1
Author: Nitin Galave <ni...@gmail.com>
Authored: Thu Sep 14 17:45:59 2017 +0530
Committer: Mehul Parikh <me...@apache.org>
Committed: Mon Sep 18 18:05:14 2017 +0530
----------------------------------------------------------------------
security-admin/src/main/webapp/login.jsp | 5 +++++
.../src/main/webapp/scripts/models/RangerServiceDef.js | 8 ++++++++
.../src/main/webapp/scripts/models/XABaseModel.js | 4 ++--
security-admin/src/main/webapp/scripts/utils/XAUtils.js | 6 ++++--
.../main/webapp/scripts/views/DownloadServicePolicy.js | 4 ++++
.../main/webapp/scripts/views/UploadServicePolicy.js | 12 ++++++++----
.../src/main/webapp/scripts/views/kms/KMSTableLayout.js | 9 +++++++++
.../scripts/views/permissions/ModulePermissionForm.js | 3 ++-
.../webapp/scripts/views/policies/PermissionList.js | 8 ++++++++
.../webapp/scripts/views/policies/RangerPolicyRO.js | 9 ++++++++-
.../webapp/scripts/views/policymanager/ServiceLayout.js | 2 +-
.../main/webapp/scripts/views/reports/AuditLayout.js | 9 ++++++++-
.../main/webapp/scripts/views/service/ServiceCreate.js | 3 +++
.../src/main/webapp/scripts/views/user/UserProfile.js | 8 +++++++-
14 files changed, 77 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/login.jsp
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/login.jsp b/security-admin/src/main/webapp/login.jsp
index 39fb327..b8f4cb9 100644
--- a/security-admin/src/main/webapp/login.jsp
+++ b/security-admin/src/main/webapp/login.jsp
@@ -44,6 +44,11 @@
});
};
$(window).resize(updateBoxPosition);
+ var queryParams = JSON.parse('{"' + decodeURI((location.href.split('?')[1] || 'g=0').replace(/=/g, "\":\"")) + '"}');
+ if(queryParams.sessionTimeout){
+ window.alert('Session Timeout');
+ location.replace("login.jsp");
+ }
setTimeout(updateBoxPosition, 50);
});
</script>
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js b/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
index 56411b4..4b9a06a 100644
--- a/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
+++ b/security-admin/src/main/webapp/scripts/models/RangerServiceDef.js
@@ -106,6 +106,14 @@ define(function(require){
return {results : results};
}
return {results : results};
+ },
+ transport : function (options) {
+ $.ajax(options).error(function(respones) {
+ XAUtils.defaultErrorHandler('error',respones);
+ this.success({
+ resultSize : 0
+ });
+ });
}
},
formatResult : function(result){
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/models/XABaseModel.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/models/XABaseModel.js b/security-admin/src/main/webapp/scripts/models/XABaseModel.js
index 6083210..cb0691c 100644
--- a/security-admin/src/main/webapp/scripts/models/XABaseModel.js
+++ b/security-admin/src/main/webapp/scripts/models/XABaseModel.js
@@ -41,9 +41,9 @@ define(function(require){
},
bindErrorEvents :function(){
//Moved require inside fuctn expression due to ie issue
- this.bind("error", function(e){
+ this.bind("error", function(e, error){
var XAUtils = require('utils/XAUtils');
- XAUtils.defaultErrorHandler(undefined, e);
+ XAUtils.defaultErrorHandler(undefined, error, e);
});
},
/**
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/utils/XAUtils.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/utils/XAUtils.js b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
index 1979847..ecf43ad 100644
--- a/security-admin/src/main/webapp/scripts/utils/XAUtils.js
+++ b/security-admin/src/main/webapp/scripts/utils/XAUtils.js
@@ -617,7 +617,9 @@ define(function(require) {
XAUtils.defaultErrorHandler = function(model, error) {
var App = require('App');
var vError = require('views/common/ErrorView');
- if(!_.isUndefined(model) && !_.isUndefined(model.modelName) && model.modelName == XAEnums.ClassTypes.CLASS_TYPE_XA_ACCESS_AUDIT.modelName){
+ if(!_.isUndefined(model) && !_.isUndefined(model.modelName)
+ && model.modelName == XAEnums.ClassTypes.CLASS_TYPE_XA_ACCESS_AUDIT.modelName
+ && error.status !== 419){
return;
}
if (error.status == 404) {
@@ -629,7 +631,7 @@ define(function(require) {
status : error.status
}));
} else if (error.status == 419) {
- window.location = 'login.jsp'
+ window.location = 'login.jsp?sessionTimeout=true';
}
};
XAUtils.select2Focus = function(event) {
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js b/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js
index fb10562..1b1a4aa 100644
--- a/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js
+++ b/security-admin/src/main/webapp/scripts/views/DownloadServicePolicy.js
@@ -80,6 +80,10 @@ define(function(require){
}
},
+ error : function(data,status,response){
+ XAUtil.blockUI('unblock');
+ XAUtil.defaultErrorHandler(status,data);
+ },
});
},
onRender: function() {
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js b/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js
index 338fffb..62a1fcf 100644
--- a/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js
+++ b/security-admin/src/main/webapp/scripts/views/UploadServicePolicy.js
@@ -207,11 +207,15 @@ define(function(require){
error : function(response,model){
XAUtil.blockUI('unblock');
if ( response && response.responseJSON && response.responseJSON.msgDesc){
- XAUtil.notifyError('Error', response.responseJSON.msgDesc);
- } else {
+ if(response.status == '419'){
+ XAUtil.defaultErrorHandler(model,response);
+ }else{
+ XAUtil.notifyError('Error', response.responseJSON.msgDesc);
+ }
+ } else {
XAUtil.notifyError('Error', 'File import failed.');
- }
- }
+ }
+ }
});
},
onAddClick : function(){
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
index fbbee46..2749cea 100755
--- a/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/kms/KMSTableLayout.js
@@ -266,6 +266,7 @@ define(function(require){
this.ui.selectServiceName.select2({
maximumSelectionSize : 1,
closeOnSelect : true,
+ allowClear: true,
width :'220px',
placeholder : 'Please select KMS service',
initSelection : function (element, callback) {
@@ -284,6 +285,14 @@ define(function(require){
return { results : results };
}
return { results : results };
+ },
+ transport: function (options) {
+ $.ajax(options).error(function(respones) {
+ XAUtil.defaultErrorHandler('error',respones);
+ this.success({
+ resultSize : 0
+ });
+ });
}
},
formatResult : function(result){
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
index aa4c332..d9c522c 100644
--- a/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
+++ b/security-admin/src/main/webapp/scripts/views/permissions/ModulePermissionForm.js
@@ -178,8 +178,9 @@ define(function(require) {
return { results : results};
},
transport: function (options) {
- $.ajax(options).error(function() {
+ $.ajax(options).error(function(respones) {
console.log("ajax failed");
+ XAUtil.defaultErrorHandler('error',respones);
this.success({
resultSize : 0
});
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
index bb64984..0803945 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/PermissionList.js
@@ -223,6 +223,14 @@ define(function(require) {
return {results : results};
}
return {results : results};
+ },
+ transport: function (options) {
+ $.ajax(options).error(function(respones) {
+ XAUtil.defaultErrorHandler('error',respones);
+ this.success({
+ resultSize : 0
+ });
+ });
}
},
formatResult : function(result){
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
index 3011f1e..a01350b 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js
@@ -83,7 +83,14 @@ define(function(require) {
this.policy.fetchByEventTime({
async: false,
cache: false,
- data : data
+ data : data,
+ error : function(error , response){
+ if (response && response.status === 419 ) {
+ XAUtils.defaultErrorHandler(error , response);
+ } else {
+ XAUtils.showErrorMsg(response.responseJSON.msgDesc);
+ }
+ }
});
},
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js b/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
index c551887..ab42b5c 100644
--- a/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/policymanager/ServiceLayout.js
@@ -231,7 +231,7 @@ define(function(require){
},
error :function(model, response) {
XAUtil.blockUI('unblock');
- if(!_.isUndefined(response) && !_.isUndefined(response.responseJSON) && !_.isUndefined(response.responseJSON.msgDesc)){
+ if(!_.isUndefined(response) && !_.isUndefined(response.responseJSON) && !_.isUndefined(response.responseJSON.msgDesc && response.status !='419')){
XAUtil.notifyError('Error', response.responseJSON.msgDesc);
}
}
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
----------------------------------------------------------------------
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 aecaf95..76a8aa5 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -619,7 +619,14 @@ define(function(require) {
var fullTrxLogListForTrxId = new VXTrxLogList();
fullTrxLogListForTrxId.getFullTrxLogListForTrxId(this.model.get('transactionId'),{
- cache : false
+ cache : false,
+ error : function(response , error){
+ if (response && response.status === 419 ) {
+ XAUtils.defaultErrorHandler(error , response);
+ } else {
+ XAUtils.showErrorMsg(response.responseJSON.msgDesc);
+ }
+ }
}).done(function(coll,mm){
XAUtils.blockUI('unblock');
fullTrxLogListForTrxId = new VXTrxLogList(coll.vXTrxLogs);
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js b/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
index c2b78ab..54444fb 100644
--- a/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/service/ServiceCreate.js
@@ -238,6 +238,9 @@ define(function(require){
}
},
error: function (msResponse, options) {
+ if(msResponse.status === 419){
+ XAUtil.defaultErrorHandler(options , msResponse);
+ }
bootbox.alert("Connection Failed.");
}
});
http://git-wip-us.apache.org/repos/asf/ranger/blob/7d4f652c/security-admin/src/main/webapp/scripts/views/user/UserProfile.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/user/UserProfile.js b/security-admin/src/main/webapp/scripts/views/user/UserProfile.js
index cac80a8..8e60b53 100644
--- a/security-admin/src/main/webapp/scripts/views/user/UserProfile.js
+++ b/security-admin/src/main/webapp/scripts/views/user/UserProfile.js
@@ -140,7 +140,11 @@ define(function(require){
that.form.fields.name.setError(response.responseJSON.msgDesc);
XAUtil.notifyError('Error', response.responseJSON.msgDesc);
}else {
- XAUtil.notifyError('Error', 'Error occurred while updating user profile!!');
+ if(model.status == 419){
+ XAUtil.defaultErrorHandler(response , model);
+ }else{
+ XAUtil.notifyError('Error', 'Error occurred while updating user profile!!');
+ }
}
}
});
@@ -168,6 +172,8 @@ define(function(require){
that.form.fields.reEnterPassword.setError(localization.tt('validationMessages.newPasswordError'));
}else if((msResponse.responseJSON.msgDesc) == "serverMsg.userMgrOldPassword"){
that.form.fields.oldPassword.setError(localization.tt('validationMessages.oldPasswordRepeatError'));
+ }else if(msResponse.status == 419){
+ XAUtil.defaultErrorHandler(options , msResponse);
} else {
that.form.fields.oldPassword.setError(localization.tt('validationMessages.oldPasswordError'));
}