You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ve...@apache.org on 2016/12/01 04:23:59 UTC

incubator-ranger git commit: RANGER-1230 : Policy versions in use for each Ranger plugin

Repository: incubator-ranger
Updated Branches:
  refs/heads/master e3a4d80b0 -> 2465befca


RANGER-1230 : Policy versions in use for each Ranger plugin

Signed-off-by: Velmurugan Periasamy <ve...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/2465befc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/2465befc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/2465befc

Branch: refs/heads/master
Commit: 2465befcaf594c91e9c0124209d3137db04fe476
Parents: e3a4d80
Author: Gautam Borad <ga...@apache.org>
Authored: Tue Nov 29 14:58:04 2016 +0530
Committer: Velmurugan Periasamy <ve...@apache.org>
Committed: Wed Nov 30 23:23:50 2016 -0500

----------------------------------------------------------------------
 .../scripts/modules/globalize/message/en.js     |  71 +++----
 .../views/policies/RangerPolicyCreate.js        |  21 --
 .../webapp/scripts/views/reports/AuditLayout.js | 190 +++++++++++++++++--
 security-admin/src/main/webapp/styles/xa.css    |   4 +-
 .../templates/reports/AuditLayout_tmpl.html     |   3 +
 5 files changed, 219 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2465befc/security-admin/src/main/webapp/scripts/modules/globalize/message/en.js
