Ejemplo n.º 1
0
				error: function (msResponse, options) {
					console.log("error occured during updated user profile: "+localization.tt(msResponse.responseJSON.msgDesc));
					if(!localization.tt(msResponse.responseJSON.msgDesc) == "Invalid new password"){
						that.fields.oldPassword.setError(localization.tt('validationMessages.oldPasswordError'));
						XAUtil.notifyInfo('',localization.tt('msg.myProfileError'));
					}
				}	
		getPermHeaders : function(){
			var permList = [];
			if(this.rangerServiceDefModel.get('name') != XAEnums.ServiceType.SERVICE_TAG.label){
				if(XAUtil.isAccessPolicy(this.rangerPolicyType)){
					permList.unshift(localization.tt('lbl.delegatedAdmin'));
				}
				if(XAUtil.isRowFilterPolicy(this.rangerPolicyType)){
					permList.unshift(localization.tt('lbl.rowLevelFilter'));
					permList.unshift(localization.tt('lbl.accessTypes'));
				}else if(XAUtil.isMaskingPolicy(this.rangerPolicyType)){
					permList.unshift(localization.tt('lbl.selectDataMaskTypes'));
					permList.unshift(localization.tt('lbl.accessTypes'));
				}else{
					permList.unshift(localization.tt('lbl.permissions'));
				}
			} else {
				permList.unshift(localization.tt('lbl.componentPermissions'));
			}
			
			if(!_.isEmpty(this.rangerServiceDefModel.get('policyConditions'))){
				permList.unshift(localization.tt('h.policyCondition'));
			}
			permList.unshift(localization.tt('lbl.selectUser'));
			permList.unshift(localization.tt('lbl.selectGroup'));
			permList.push("");
			return permList;
		},
		getColumns : function(){
			var that = this;
			var cols = {
				module : {
					cell : "uri",
					reName : 'module',
					href: function(model){
						return '#!/permissions/'+model.id+'/edit';
					},
					label	: localization.tt("lbl.permissions"),
					editable: false,
					sortable : false
				},
				groupPermList : {
					reName : 'groupPermList',
					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
					label : localization.tt("lbl.group"),
					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
						fromRaw: function (rawValue, model) {
							if(!_.isUndefined(rawValue)){
								return XAUtil.showGroupsOrUsers(rawValue,model,'groups');
							}else{
								return '--';
							}
						}
					}),
					editable : false,
					sortable : false
				},
				//Hack for backgrid plugin doesn't allow to have same column name
				userPermList : {
					reName : 'userPermList',
					cell	: Backgrid.HtmlCell.extend({className: 'cellWidth-1'}),
					label : localization.tt("lbl.users"),
					formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
						fromRaw: function (rawValue, model) {
							if(!_.isUndefined(rawValue))
								return XAUtil.showGroupsOrUsers(rawValue, model, 'users');
							else
								return '--';
						}
					}),
					editable : false,
					sortable : false
				},
			};
			cols['permissions'] = {
				cell :  "html",
				label : localization.tt("lbl.action"),
				formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
					fromRaw: function (rawValue,model) {
						return '<a href="#!/permissions/'+model.id+'/edit" class="btn btn-mini" title="Edit"><i class="icon-edit icon-large" /></a>';
					}
				}),
				editable: false,
				sortable : false

			};
			return this.collection.constructor.getTableCols(cols, this.collection);
		},
		addVisualSearch : function(){
			var coll,placeholder;
			var searchOpt = [], serverAttrName = [];
			if(this.showUsers){
				placeholder = localization.tt('h.searchForYourUser');	
				coll = this.collection;
				searchOpt = ['User Name','Email Address','Visibility', 'Role','User Source'];//,'Start Date','End Date','Today'];
				var userRoleList = _.map(XAEnums.UserRoles,function(obj,key){return {label:obj.label,value:key};});
				serverAttrName  = [	{text : "User Name", label :"name"},
									{text : "Email Address", label :"emailAddress"},
				                   {text : "Role", label :"userRoleList", 'multiple' : true, 'optionsArr' : userRoleList},
				                   	{text : "Visibility", label :"isVisible", 'multiple' : true, 'optionsArr' : XAUtil.enumToSelectLabelValuePairs(XAEnums.VisibilityStatus)},
				                   {text : "User Source", label :"userSource", 'multiple' : true, 'optionsArr' : XAUtil.enumToSelectLabelValuePairs(XAEnums.UserTypes)},
								];
			}else{
				placeholder = localization.tt('h.searchForYourGroup');
				coll = this.groupList;
				searchOpt = ['Group Name','Group Source', 'Visibility'];//,'Start Date','End Date','Today'];
				serverAttrName  = [{text : "Group Name", label :"name"},
				                   {text : "Visibility", label :"isVisible", 'multiple' : true, 'optionsArr' : XAUtil.enumToSelectLabelValuePairs(XAEnums.VisibilityStatus)},
				                   {text : "Group Source", label :"groupSource", 'multiple' : true, 'optionsArr' : XAUtil.enumToSelectLabelValuePairs(XAEnums.GroupTypes)},];

			}
			var query = (!_.isUndefined(coll.VSQuery)) ? coll.VSQuery : '';
			var pluginAttr = {
				      placeholder :placeholder,
				      container : this.ui.visualSearch,
				      query     : query,
				      callbacks :  { 
				    	  valueMatches :function(facet, searchTerm, callback) {
								switch (facet) {
									case 'Role':
										callback(XAUtil.hackForVSLabelValuePairs(XAEnums.UserRoles));
										break;
									case 'User Source':
										callback(XAUtil.hackForVSLabelValuePairs(XAEnums.UserTypes));
										break;	
									case 'Group Source':
										callback(XAUtil.hackForVSLabelValuePairs(XAEnums.GroupTypes));
										break;		
									case 'Visibility':
										callback(XAUtil.hackForVSLabelValuePairs(XAEnums.VisibilityStatus));
										break;
									/*case 'Start Date' :
										setTimeout(function () { XAUtil.displayDatepicker(that.ui.visualSearch, callback); }, 0);
										break;
									case 'End Date' :
										setTimeout(function () { XAUtil.displayDatepicker(that.ui.visualSearch, callback); }, 0);
										break;
									case 'Today'	:
										var today = Globalize.format(new Date(),"yyyy/mm/dd");
										callback([today]);
										break;*/
								}     
			            	
							}
				      }
				};
			XAUtil.addVisualSearch(searchOpt,serverAttrName, coll,pluginAttr);
		},
