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 2019/09/10 11:12:46 UTC

[ranger] branch master updated: RANGER-2554 : Log out message for Ranger needs to be more informative on Knox enabled cluster

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

ni3galave 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 0e8831d  RANGER-2554 : Log out message for Ranger needs to be more informative on Knox enabled cluster
0e8831d is described below

commit 0e8831d5da5daba52c67cac24b314cc982d288c6
Author: Nitin Galave <ni...@apache.org>
AuthorDate: Thu Aug 29 20:44:29 2019 +0530

    RANGER-2554 : Log out message for Ranger needs to be more informative on Knox enabled cluster
---
 .../webapp/scripts/modules/globalize/message/en.js |  9 ++-
 .../main/webapp/scripts/views/common/ErrorView.js  | 64 +++++++++--------
 .../main/webapp/scripts/views/common/ProfileBar.js |  5 +-
 security-admin/src/main/webapp/styles/xa.css       | 80 ++++++++++------------
 .../webapp/templates/common/ErrorView_tmpl.html    | 30 +++++---
 5 files changed, 104 insertions(+), 84 deletions(-)

diff --git a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
index 4096020..1695769 100644
--- a/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
+++ b/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
@@ -476,7 +476,14 @@ define(function(require) {
                 noDeleteRoleRow         :'Please select ranger role first to delete.',
                 addRolePermission       : 'Please add permission(s) for the selected role, else role will not be added.',
                 addRole                 : 'Please select role for the selected permission(s), else role will not be added.',
-                addSelectedUserGroupRoles : 'Please add selected user/group/roles to there respective table else user/group/roles will not be added.'
+                addSelectedUserGroupRoles : 'Please add selected user/group/roles to there respective table else user/group/roles will not be added.',
+                accessDenied            : 'Sorry, you don\'t have enough privileges to view this page.',
+                noContent               : 'Sorry, Please sync-up the users with your source directory.',
+                signOutIsNotComplete    : 'Authentication to this instance of Ranger is managed externally(for example,Apache Knox). \
+                                        You can still open this instance of Ranger from the same web browser without re-authentication. \
+                                        To prevent additional access to Ranger, <b>close all browser windows and exit the browser</b>.',
+                pageNotFound            : 'Sorry, this page isn\'t here or has moved.'
+
 
 			},
 			plcHldr : {
diff --git a/security-admin/src/main/webapp/scripts/views/common/ErrorView.js b/security-admin/src/main/webapp/scripts/views/common/ErrorView.js
index 4f8f463..f0a60ad 100644
--- a/security-admin/src/main/webapp/scripts/views/common/ErrorView.js
+++ b/security-admin/src/main/webapp/scripts/views/common/ErrorView.js
@@ -23,6 +23,7 @@ define(function(require){
 
 	var Backbone		= require('backbone');
 	var Communicator	= require('communicator');
+	var localization	= require('utils/XALangSupport');
 	
 	var ErrorView_tmpl = require('hbs!tmpl/common/ErrorView_tmpl'); 
 	
@@ -31,29 +32,17 @@ define(function(require){
 	{
 		_viewName : ErrorView,
 		
-    	template: ErrorView_tmpl,
-        templateHelpers :function(){
-        	var msg = '', moreInfo = '';
-        	if(this.status == 401){
-        		msg = 'Access Denied (401)'
-            	moreInfo = "Sorry, you don't have enough privileges to view this page.";
-        	} else if(this.status == 204){
-        		msg = 'No Content (204)'
-                moreInfo = "Sorry, Please sync-up the users with your source directory.";
-            } else {
-        		msg = 'Page not found (404).'
-            	moreInfo = "Sorry, this page isn't here or has moved.";
-            }
-        	return {
-        		'msg' : msg,
-        		'moreInfo' : moreInfo
-        	};
-        },
-    	/** ui selector cache */
-    	ui: {
-    		'goBackBtn' : 'a[data-id="goBack"]',
-    		'home' 		: 'a[data-id="home"]'
-    	},
+		template: ErrorView_tmpl,
+
+		templateHelpers :function(){ },
+
+		/** ui selector cache */
+		ui: {
+			'goBackBtn' : 'a[data-id="goBack"]',
+			'home' 		: 'a[data-id="home"]',
+			'msg'		: '[data-id="msg"]',
+			'moreInfo'		: '[data-id="moreInfo"]',
+		},
 
 		/** ui events hash */
 		events: function() {
@@ -63,7 +52,7 @@ define(function(require){
 			return events;
 		},
 
-    	/**
+		/**
 		* intialize a new ErrorView ItemView 
 		* @constructs
 		*/
@@ -85,10 +74,29 @@ define(function(require){
 		onRender: function() {
 			this.initializePlugins();
 			$('#r_breadcrumbs').hide();
-			 if(this.status == 204){
-				 this.ui.goBackBtn.hide();
-				 this.ui.home.hide();
-			 }
+			var msg = '', moreInfo = '';
+			if(this.status == 401){
+				msg = 'Access Denied (401)';
+				moreInfo =  localization.tt("msg.accessDenied");
+			} else if(this.status == 204){
+				msg = 'No Content (204)'
+				moreInfo = localization.tt("msg.noContent");
+			} else if(this.status == "checkSSOTrue"){
+				msg = 'Sign Out Is Not Complete!'
+				moreInfo = localization.tt("msg.signOutIsNotComplete");
+			} else {
+				msg = 'Page not found (404).'
+				moreInfo = localization.tt("msg.pageNotFound");
+			}
+			this.ui.msg.html(msg);
+			this.ui.moreInfo.html(moreInfo);
+			if(this.status == 204){
+				this.ui.goBackBtn.hide();
+				this.ui.home.hide();
+			}
+			if(this.status == "checkSSOTrue") {
+				this.ui.home.hide();
+			}
 		},
 		goBackClick : function(){
 			history.back();
diff --git a/security-admin/src/main/webapp/scripts/views/common/ProfileBar.js b/security-admin/src/main/webapp/scripts/views/common/ProfileBar.js
index 4a8aed5..ed7777a 100644
--- a/security-admin/src/main/webapp/scripts/views/common/ProfileBar.js
+++ b/security-admin/src/main/webapp/scripts/views/common/ProfileBar.js
@@ -25,6 +25,7 @@ define(function(require){
     var Backbone		= require('backbone');
 	var Communicator	= require('communicator');
 	var SessionMgr 		= require('mgrs/SessionMgr');
+	var vError 			= require('views/common/ErrorView');
 	
 	var ProfileBar_tmpl = require('hbs!tmpl/common/ProfileBar_tmpl'); 
 	
@@ -66,7 +67,9 @@ define(function(require){
 						if(checksso == 'false'){
 							window.location.replace('locallogin');
 						}else{
-							window.location.replace('');
+							App.rContent.show(new vError({
+								status : "checkSSOTrue"
+							}));
 						}
 					} else {
 						window.location.replace('login.jsp');
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index 2081afe..3968636 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -1389,49 +1389,6 @@ ul.tabs > li > a {
   left: 100%;
   margin-left: 0.5em;
 }
-
-.error-page{
-  margin-top: 0px;
-  background: #fff;
-  height: 160px;
-  margin: 30px auto 0 auto;
-  padding-left: 190px;
-  width: 540px;
-  -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.1);
-  -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.1);
-  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
-  -webkit-box-sizing: border-box;
-  -moz-box-sizing: border-box;
-  box-sizing: border-box;
-}
-.error-page .icon-box {
-  background: #f9f9f9;
-  border-right: 1px solid #eaeaea;
-  height: 160px;
-  margin-left: -190px;
-  position: absolute;
-  width: 160px;
-}
-
-.error-page .icon-box img {
-  display: block;
-  margin: 40px auto 0 auto;
-}
-.error-page .error-box h1 {
-  display: block;
-  font-size: 19px;
-  font-weight: 600;
-  line-height: 20px;
-  margin: 0;
-  padding: 35px 0 0 0;
-}
-.error-page .error-box p {
-  color: #888;
-  font-size: 14px;
-  line-height: 14px;
-  margin: 0;
-  padding: 10px 0 20px 0;
-}
 .table-license tbody tr td:first-child{
   width: 15%;
 }
@@ -2436,6 +2393,10 @@ textarea:read-only{
   margin-top:5px;
 }
 
+.m-t-sm{
+  margin-top:10px;
+}
+
 .m-r-xs{
   margin-right:5px;
 }
@@ -2817,3 +2778,36 @@ div#zoneServiceAccordion table thead {
 .row.clear-seconds .span6:nth-child(2n+3) {
     clear: left;
 }
+
+.new-error-page{
+  height: calc(100vh - 200px);
+  display: flex;
+  width: 100%;
+  justify-content: center;
+  /*align-items: center;*/
+  margin-top: 6%;
+}
+
+.new-error-box{
+  display: table;
+  max-width: 40%;
+  min-width: 450px;
+}
+
+.error-white-bg{
+  background-color: white;
+}
+
+.new-icon-box,
+.new-description-box {
+  display: table-cell;
+  vertical-align: middle;
+  padding: 20px;
+  color: #888;
+}
+
+.new-icon-box{
+  width: 60px;
+  text-align: center;
+  border-right: 1px solid #ddd;
+}
\ No newline at end of file
diff --git a/security-admin/src/main/webapp/templates/common/ErrorView_tmpl.html b/security-admin/src/main/webapp/templates/common/ErrorView_tmpl.html
index e565903..3a744c3 100644
--- a/security-admin/src/main/webapp/templates/common/ErrorView_tmpl.html
+++ b/security-admin/src/main/webapp/templates/common/ErrorView_tmpl.html
@@ -15,14 +15,22 @@
   limitations under the License.
 --}}
 
-<div data-id="pageNotFoundPage" class="error-page">
-<div class="error-box" style="margin-top: 0px;">
-		<div class="icon-box"><img src="images/error-404-icon.png"></div>
-
-		<h1>{{msg}}</h1>
-		<p>{{moreInfo}}</p>
-
-		<a href="javascript:;" class="btn btn-primary btn-small" data-id="goBack"><i class="icon-long-arrow-left"></i> Go back</a>&nbsp;&nbsp;
-		<a href="#!/policymanager/resource" class="btn btn-small" data-id="home">Home</a>
-</div>
-</div>
+<div data-id="pageNotFoundPage" class="new-error-page">
+    <div class="new-error-box">
+        <div class="error-white-bg">
+            <div class="new-icon-box">
+                <img src="images/error-404-icon.png" style="margin-top:5px">
+            </div>
+            <div class="new-description-box">
+                <h4 class="m-t-xs m-b-xs" data-id="msg"></h4>
+                <div data-id="moreInfo"></div>
+            </div>
+        </div>
+        <div class="m-t-xs">
+            <a href="javascript:;" class="btn btn-primary btn-small" data-id="goBack">
+                <i class="icon-long-arrow-left"></i> Go back
+            </a>
+            <a href="#!/policymanager/resource" class="btn btn-small" data-id="home">Home</a>
+        </div>
+    </div>
+</div>
\ No newline at end of file