Return-Path: X-Original-To: apmail-argus-commits-archive@minotaur.apache.org Delivered-To: apmail-argus-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D5505119F7 for ; Fri, 22 Aug 2014 06:59:48 +0000 (UTC) Received: (qmail 2172 invoked by uid 500); 22 Aug 2014 06:59:48 -0000 Delivered-To: apmail-argus-commits-archive@argus.apache.org Received: (qmail 2153 invoked by uid 500); 22 Aug 2014 06:59:48 -0000 Mailing-List: contact commits-help@argus.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@argus.incubator.apache.org Delivered-To: mailing list commits@argus.incubator.apache.org Received: (qmail 2144 invoked by uid 99); 22 Aug 2014 06:59:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Aug 2014 06:59:48 +0000 X-ASF-Spam-Status: No, hits=-2000.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 22 Aug 2014 06:59:47 +0000 Received: (qmail 1798 invoked by uid 99); 22 Aug 2014 06:59:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Aug 2014 06:59:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9108E9C7850; Fri, 22 Aug 2014 06:59:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sneethir@apache.org To: commits@argus.incubator.apache.org Message-Id: <326966386e5042d5958e97fa27c54e3a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: ARGUS-19: fixed external user role-change Date: Fri, 22 Aug 2014 06:59:26 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org 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 Authored: Thu Aug 21 23:15:41 2014 -0700 Committer: sneethiraj 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