Ejemplo n.º 5
0
	XAUtils.preventNavigationHandler = function(e, msg, $form) {
		var formChanged = false;
		var target = this;
		if (!_.isUndefined($form))
			formChanged = $form.find('.dirtyField').length > 0 ? true : false;
		if (!$(e.currentTarget).hasClass("_allowNav") && formChanged) {

			e.preventDefault();
			e.stopImmediatePropagation();
			bootbox.dialog(msg, [ {
				"label" : localization.tt('btn.stayOnPage'),
				"class" : "btn-success btn-small",
				"callback" : function() {
				}
			}, {
				"label" : localization.tt('btn.leavePage'),
				"class" : "btn-danger btn-small",
				"callback" : function() {
					XAUtils.allowNavigation();
					target.click();
				}
			} ]);
			return false;
		}
	};
Ejemplo n.º 6
0
			_.each(configs, function(obj, index) {
				var value = resourceObj[obj.name];
				if(_.isUndefined(value)){
					return;
				}
				var resource = {};
				resource.label = obj.label;
				resource.values = value.values;
				resource.isSupport = false;
				if(obj.excludesSupported){
					resource.isSupport = true;
					if(value.isExcludes){
						resource.exBool = false;
						resource.exLabel = localization.tt('h.exclude')
					}else{
						resource.exBool = true;
						resource.exLabel = localization.tt('h.include')
					}
				}else if(obj.recursiveSupported){
					resource.isSupport = true;
					if(value.isRecursive){
						resource.exBool = true;
						resource.exLabel = localization.tt('h.recursive')
					}else{
						resource.exBool = fasle;
						resource.exLabel = localization.tt('h.nonRecursive')
					}
				}
				resources.push(resource);
			});