----------------------------------------------------------------------
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 72f10a3..99a5424 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
@@ -234,7 +234,10 @@ define(function(require) {
 				selectDataMaskTypes				: 'Select Data Mask Types',
 				accessTypes						: 'Access Types',
 				rowLevelFilter					: 'Row Level Filter',
-				selectMaskingOption				: 'Select Masking Option'
+				selectMaskingOption             : 'Select Masking Option',
+				versionTime                     : 'Version / Time',
+				serviceType                     : 'Service Type',
+				hostName						: 'Host Name'
 			},
 			btn : {
 				add							: 'Add',
@@ -302,24 +305,25 @@ define(function(require) {
 				searchForKeys				:"Search for your keys...",
 				encryption					: 'Encryption',
 				settings					: 'Settings',
-                                serviceNameMsg              :'Name of service.',
-                                serviceTypeMsg              :'Select type of service.',
-                                startDate                   :'Set start date.',
-                                userMsg                     :'Name of User.',
-                                tagsMsg                     :'Tag Name.',
-                                endDate                     :'Set end date.',
-                                groupNameMsg                :'Name of Group.',
-                                collection                  :'Solr collection.',
-                                database                    :'Hive database.',
-                                entity                      :'Atlas all-entity.',
-                                operation                   :'Atlas all-operation.',
-                                path                        :'Name of policy resource.',
-                                queue                       :'Yarn queue.',
-                                taxonomy                    :'Atlas all-taxonomy.',
-                                term                        :'Policy for all-term.',
-                                topic                       :'Kafka topic.',
-                                type                        :'Policy for all type.',
-                                udf                         :'Hive udf.',
+                serviceNameMsg              :'Name of service.',
+                serviceTypeMsg              :'Select type of service.',
+                startDate                   :'Set start date.',
+                userMsg                     :'Name of User.',
+                tagsMsg                     :'Tag Name.',
+                endDate                     :'Set end date.',
+                groupNameMsg                :'Name of Group.',
+                collection                  :'Solr collection.',
+                database                    :'Hive database.',
+                entity                      :'Atlas all-entity.',
+                operation                   :'Atlas all-operation.',
+                path                        :'Name of policy resource.',
+                queue                       :'Yarn queue.',
+                taxonomy                    :'Atlas all-taxonomy.',
+                term                        :'Policy for all-term.',
+                topic                       :'Kafka topic.',
+                type                        :'Policy for all type.',
+                udf                         :'Hive udf.',
+                pluginStatus                :'Plugin Status'
                         },
 			msg : {
 				deletePolicyValidationMsg : 'Policy does not have any settings for the specific resource. Policy will be deleted. Press [Ok] to continue. Press [Cancel] to edit the policy.',
@@ -355,20 +359,21 @@ define(function(require) {
 				grpUpdatedSucc            : 'Group updated successfully',
 				grpCreatedSucc            : 'Group created successfully',
 				errorLoadingAuditLogs	  : 'Unable to connect to Audit store !!',
-                                enterCustomMask			  : 'Please enter custom masked value or expression !!',
-                                    policyNameMsg         :'Enter name of policy.',
-                                        policyTypeMsg         :'Select Type of policy eg. access, masking, row level filter policies.',
-                                        componentMsg          :'Select Hadoop Component eg. HDFS, Hive etc.',
-                                        searchBy              :'Search by user name or group name.',
-                                        resourceMsg           :'Enter name of resource for eg. path, table/column name etc.',
-                                        accessEnforcer        :'Search by access enforcer name.',
-                                        accessTypeMsg         : 'Access type like READ_EXECUTE, WRITE_EXECUTE.',
-                                        clientIP              :'Search by IP address from where resource was accessed.',
-                                        resourceName          :'Resource name.',
-                                        resourceTypeMsg       :'Search by resource type based on component. eg. path in HDFS, database,table in Hive.',
-                                        resultMsg             :'Search by access result i.e Allowed/Denied logs.',
-                                        statusMsg             :'Status of Policy Enable/Disable.',
-                                        columnfamily          :'Hbase column-family',
+                enterCustomMask			  : 'Please enter custom masked value or expression !!',
+                policyNameMsg           :'Enter name of policy.',
+                policyTypeMsg           :'Select Type of policy eg. access, masking, row level filter policies.'    ,
+                componentMsg            :'Select Hadoop Component eg. HDFS, Hive etc.',
+                searchBy                :'Search by user name or group name.',
+                resourceMsg             :'Enter name of resource for eg. path, table/column name etc.',
+                accessEnforcer          :'Search by access enforcer name.',
+                accessTypeMsg           :'Access type like READ_EXECUTE, WRITE_EXECUTE.',
+                clientIP                :'Search by IP address from where resource was accessed.',
+                resourceName            :'Resource name.',
+                resourceTypeMsg         :'Search by resource type based on component. eg. path in HDFS, database    ,table in Hive.',
+                resultMsg               :'Search by access result i.e Allowed/Denied logs.',
+                statusMsg               :'Status of Policy Enable/Disable.',
+                columnfamily            :'Hbase column-family',
+                searchForPluginStatus   : "Search for Plugin Status...."
 
 			},
 			plcHldr : {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2465befc/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
index 52c4e53..8dc3485 100644
--- a/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/policies/RangerPolicyCreate.js
@@ -108,27 +108,6 @@ define(function(require){
 				cache : false,
 				async : false
 			});
-//			if(this.rangerServiceDefModel.get('name') == "hive"){
-//				this.rangerServiceDefModel.set("dataMaskDef",{ "accessTypes": [ { "name": "select" } ], 
-//					"resources": [ 
-//					               { "lookupSupported" :true, "name": "database", "matcherOptions": { "wildCard": "false" }, "uiHint":"{ \"singleValue\":true }" }, 
-//					               { "name": "table", "matcherOptions": { "wildCard": "false" }, "uiHint":"{ \"singleValue\":true }" }, 
-//					               { "name": "column", "matcherOptions": { "wildCard": "false" }, "uiHint":"{ \"singleValue\":true }" }
-//					               ],
-//					 "maskTypes": [ { "itemId": 1, "name": "MASK", "label": "Mask", "description": "Replace lowercase with 'x', uppercase with 'X', digits with '0'", "dataMaskOptions": { } }, { "itemId": 2, "name": "SHUFFLE", "label": "Shuffle", "description": "Shuffle the value of the column", "dataMaskOptions": { } }, { "itemId": 3, "name": "MASK_x_SHOW_LAST_4", "label": "Partial mask: show last 4", "description": "Show last 4 characters; replace rest with 'x'", "dataMaskOptions": { } }, { "itemId": 4, "name": "MASK_x_SHOW_FIRST_4", "label": "Partial mask: show first 4", "description": "Show first 4 characters; replace rest with 'x'", "dataMaskOptions": { } }, { "itemId": 10, "name": "NULL", "label": "NULL", "description": "Replace with NULL", "dataMaskOptions": { } } ] });
-//				
-//				this.rangerServiceDefModel.set("rowFilterDef", 
-//						{ 
-//							"accessTypes":[
-//							               {"name":"select","label":"Select"}
-//							               ],
-//							"resources":[
-//							             {"name":"database","matcherOptions":{"wildCard":false}},
-//							             {"name":"table","matcherOptions":{"wildCard":false}}
-//							             ]
-//					    });
-//			}
-			
 		},
 
 		/** all events binding here */

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2465befc/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 744c7ac..bf00a7e 100644
--- a/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
+++ b/security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js
@@ -180,6 +180,18 @@ define(function(require) {
 					<th class="renderable ruser"></th>\
 				</tr>');
 		},
+		modifyPluginStatusTableSubcolumns : function(){
+			this.$el.find('[data-id="r_tableList"] table thead').prepend('<tr>\
+					<th class="renderable pid"></th>\
+					<th class="renderable ruser"></th>\
+					<th class="renderable ruser"></th>\
+					<th class="renderable ruser"></th>\
+					<th class="renderable cip">Policy Active</th>\
+					<th class="renderable name">Policy Download</th>\
+					<th class="renderable cip">Tag Active</th>\
+					<th class="renderable cip">Tag Download</th>\
+			 	</tr>');
+		},
 		renderDateFields : function(){
 			var that = this;
 
@@ -253,7 +265,20 @@ define(function(require) {
 					this.addSearchForAgentTab();
 					this.listenTo(this.policyExportAuditList, "request", that.updateLastRefresh)
                                         this.ui.iconSearchInfo.hide();
-					break;	
+					break;
+				case "#pluginStatus":
+					 this.currentTab = '#pluginStatus';
+					 this.ui.visualSearch.show();
+					 this.pluginInfoList = new VXPolicyExportAuditList();
+					 this.renderPluginInfotable();
+					 this.modifyPluginStatusTableSubcolumns();
+					 //To use existing collection
+					 this.pluginInfoList.url = 'service/plugins/plugins/info';
+					 this.pluginInfoList.modelAttrName = 'pluginInfoList';
+					 this.pluginInfoList.fetch({cache : false});
+					 this.addSearchForPluginStatusTab();
+					 this.ui.iconSearchInfo.hide();
+					 break;
 			}
 			var lastUpdateTime = Globalize.format(new Date(),  "MM/dd/yyyy hh:mm:ss tt");
 			that.ui.lastUpdateTimeLabel.html(lastUpdateTime);
@@ -523,6 +548,19 @@ define(function(require) {
 				};
 			this.visualSearch = XAUtils.addVisualSearch(searchOpt,serverAttrName, this.policyExportAuditList, pluginAttr);
 		},
+		addSearchForPluginStatusTab : function(){
+			var that = this;
+			var searchOpt = [localization.tt("lbl.serviceName"), localization.tt("lbl.serviceType"),
+			                 localization.tt("lbl.agentIp"), localization.tt("lbl.hostName")];
+			var serverAttrName  = [{text : localization.tt("lbl.serviceName"), label :"serviceName"},{text : localization.tt("lbl.serviceType"), label :"pluginAppType"},
+			                       {text : localization.tt("lbl.agentIp"), label :"pluginIpAddress"}, {text : localization.tt("lbl.hostName"), label :"pluginHostName"}];
+			var pluginAttr = {
+					placeholder    : localization.tt('msg.searchForPluginStatus'),
+					container         : this.ui.visualSearch,
+					query             : '',
+			}
+			this.visualSearch = XAUtils.addVisualSearch(searchOpt, serverAttrName, this.pluginInfoList, pluginAttr);
+		},
 		renderAdminTable : function(){
 			var that = this , self = this;
 			
@@ -1122,6 +1160,124 @@ define(function(require) {
 			};
 			return this.policyExportAuditList.constructor.getTableCols(cols, this.policyExportAuditList);
 		},
+		renderPluginInfotable : function(){
+			this.ui.tableList.removeClass("clickable");
+			this.rTableList.show(new XATableLayout({
+				columns: this.getPluginInfoColums(),
+				collection: this.pluginInfoList,
+				includeFilter : false,
+				gridOpts : {
+					row : 	Backgrid.Row.extend({}),
+					header : XABackgrid,
+						emptyText : 'No plugin found!'
+				}
+			}));	
+		},
+		getPluginInfoColums : function(){
+			var that = this, cols ={
+				serviceName : {
+					cell 	: 'string',
+					label	: localization.tt("lbl.serviceName"),
+					editable:false,
+					sortable:false
+				},
+				appType : {
+					cell : 'string',
+					label	: localization.tt("lbl.serviceType"),
+					editable:false,
+					sortable:false
+				},
+				hostName : {
+					cell : 'html',
+					label	: localization.tt("lbl.hostName"),
+					editable:false,
+					sortable:false,
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue, model) {
+							rawValue = _.escape(rawValue);
+							return '<span title="'+rawValue+'">'+rawValue+'</span>';
+						}
+					}),
+				},
+				ipAddress : {
+					cell 	: 'string',
+					label	: localization.tt("lbl.agentIp"),
+					editable:false,
+					sortable:false
+				},
+				policyActive: {
+					cell 	: 'html',
+					label	: localization.tt("lbl.versionTime"),
+					editable:false,
+					sortable:false,
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue, model) {
+							if(_.isUndefined(model.get('info').policyActiveVersion)
+									|| _.isNull(model.get('info').policyActiveVersion)){
+								return '<center>--</center>';
+							}	
+							return that.getPluginInfoCell(model,'policyActiveVersion','policyActivationTime','label-success');
+							       
+						}
+					})
+				},
+									
+				policyDownloaded : {
+					cell 	: 'html',
+					label	: localization.tt("lbl.versionTime"),
+					editable:false,
+					sortable:false,
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue, model) {
+							if(_.isUndefined(model.get('info').policyDownloadedVersion)
+									|| _.isNull(model.get('info').policyDownloadedVersion)){
+								return '<center>--</center>';
+							}
+							return that.getPluginInfoCell(model,'policyDownloadedVersion','policyDownloadTime','label-inverse');
+						}
+					})
+				},
+				
+				tagActive : {
+					cell 	: 'html',
+					label	: localization.tt("lbl.versionTime"),
+					editable:false,
+					sortable:false,
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue, model) {
+							if(_.isUndefined(model.get('info').tagActiveVersion)
+									|| _.isNull(model.get('info').tagActiveVersion)){
+								return '<center>--</center>';
+							}
+							return that.getPluginInfoCell(model,'tagActiveVersion','tagActivationTime','label-success');
+						}
+					})
+				}, 
+				
+				tagDownloaded : {
+					cell 	: 'html',
+					label	:localization.tt("lbl.versionTime"),
+					editable:false,
+					sortable:false,
+					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+						fromRaw: function (rawValue, model) {
+							if(_.isUndefined(model.get('info').tagDownloadedVersion)
+									|| _.isNull(model.get('info').tagDownloadedVersion)){
+								return '<center>--</center>';
+							}
+							return that.getPluginInfoCell(model,'tagDownloadedVersion','tagDownloadTime','label-inverse');
+						}
+					})
+				},
+			}
+			return this.pluginInfoList.constructor.getTableCols(cols, this.pluginInfoList);
+	
+		},
+		getPluginInfoCell : function(model, versionAttr, timeAttr, klass){
+			return '<center><div><label class="label '+klass+'">'+model.get('info')[versionAttr]+
+			'</label></div>\  <div " style="border-top: 1px solid #ddd;">'
+			+Globalize.format(new Date(parseInt(model.get('info')[timeAttr])),  "MM/dd/yyyy hh:mm:ss tt")+'</div></center>'
+		},
 		onRefresh : function(){
 			var that =this, coll,params = {};
 			var lastUpdateTime = Globalize.format(new Date(),  "MM/dd/yyyy hh:mm:ss tt");
@@ -1140,7 +1296,10 @@ define(function(require) {
 				//TODO
 				params = { 'priAcctId' : 1 };
 				coll = this.policyExportAuditList;
-				break;	
+				break;
+			case "#pluginStatus":
+				coll = this.pluginInfoList;
+				break;
 			}
 			coll.fetch({
 				reset : true,
@@ -1172,18 +1331,21 @@ define(function(require) {
 		},
 		setCurrentTabCollection : function(){
 			switch (this.currentTab) {
-			case "#admin":
-				this.collection = this.trxLogList;
-				break;
-			case "#bigData":
-				this.collection = this.accessAuditList;
-				break;
-			case "#loginSession":
-				this.collection = this.authSessionList;
-				break;
-			case "#agent":
-				this.collection = this.policyExportAuditList;
-				break;
+				case "#admin":
+					this.collection = this.trxLogList;
+					break;
+				case "#bigData":
+					this.collection = this.accessAuditList;
+					break;
+				case "#loginSession":
+					this.collection = this.authSessionList;
+					break;
+				case "#agent":
+					this.collection = this.policyExportAuditList;
+					break;
+				case "#pluginStatus":
+					this.collection = this.pluginInfoList;
+					break;
 			}
 		},
 		clearVisualSearch : function(collection, serverAttrNameList) {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2465befc/security-admin/src/main/webapp/styles/xa.css
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/styles/xa.css b/security-admin/src/main/webapp/styles/xa.css
index d99a172..264e0ea 100644
--- a/security-admin/src/main/webapp/styles/xa.css
+++ b/security-admin/src/main/webapp/styles/xa.css
@@ -1581,8 +1581,8 @@ background-color: #dc6343;
   display: inline-block;
   margin-right: 3px;
 }
-table.table.backgrid thead th.repoName { 
- border-top: 1px solid #ddd;
+table.table.backgrid thead th.repoName, .policyActive, .policyDownloaded, .tagActive, .tagDownloaded { 
+ border-top: 1px solid #ddd !important;
 }
 table.table.backgrid thead th.resourceType {
  border-top: 1px solid #ddd;

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2465befc/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
----------------------------------------------------------------------
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 854b47a..028fdbf 100644
--- a/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
+++ b/security-admin/src/main/webapp/templates/reports/AuditLayout_tmpl.html
@@ -15,6 +15,9 @@
   limitations under the License.
 --}}
 <ul class="nav nav-tabs tabs clearfix">
+   <li data-js="pluginStatus">
+     <a data-toggle="tab" href="#pluginStatus">{{tt 'h.pluginStatus'}}</a> 
+   </li> 
 	<li data-js="agent" >
      <a data-toggle="tab" href="#agent">{{tt 'h.agents'}}</a> 
    </li>