ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject git commit: ARGUS-19: fixed external user role-change
Date Fri, 22 Aug 2014 06:59:26 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master ef29bfa3e -> 952518938


ARGUS-19: fixed external user role-change


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

Branch: refs/heads/master
Commit: 95251893891b71e41c65a1916b36a215a4f317dd
Parents: ef29bfa
Author: sneethiraj <sneethir@apache.org>
Authored: Thu Aug 21 23:15:41 2014 -0700
Committer: sneethiraj <sneethir@apache.org>
Committed: Thu Aug 21 23:15:41 2014 -0700

----------------------------------------------------------------------
 .../webapp/scripts/views/common/AddGroup.js     |  2 +
 .../webapp/scripts/views/users/UserCreate.js    |  2 +-
 .../main/webapp/scripts/views/users/UserForm.js | 45 +++++++++++++-------
 3 files changed, 32 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/95251893/security-admin/src/main/webapp/scripts/views/common/AddGroup.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/common/AddGroup.js b/security-admin/src/main/webapp/scripts/views/common/AddGroup.js
index 7db51c4..f61b935 100644
--- a/security-admin/src/main/webapp/scripts/views/common/AddGroup.js
+++ b/security-admin/src/main/webapp/scripts/views/common/AddGroup.js
@@ -74,6 +74,8 @@ define(function(require){
 			
 			if(!_.isUndefined(this.model.get('userSource')) && this.model.get('userSource')
== XAEnums.UserSource.XA_USER.value){
 				this.$el.find('#tags-edit-1').hide();
+				var labelStr1 = this.$el.find('label').html().replace('*','');
+				this.$el.find('label').html(labelStr1);
 			}
 
 			this.$('.tags').editable({

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/95251893/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/users/UserCreate.js b/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
index f9d32f1..1705a5a 100644
--- a/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
+++ b/security-admin/src/main/webapp/scripts/views/users/UserCreate.js
@@ -89,7 +89,7 @@ define(function(require){
 			if(!_.isUndefined(this.model.get('userSource')) && this.model.get('userSource')
== XAEnums.UserSource.XA_USER.value){
 				this.$('[data-tab="edit-password"]').hide();
 				this.$('[data-tab="edit-basic"]').hide();
-				this.ui.btnSave.hide();
+//				this.ui.btnSave.hide();
 			}
 			this.renderForm();
 			this.rForm.$el.dirtyFields();

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/95251893/security-admin/src/main/webapp/scripts/views/users/UserForm.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/views/users/UserForm.js b/security-admin/src/main/webapp/scripts/views/users/UserForm.js
index bd4e16c..c3d6a86 100644
--- a/security-admin/src/main/webapp/scripts/views/users/UserForm.js
+++ b/security-admin/src/main/webapp/scripts/views/users/UserForm.js
@@ -136,11 +136,16 @@ define(function(require){
 				if(this.model.get('name') == userProfileModel.get('loginId')){
 					this.fields.userRoleList.editor.$el.attr('disabled',true);
 				}
+				
 				if(userProfileModel.get('loginId') != "admin"){
-					if(_.contains(this.model.get('userRoleList'),'ROLE_SYS_ADMIN')){
-						this.fields.userRoleList.editor.$el.attr('disabled',true);
+					if(this.model.get('loginId') != "admin"){
+						if(_.contains(userProfileModel.get('userRoleList'),'ROLE_SYS_ADMIN')){
+							this.fields.userRoleList.editor.$el.attr('disabled',false);
+						}else{
+							this.fields.userRoleList.editor.$el.attr('disabled',true);
+						}
 					}else{
-						this.fields.userRoleList.editor.$el.attr('disabled',false);
+						this.fields.userRoleList.editor.$el.attr('disabled',true);
 					}
 				}else{
 					this.fields.userRoleList.editor.$el.attr('disabled',false);
@@ -188,6 +193,12 @@ define(function(require){
 				
 				this.fields.password.editor.validators = [];//this.removeElementFromArr(this.fields.password.editor.validators
, 'required');
 				this.fields.passwordConfirm.editor.validators = [];//this.removeElementFromArr(this.fields.passwordConfirm.editor.validators
, 'required');
+				//Remove validation checks for external users
+				if(this.model.get('userSource') == XAEnums.UserSource.XA_USER.value){
+					this.fields.firstName.editor.validators = [];
+					var labelStr = this.fields.firstName.$el.find('label').html().replace('*','');
+					this.fields.firstName.$el.find('label').html(labelStr);	
+				}
 			}
 		},
 		removeElementFromArr : function(arr ,elem){
@@ -196,20 +207,22 @@ define(function(require){
 			return arr;
 		},
 		beforeSaveUserDetail : function(){
-			var groupArr = this.$('[data-customfields="groupIdList"]').find('.tags').editable('getValue',
true);
-			if(_.isNumber(groupArr))
-				groupArr = groupArr.toString().split(',');
-			if(_.isEmpty(groupArr) ){
-				this.$('[data-customfields="groupIdList"]').find('.control-group').addClass('error');
-				this.$('[data-customfields="groupIdList"]').find('[data-error="groupIdList"]').show();
-				return false;
-			}else{
-				this.$('[data-customfields="groupIdList"]').find('.control-group').removeClass('error');
-				this.$('[data-customfields="groupIdList"]').find('[data-error="groupIdList"]').hide();
			
+			if(this.model.get('userSource') != XAEnums.UserSource.XA_USER.value){
+				var groupArr = this.$('[data-customfields="groupIdList"]').find('.tags').editable('getValue',
true);
+				if(_.isNumber(groupArr))
+					groupArr = groupArr.toString().split(',');
+				if(_.isEmpty(groupArr) ){
+					this.$('[data-customfields="groupIdList"]').find('.control-group').addClass('error');
+					this.$('[data-customfields="groupIdList"]').find('[data-error="groupIdList"]').show();
+					return false;
+				}else{
+					this.$('[data-customfields="groupIdList"]').find('.control-group').removeClass('error');
+					this.$('[data-customfields="groupIdList"]').find('[data-error="groupIdList"]').hide();
			
+				}
+				this.model.set('groupIdList',groupArr);
+				this.model.set('status',XAEnums.ActivationStatus.ACT_STATUS_ACTIVE.value);
+				this.model.unset('passwordConfirm');
 			}
-			this.model.set('groupIdList',groupArr);
-			this.model.set('status',XAEnums.ActivationStatus.ACT_STATUS_ACTIVE.value);
-			this.model.unset('passwordConfirm');
 			if(!this.model.isNew())
 				this.model.unset('password');
 			//FOR USER ROLE


Mime
View raw message