Ejemplo n.º 7
0
					formatNoMatches : function(term){
						switch (type){
							case  that.type.TOPOLOGY :return localization.tt("msg.enterAlteastOneCharactere");
							case  that.type.SERVICE :return localization.tt("msg.enterAlteastOneCharactere");
							default : return "No Matches found";
						}
					}
Ejemplo n.º 8
0
		schema :function(){
			var that = this;
			//var plugginAttr = this.getPlugginAttr(true);
			
			return {
				policyName : {
					   type 		: 'Text',
					   title		: localization.tt("lbl.policyName"),
//					   validators  	: [{'type' :'required'}]
					   editorAttrs 	:{ maxlength: 255}
				},
				topologies : {
					type		: 'Select2Remote',
					title		: localization.tt("lbl.selectTopologyName")+' *',
					editorAttrs :{'data-placeholder': 'Select Topology'},
					validators  : ['required'],//,{type:'regexp',regexp:/^[a-zA-Z*?][a-zA-Z0-9_'&-/\$]*[A-Za-z0-9]*$/i,message :localization.tt('validationMessages.enterValidName')}],
					pluginAttr  : this.getPlugginAttr(true,this.type.TOPOLOGY),
	                options    : function(callback, editor){
	                    callback();
	                },
	                onFocusOpen : true

					
				},
				/*services : {
					type		: 'Select2Remote',
					title		: localization.tt("lbl.selectServiceName"),
					//validators  : [{type:'regexp',regexp:/^[a-zA-Z*?][a-zA-Z0-9_'&-/\$]*[A-Za-z0-9]*$/i,message :localization.tt('validationMessages.enterValidName')}],
					editorAttrs :{'data-placeholder': 'Select Service'},//'disabled' :'disabled'},
					//fieldAttrs :{'disabled' :'disabled',},
					pluginAttr  : this.getPlugginAttr(true,this.type.SERVICE)
				},*/
				_vAuditListToggle : {
					type		: 'Switch',
					title		: localization.tt("lbl.auditLogging"),
					listType	: 'VNameValue',
					switchOn	: true
				},
				permMapList : {
					getValue : function(){
						console.log(this);
					}
				},
				resourceStatus : {
					type		: 'Switch',
					title		: localization.tt("lbl.policyStatus"),
					onText		: 'enabled',
					offText		: 'disabled',
					width		: 89,
					height		: 22,
					switchOn	: true
				},
				description : { 
					type		: 'TextArea',
					title		: localization.tt("lbl.description"), 
				//	validators	: [/^[A-Za-z ,.'-]+$/i],
					template	:_.template('<div class="altField" data-editor></div>')
				}
			};	
		},
Ejemplo n.º 9
0
		renderTable : function(){
			var that = this;
			var TableRow = Backgrid.Row.extend({
				events: {
					'click' : 'onClick'
				},
				onClick: function (e) {
					if($(e.toElement).is('.icon-edit'))
						return;
					this.$el.parent('tbody').find('tr').removeClass('tr-active');
					this.$el.toggleClass('tr-active');
					that.rFolderInfo.show(new vFolderInfo({
						model : this.model
					}));
									
				}
			});

			this.rTableList.show(new XATableLayout({
				columns: this.getColumns(),
				collection: this.collection,
				includeFilter : false,
				gridOpts : {
					row: TableRow,
					header : XABackgrid,
					emptyText : localization.tt('plcHldr.noAssets')
				},
				filterOpts : {
				  name: ['name'],
				  placeholder: localization.tt('plcHldr.searchByResourcePath'),
				  wait: 150
				}
			}));
		},
Ejemplo n.º 10
0
					}).done(function(coll,mm){
						XAUtils.blockUI('unblock');
						fullTrxLogListForTrxId = new VXTrxLogList(coll.vXTrxLogs);
						
						var view = new vOperationDiffDetail({
							collection : fullTrxLogListForTrxId,
							classType : self.model.get('objectClassType'),
							objectName : self.model.get('objectName'),
							objectId   : self.model.get('objectId'),
							objectCreatedDate : objectCreatedDate,
							userName :self.model.get('owner'),
							action : action
							
						});
						var modal = new Backbone.BootstrapModal({
							animate : true, 
							content		: view,
							title: localization.tt("h.operationDiff")+' : '+action,
							//	cancelText : localization.tt("lbl.done"),
							okText :localization.tt("lbl.ok"),
							allowCancel : true,
							escape : true
						}).open();
						modal.$el.addClass('modal-diff').attr('tabindex',-1);
						modal.$el.find('.cancel').hide();
					});
		getSchema : function(){
			var that = this;
			return {
				module : {
					type		: 'Text',
					title		: localization.tt("lbl.moduleName") +' *',
					editorAttrs : {'readonly' :'readonly'},
					validation	: {'required': true},
				},
				selectGroups : {
					type : 'Select2Remote',
					editorAttrs  : {'placeholder' :'Select Group','tokenSeparators': [",", " "],multiple:true},
					pluginAttr: this.getPlugginAttr(true,{'lookupURL':"service/xusers/groups",'permList':that.model.get('groupPermList'),'idKey':'groupId','textKey':'groupName'}),
					title : localization.tt('lbl.selectGroup')+' *'
				},
				selectUsers : {
					type : 'Select2Remote',
					editorAttrs  : {'placeholder' :'Select User','tokenSeparators': [",", " "],multiple:true},
					pluginAttr: this.getPlugginAttr(true,{'lookupURL':"service/xusers/users",'permList':that.model.get('userPermList'),'idKey':'userId','textKey':'userName'}),
					title : localization.tt('lbl.selectUser')+' *',
				},
				isAllowed : {
					type : 'Checkbox',
					editorAttrs  : {'checked':'checked',disabled:true},
					title : 'Is Allowed ?'
					},
			}
		},
Ejemplo n.º 12
0
					formatNoMatches : function(term){
						switch (type){
							case  that.type.COLUMN_FAMILIS :return localization.tt("msg.enterAlteastOneCharactere");
							case  that.type.TABLE :return localization.tt("msg.enterAlteastOneCharactere");
							case  that.type.COLUMN :return localization.tt("msg.enterAlteastOneCharactere");
							default : return "No Matches found";
						}
					}
		getPermHeaders : function(){
			var permList = [];
			permList.unshift(localization.tt('lbl.allowAccess'));
			permList.unshift(localization.tt('lbl.selectUser'));
			permList.unshift(localization.tt('lbl.selectGroup'));
//			permList.push("");
			return permList;
		},
Ejemplo n.º 14
0
		getAgentColumns : function(){
			var cols = {
					createDate : {
						cell : 'string',
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw: function (rawValue, model) {
								//var date = new Date(model.get('createDate')).toString();
								//var timezone = date.replace(/^.*GMT.*\(/, "").replace(/\)$/, "");
								return Globalize.format(new Date(model.get('createDate')),  "MM/dd/yyyy hh:mm:ss tt");
							}
						}),
						label : localization.tt('lbl.createDate')+ '   ( '+this.timezone+' )',
						editable : false
					},
					repositoryName : {
						cell : 'html',
						label	: localization.tt('lbl.repositoryName'),
						editable:false,
						sortable:false,
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw: function (rawValue, model) {
								return '<span title="'+rawValue+'">'+rawValue+'</span>';
							}
						}),
						
					},
					agentId : {
						cell : 'string',
						label	:localization.tt('lbl.agentId'),
						editable:false,
						sortable:false
					},
					clientIP : {
						cell : 'string',
						label	: localization.tt('lbl.agentIp'),
						editable:false,
						sortable:false
					},
					httpRetCode : {
						cell : 'html',
						label	: localization.tt('lbl.httpResponseCode'),
						editable:false,
						sortable:false,
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw: function (rawValue, model) {
								var html = rawValue;
								if(rawValue > 400)
									html = '<label class="label label-yellow">'+rawValue+'</label>';
								else
									html = '<label class="label">'+rawValue+'</label>';
								return html;
							}
						})
					}
			};
			return this.policyExportAuditList.constructor.getTableCols(cols, this.policyExportAuditList);
		},
Ejemplo n.º 15
0
		getPermHeaders : function(){
			var permList = [];
			permList.unshift(localization.tt('lbl.delegatedAdmin'));
			permList.unshift(localization.tt('lbl.permissions'));
			if(!_.isEmpty(this.rangerServiceDefModel.get('policyConditions'))){
				permList.unshift(localization.tt('h.policyCondition'));
			}
			permList.unshift(localization.tt('lbl.selectUser'));
			permList.unshift(localization.tt('lbl.selectGroup'));
			permList.push("");
			return permList;
		},
Ejemplo n.º 16
0
		downloadReport : function(e){
			var that = this;
			if(SessionMgr.isKeyAdmin()){
				if(this.services.length == 0){
					XAUtil.alertBoxWithTimeSet(localization.tt('msg.noServiceToExport'));
					return;
				}
			}
			var el = $(e.currentTarget), serviceType = el.attr('data-servicetype');
			if(serviceType){
				var componentServices = this.services.where({'type' : serviceType });
                    if(componentServices.length == 0 ){
	            	XAUtil.alertBoxWithTimeSet(localization.tt('msg.noServiceToExport'));
	            	return;
	            }
			}else{
				if(SessionMgr.isSystemAdmin()){
					if(location.hash == "#!/policymanager/resource"){
						var servicesList = _.omit(this.services.groupBy('type'),'tag','kms');
						if(_.isEmpty(servicesList)){
							XAUtil.alertBoxWithTimeSet(localization.tt('msg.noServiceToExport'));
							return;
						}
					}else{
						var servicesList = _.pick(this.services.groupBy('type'),'tag');
						if(_.isEmpty(servicesList)){
							XAUtil.alertBoxWithTimeSet(localization.tt('msg.noServiceToExport'));
							return;
						}
						
					}
				}
			}
			
			 var view = new vDownloadServicePolicy({
              	serviceType		:serviceType,
				collection 		: new Backbone.Collection([""]),
				serviceDefList	: this.collection,
                                services		: this.services,
                zoneServiceDefList : this.componentCollectionModels(this.ui.selectZoneName.val()),
                zoneServices    : this.componentServicesModels(this.ui.selectZoneName.val()),

			});
            var modal = new Backbone.BootstrapModal({
				content	: view,
				title	: 'Export Policy',
				okText  :"Export",
				animate : true
			}).open();
			
		},
Ejemplo n.º 17
0
	HHelpers.a = function(linkType, linkOpts, htmlOpts) {
		
		var XALinks	= require("modules/XALinks");
		var linkObj	= XALinks.get(linkType, linkOpts);
		var attrs	= [];
		htmlOpts	= htmlOpts || {}; // Handle the case if a() is called from outside of Handlebars
		for(var prop in htmlOpts.hash) {
			attrs.push(prop + '="' + htmlOpts.hash[prop] + '"');
		}
		attrs.push('href="' + linkObj.href + '"');
		attrs.push('title="' + localization.tt(linkObj.title) + '"');
		
		return new Handlebars.SafeString("<a " + attrs.join(" ") + ">" + localization.tt(linkObj.text) + "</a>");
	};
Ejemplo n.º 18
0
		validateGroupPermission : function(validateObj){
			if((!validateObj.groupSet) && (validateObj.permSet)) {
				this.popupCallBack(localization.tt('msg.addGroup'),validateObj);
			}else if(validateObj.groupIPSet && (!validateObj.groupSet)){
					this.popupCallBack(localization.tt('msg.addGroup'),validateObj);
			/*}else if(validateObj.groupSet && (!validateObj.groupIPSet)){
				this.popupCallBack(localization.tt('msg.enterIPForGroupPerm'),validateObj);
			}else if(!validateObj.groupIPSet && (validateObj.groupSet && validateObj.permSet)){
				this.popupCallBack(localization.tt('msg.enterIPForGroupPerm'),validateObj);*/
			}else if(validateObj.groupIPSet && (!validateObj.permSet)){
				this.popupCallBack(localization.tt('msg.addGroupPermission'),validateObj);
			}else if(validateObj.groupSet && (!validateObj.permSet)){
					this.popupCallBack(localization.tt('msg.addGroupPermission'),validateObj);
			/*}else if(validateObj.groupIPSet && !validateObj.groupSet){
				this.popupCallBack(localization.tt('msg.addGroup'),validateObj);
			}else if(validateObj.groupIPSet && !validateObj.permSet){
				this.popupCallBack(localization.tt('msg.addGroupPermission'),validateObj);*/
			
			}else if(validateObj.userIPSet && (!validateObj.userSet)){
				this.popupCallBack(localization.tt('msg.addUser'),validateObj);
			}else if(validateObj.userPerm && (!validateObj.userSet)) {
				this.popupCallBack(localization.tt('msg.addUser'),validateObj);
			/*}else if(!validateObj.userIPSet && validateObj.userSet){
				this.popupCallBack(localization.tt('msg.enterIPForUserPerm'),validateObj);
			}else if(!validateObj.userIPSet && (validateObj.userSet && validateObj.userPerm)){
				this.popupCallBack(localization.tt('msg.enterIPForUserPerm'),validateObj);*/		
			}else if(validateObj.userIPSet && (!validateObj.userPerm)){
				this.popupCallBack(localization.tt('msg.addUserPermission'),validateObj);
			}else if(validateObj.userSet && (!validateObj.userPerm)){
				this.popupCallBack(localization.tt('msg.addUserPermission'),validateObj);
			}
			else
				return true;
		},
		onSave: function(){
			var that = this, valid = false;
			var errors = this.form.commit({validate : false});
			if(! _.isEmpty(errors)){
				return;
			}
			var validateObj = this.form.formValidation();
			valid = (validateObj.groupSet && validateObj.permSet) || (validateObj.userSet && validateObj.userPerm);
			if(!valid){
				if(validateObj.groupSet && (!validateObj.permSet)){
					this.popupCallBack(localization.tt('msg.addGroupPermission'),validateObj);
				}else if((!validateObj.groupSet) && (validateObj.permSet)) {
					this.popupCallBack(localization.tt('msg.addGroup'),validateObj);
						
				}else if(validateObj.userSet && (!validateObj.userPerm)){
					this.popupCallBack(localization.tt('msg.addUserPermission'),validateObj);
				}else if((!validateObj.userSet) && (validateObj.userPerm)) {
					this.popupCallBack(localization.tt('msg.addUser'),validateObj);
						
				}else if((!validateObj.auditLoggin) && (!validateObj.groupPermSet)){
					XAUtil.alertPopup({
						msg :localization.tt('msg.yourAuditLogginIsOff'),
						callback : function(){
							/*if(!that.model.isNew()){
								that.model.destroy({success: function(model, response) {
									XAUtil.notifySuccess('Success', localization.tt('msg.policyDeleteMsg'));
									App.appRouter.navigate("#!/hdfs/"+that.assetModel.id+"/policies",{trigger: true});
								}});
							}else{
								XAUtil.notifyError('Error', localization.tt('msg.policyNotAddedMsg'));
								App.appRouter.navigate("#!/hdfs/"+that.assetModel.id+"/policies",{trigger: true});
							}*/
						}
					});
				}else{
					this.savePolicy();
				}
			}else{
				if(validateObj.groupSet && (!validateObj.permSet)){
					this.popupCallBack(localization.tt('msg.addGroupPermission'),validateObj);
				}else if((!validateObj.groupSet) && (validateObj.permSet)) {
					this.popupCallBack(localization.tt('msg.addGroup'),validateObj);
						
				}else if(validateObj.userSet && (!validateObj.userPerm)){
					this.popupCallBack(localization.tt('msg.addUserPermission'),validateObj);
				}else if((!validateObj.userSet) && (validateObj.userPerm)) {
					this.popupCallBack(localization.tt('msg.addUser'),validateObj);
						
				}else{
					this.savePolicy();
				}
			}
		},
Ejemplo n.º 20
0
		onSave: function(){
			var errors = this.form.commit({validate : false});
			if(! _.isEmpty(errors)){
				return;
			}
			//validate policyItems in the policy
			var validateObj1 = this.form.formValidation(this.form.formInputList);
			if(!this.validatePolicyItem(validateObj1)) return;
			var	validateObj2 = this.form.formValidation(this.form.formInputAllowExceptionList);
			if(!this.validatePolicyItem(validateObj2)) return;
			var	validateObj3 = this.form.formValidation(this.form.formInputDenyList);
			if(!this.validatePolicyItem(validateObj3)) return;
			var	validateObj4 = this.form.formValidation(this.form.formInputDenyExceptionList);
			if(!this.validatePolicyItem(validateObj4)) return;
			
			var userPerm = (validateObj1.userPerm || validateObj2.userPerm
					  || validateObj3.userPerm || validateObj4.userPerm);
			var groupPerm = (validateObj1.groupPermSet || validateObj2.groupPermSet 
					|| validateObj3.groupPermSet || validateObj4.groupPermSet)
			if((!validateObj1.auditLoggin) && !(groupPerm || userPerm)){
				XAUtil.alertPopup({ msg :localization.tt('msg.yourAuditLogginIsOff') });
				return;
			}
			this.savePolicy();
		},
Ejemplo n.º 21
0
		getPermHeaders : function(){
			var permList = [], 
				policyCondition = false;
			permList.unshift(localization.tt('lbl.delegatedAdmin'));
			permList.unshift(localization.tt('lbl.permissions'));
			if(!_.isEmpty(this.serviceDef.get('policyConditions'))){
				permList.unshift(localization.tt('h.policyCondition'));
				policyCondition = true;
			}
			permList.unshift(localization.tt('lbl.selectUser'));
			permList.unshift(localization.tt('lbl.selectGroup'));
			return {
				header : permList,
				policyCondition : policyCondition
			};
		},
Ejemplo n.º 22
0
						'success': function(model, response) {
							XAUtil.blockUI('unblock');
							that.collection.remove(model.get('id'));
							XAUtil.notifySuccess('Success', localization.tt('msg.rolloverSuccessfully'));
							that.renderKeyTab();
							that.collection.fetch();
						},
		addVisualSearch : function(){
			var that = this;
			//var resourceSearchOpt = _.map(this.collection.models, function(resource){ return XAUtil.capitaliseFirstLetter(resource.module) });

			var searchOpt = ['Module Name','Group Name','User Name'];

			var serverAttrName  = [{text : "Module Name", label :"module"},{text : "Group Name", label :"groupName"},{text : "User Name", label :"userName"}];

			var pluginAttr = {
				      placeholder :localization.tt('h.searchForPermissions'),
				      container : this.ui.visualSearch,
				      query     : '',
				      callbacks :  {
					  valueMatches :function(facet, searchTerm, callback) {
								switch (facet) {
									/*case 'Module Name':
										callback(that.getActiveStatusNVList());
										break;
									case 'Group Name':
										callback(XAUtil.enumToSelectLabelValuePairs(XAEnums.AuthType));
										break;
									case 'User Name' :
										setTimeout(function () { XAUtil.displayDatepicker(that.ui.visualSearch, callback); }, 0);
										break;*/
								}

							}
				      }
				};
			window.vs = XAUtil.addVisualSearch(searchOpt,serverAttrName, this.collection,pluginAttr);
		},
Ejemplo n.º 24
0
		renderCustomFields: function(){
			this.$('.extraServiceConfigs').html(new ConfigurationList({
				collection : this.extraConfigColl,
				model 	   : this.model,
				fieldLabel : localization.tt('lbl.addNewConfig')
			}).render().el);
		},
						success: function(model, response) {
							XAUtil.blockUI('unblock');
							that.collection.remove(model.get('id'));
							XAUtil.notifySuccess('Success', localization.tt('msg.policyDeleteMsg'));
							that.renderTable();
							that.collection.fetch();
						},
Ejemplo n.º 26
0
                onAddUser : function(e){
                        var that = this, newPerms = [];
                        var selectedUsers = this.fields.selectUsers.editor.$el.select2('data');
                        _.each(selectedUsers, function(obj){
                                var self = that;
                                this.$el.find('[data-js="selectedUserList"]').append('<span class="selected-widget"  ><i class="icon remove icon-remove" data-js="selectedUserIcon" data-id="'+obj.id+'"></i>&nbsp;'+obj.text+'</span>')
                                this.addedUsers.push(obj)
                                this.$el.find('[data-js="selectedUserList"] :last').on('click',this.removeUser.bind(this));
                                this.fields.selectUsers.editor.$el.select2('data', []);
                                var addedUserPerm =_.findWhere(this.model.get('userPermList'), {'userId': parseInt(obj.id) });
                                if(!_.isUndefined(addedUserPerm)){
                                        addedUserPerm.isAllowed = XAEnums.AccessResult.ACCESS_RESULT_ALLOWED.value;
                                }else{
                                        var perm = {};
                                        perm['moduleId'] = that.model.get('id');
                                        perm['userId'] = obj['id'];
                                        perm.isAllowed = XAEnums.AccessResult.ACCESS_RESULT_ALLOWED.value;
                                        newPerms.push(perm);
				}
                        }, this);
                        if(!_.isEmpty(newPerms)){
                                var permissions = this.model.get('userPermList');
                                this.model.set('userPermList', permissions.concat(newPerms));
                        }
                        this.emptyCheck();
                        if(_.isEmpty(selectedUsers))	alert(localization.tt("msg.pleaseSelectUser"));
                        return false;
                },
Ejemplo n.º 27
0
		onSave : function(){
			var that =this, valid = false;
			var errors = this.form.commit({validate : false});
			if(! _.isEmpty(errors)){
				return;
			}
			var validateObj = this.form.formValidation();
			valid = (validateObj.groupSet && validateObj.permSet && validateObj.groupIPSet) || (validateObj.userSet && validateObj.userPerm && validateObj.userIPSet);
			if(!valid){
				if(this.validateGroupPermission(validateObj)) {
					if((!validateObj.auditLoggin) && !(validateObj.groupPermSet || validateObj.userSet)){
						XAUtil.alertPopup({
							msg :localization.tt('msg.yourAuditLogginIsOff'),
							callback : function(){}
						});
					}else{
						this.savePolicy();
					}
				}
			}else{
				if(this.validateGroupPermission(validateObj))
					this.savePolicy();
			}

		},
Ejemplo n.º 28
0
		onRender: function() {
			XAUtil.showAlerForDisabledPolicy(this);
			this.rForm.show(this.form);
			this.rForm.$el.dirtyFields();
			XAUtil.preventNavigation(localization.tt('dialogMsg.preventNavHbasePolicyForm'), this.rForm.$el);
			this.initializePlugins();
		},
Ejemplo n.º 29
0
        schema : function(){
            var attrs = {};

            return _.extend(attrs,{
                name : {
                    type        : 'TextFieldWithIcon',
                    title       : localization.tt("lbl.roleName") +' *',
                    validators  : ['required',{type:'regexp',regexp:/^([A-Za-z0-9_]|[\u00C0-\u017F])([a-z0-9,._\-+/@= ]|[\u00C0-\u017F])+$/i,message :' Invalid group name'}],
                    editorAttrs : { 'maxlength': 255},
                    errorMsg    : localization.tt('validationMessages.roleNameValidationMsg'),
                },
                description: {
                    type: 'TextArea',
                    title: 'Description',
                    validators: []
                },
            });
        },
Ejemplo n.º 30
0
						success: function(model, response) {
							XAUtil.blockUI('unblock');
							that.collection.remove(model.get('id'));
							$(that.rPolicyDetail.el).hide();
							XAUtil.notifySuccess('Success', localization.tt('msg.policyDeleteMsg'));
							if(that.collection.length ==  0){
								that.renderTable();
								that.collection.fetch();
							}
						},