From b12b73627b544e5fcaeed45074e90103f39632cd Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Fri, 23 Dec 2011 11:40:04 -0400 Subject: [PATCH] BUG 000 - correction form new Authentication Sources, IE format --- gulliver/system/class.rbac.php | 15 +++- rbac/engine/classes/plugins/class.ldap.php | 6 ++ .../templates/authSources/authSourcesEdit.js | 39 +++++----- .../authSources/authSourcesListNew.js | 36 ++++----- .../authSources/authSourceskindof.js | 77 ++++++++++--------- 5 files changed, 90 insertions(+), 83 deletions(-) diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index f5f68365a..29a25eed0 100755 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -178,7 +178,6 @@ class RBAC file_put_contents( $filePath, serialize ( $this->aUserInfo ) ); } } - /** * verification the register automatic * @@ -889,7 +888,6 @@ class RBAC function getAuthenticationSources($start,$limit,$filter='') { return $this->authSourcesObj->getAuthenticationSources($start,$limit,$filter); } - /** * this function gets all authentication source * Authentication Sources @@ -900,9 +898,16 @@ class RBAC * @return $this->authSourcesObj->load */ function getAuthSource($sUID) { - return $this->authSourcesObj->load($sUID); + $data = $this->authSourcesObj->load($sUID); + $pass =explode("_",$data['AUTH_SOURCE_PASSWORD']); + foreach($pass as $index => $value) { + if($value == '2NnV3ujj3w'){ + $data['AUTH_SOURCE_PASSWORD'] = G::decrypt($pass[0],$data['AUTH_SOURCE_SERVER_NAME']); + } + } + $this->authSourcesObj->Fields = $data; + return $this->authSourcesObj->Fields; } - /** * this function creates an authentication source * Authentication Sources @@ -913,6 +918,7 @@ class RBAC * @return $this->authSourcesObj->create */ function createAuthSource($aData) { + $aData['AUTH_SOURCE_PASSWORD'] = G::encrypt($aData['AUTH_SOURCE_PASSWORD'],$aData['AUTH_SOURCE_SERVER_NAME'])."_2NnV3ujj3w"; $this->authSourcesObj->create($aData); } @@ -927,6 +933,7 @@ class RBAC * @return $this->authSourcesObj->create */ function updateAuthSource($aData) { + $aData['AUTH_SOURCE_PASSWORD'] = G::encrypt($aData['AUTH_SOURCE_PASSWORD'],$aData['AUTH_SOURCE_SERVER_NAME'])."_2NnV3ujj3w"; $this->authSourcesObj->update($aData); } diff --git a/rbac/engine/classes/plugins/class.ldap.php b/rbac/engine/classes/plugins/class.ldap.php index 66d634c45..71fb7affe 100755 --- a/rbac/engine/classes/plugins/class.ldap.php +++ b/rbac/engine/classes/plugins/class.ldap.php @@ -118,6 +118,12 @@ class LDAP $sKeyword = trim($sKeyword); $RBAC = RBAC::getSingleton(); $aAuthSource = $RBAC->authSourcesObj->load($this->sAuthSource); + $pass =explode("_",$aAuthSource['AUTH_SOURCE_PASSWORD']); + foreach($pass as $index => $value) { + if($value == '2NnV3ujj3w'){ + $aAuthSource['AUTH_SOURCE_PASSWORD'] = G::decrypt($pass[0],$aAuthSource['AUTH_SOURCE_SERVER_NAME']); + } + } $oLink = @ldap_connect($aAuthSource['AUTH_SOURCE_SERVER_NAME'], $aAuthSource['AUTH_SOURCE_PORT']); @ldap_set_option($oLink, LDAP_OPT_PROTOCOL_VERSION, $aAuthSource['AUTH_SOURCE_VERSION']); @ldap_set_option($oLink, LDAP_OPT_REFERRALS, 0); diff --git a/workflow/engine/templates/authSources/authSourcesEdit.js b/workflow/engine/templates/authSources/authSourcesEdit.js index 17709b6d1..c302369e1 100644 --- a/workflow/engine/templates/authSources/authSourcesEdit.js +++ b/workflow/engine/templates/authSources/authSourcesEdit.js @@ -6,18 +6,18 @@ Ext.onReady(function(){ var txtSourceId=new Ext.form.TextField({ - id: 'AUTH_SOURCE_UID', - fieldLabel: 'krlos', + id: 'AUTH_SOURCE_UID', + fieldLabel: 'krlos', xtype:'textfield', - value:sUID, + value: sUID, width: 200, hideLabel: true, - hidden : true, + hidden: true }); var txtName=new Ext.form.TextField({ - id: 'AUTH_SOURCE_NAME', - fieldLabel: _('ID_NAME'), + id: 'AUTH_SOURCE_NAME', + fieldLabel: _('ID_NAME'), xtype:'textfield', value:'', width: 200, @@ -49,8 +49,10 @@ Ext.onReady(function(){ select: function(c,d,i){ if(i){ formAuthSourceE.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'samaccountname' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'userprincipalname' + "\n" + 'telephonenumber'); + formAuthSourceE.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('samaccountname'); } else { formAuthSourceE.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile'); + formAuthSourceE.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('uid'); } } } @@ -188,7 +190,7 @@ Ext.onReady(function(){ }); var txtPassword=new Ext.form.TextField({ - id: 'AUTH_SOURCE_PASSWORD', + id: 'AUTH_SOURCE_PASSWORD', fieldLabel: _('ID_CACHE_PASSWORD'), xtype:'textfield', inputType:'password', @@ -205,10 +207,10 @@ Ext.onReady(function(){ //Identifier for an imported user var txtIdentifier=new Ext.form.TextField({ - id: 'AS_INDENTIFIER', + id: 'AUTH_SOURCE_IDENTIFIER_FOR_USER', fieldLabel: _('ID_IDENTIFIER_IMPORT_USER'), xtype:'textfield', - value:'uid', + value:'', width: 200, autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '50'}, allowBlank: false, @@ -221,7 +223,7 @@ Ext.onReady(function(){ }); //Object Classes var txtaClass=new Ext.form.TextArea({ - id: 'AUTH_SOURCE_OBJECT_CLASSES', + id: 'AUTH_SOURCE_OBJECT_CLASSES', fieldLabel: _('ID_OBJECT_CLASS'), xtype:'textarea', value:'*', @@ -236,13 +238,13 @@ Ext.onReady(function(){ }); //Additional Filter var txtoAddFilter=new Ext.form.TextField({ - id: 'AUTH_SOURCE_ADDITIONAL_FILTER', + id: 'AUTH_SOURCE_ADDITIONAL_FILTER', fieldLabel: _('ID_ADDITIONAL_FILTER'), xtype:'textfield', value:'', width: 200, autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '200'}, - allowBlank: false, + allowBlank: true, listeners: { 'render': function(c) { c.getEl().on('keyup', function() { @@ -252,7 +254,7 @@ Ext.onReady(function(){ }); //Attributes var txtAttributes=new Ext.form.TextArea({ - id: 'AUTH_SOURCE_ATTRIBUTES', + id: 'AUTH_SOURCE_ATTRIBUTES', fieldLabel: _('ID_ATTRIBUTES'), xtype:'textArea', value:'cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile', @@ -375,10 +377,9 @@ function loadAuthSourceData(sUID, txtSearchUser, txtPassword){ sUID:sUID }, waitMsg: _('ID_UPLOADING_PROCESS_FILE'), - success: function(r,o){ + success: function(r,o){ var data = Ext.util.JSON.decode(r.responseText); - if (!data.sources.AUTH_ANONYMOUS){ Ext.getCmp("AUTH_SOURCE_SEARCH_USER").enable(); Ext.getCmp("AUTH_SOURCE_SEARCH_USER").show(); @@ -395,8 +396,6 @@ function loadAuthSourceData(sUID, txtSearchUser, txtPassword){ txtPassword.getEl().up('.x-form-item').setDisplayed(false); } - - Ext.getCmp('formAuthSourceE').getForm().setValues({ AUTH_SOURCE_UID: data.sources.AUTH_SOURCE_UID, @@ -408,6 +407,7 @@ function loadAuthSourceData(sUID, txtSearchUser, txtPassword){ AUTH_ANONYMOUS: (data.sources.AUTH_ANONYMOUS)?'yes':'no', AUTH_SOURCE_SEARCH_USER: data.sources.AUTH_SOURCE_SEARCH_USER, AUTH_SOURCE_PASSWORD: data.sources.AUTH_SOURCE_PASSWORD, + AUTH_SOURCE_IDENTIFIER_FOR_USER: data.sources.AUTH_SOURCE_IDENTIFIER_FOR_USER, AUTH_SOURCE_VERSION: data.sources.AUTH_SOURCE_VERSION, AUTH_SOURCE_BASE_DN: data.sources.AUTH_SOURCE_BASE_DN, AUTH_SOURCE_OBJECT_CLASSES: data.sources.AUTH_SOURCE_OBJECT_CLASSES, @@ -415,11 +415,8 @@ function loadAuthSourceData(sUID, txtSearchUser, txtPassword){ AUTH_SOURCE_ADDITIONAL_FILTER:data.sources.AUTH_SOURCE_ADDITIONAL_FILTER }) }, - failure:function(r,o){ //viewport.getEl().unmask(); } }); -} - - +} \ No newline at end of file diff --git a/workflow/engine/templates/authSources/authSourcesListNew.js b/workflow/engine/templates/authSources/authSourcesListNew.js index 7bc072b83..4479da802 100755 --- a/workflow/engine/templates/authSources/authSourcesListNew.js +++ b/workflow/engine/templates/authSources/authSourcesListNew.js @@ -9,7 +9,7 @@ var storeAuthSources = new Ext.data.GroupingStore({ proxy : new Ext.data.HttpProxy({ url: 'authSources_Ajax?action=authSourcesNew&cmb=yes' }), - reader : new Ext.data.JsonReader( { + reader : new Ext.data.JsonReader({ root: 'sources', fields: [ {name: 'sType'}, @@ -23,12 +23,12 @@ var my_values = [ ['krlos'] ]; var cboxAuthSourse = new Ext.form.ComboBox({ - fieldLabel: 'Provider', - hiddenName: 'AUTH_SOURCE_PROVIDER', + fieldLabel: 'Provider', + hiddenName: 'AUTH_SOURCE_PROVIDER', mode: 'local', triggerAction: 'all', store: storeAuthSources, - valueField : 'sType', + valueField: 'sType', displayField: 'sLabel', emptyText: 'Choose an option...', width: 160, @@ -42,41 +42,40 @@ var cboxAuthSourse = new Ext.form.ComboBox({ }); componAuthSourse = new Ext.form.FieldSet({ - title: 'Available Authentication Sources', + title: 'Available Authentication Sources', items: [ - cboxAuthSourse + cboxAuthSourse ] }); - formAuthSourceOptoins = new Ext.FormPanel({ - id:'formAuthSourceOptoins', + id:'formAuthSourceOptoins', labelWidth: 250, - labelAlign:'right', + labelAlign: 'right', autoScroll: true, fileUpload: true, width:800, bodyStyle:'padding:10px', - waitMsgTarget : true, + waitMsgTarget: true, frame: true, defaults: { anchor: '100%', allowBlank: false, resizable: true, msgTarget: 'side', - align:'center' + align:'center' }, items:[ - componAuthSourse, + componAuthSourse ], buttons: [ { text: 'Continue', - handler: gotypesAuthSources + handler: gotypesAuthSources }, - { + { text: 'Cancel', - handler: goBackform + handler: goBackform } ] @@ -125,9 +124,4 @@ var cboxAuthSourse = new Ext.form.ComboBox({ } } }); - } - - - - - + } \ No newline at end of file diff --git a/workflow/engine/templates/authSources/authSourceskindof.js b/workflow/engine/templates/authSources/authSourceskindof.js index 44b1c1ed7..34bcc16e5 100644 --- a/workflow/engine/templates/authSources/authSourceskindof.js +++ b/workflow/engine/templates/authSources/authSourceskindof.js @@ -5,32 +5,31 @@ Ext.onReady(function(){ - var txtSourceId=new Ext.form.TextField({ - id: 'AUTH_SOURCE_UID', - fieldLabel: 'krlos', - xtype:'textfield', - value:'', + id: 'AUTH_SOURCE_UID', + fieldLabel: 'krlos', + xtype: 'textfield', + value: '', width: 200, hideLabel: true, - hidden : true, + hidden: true }); var txtSourceProvider=new Ext.form.TextField({ - id: 'AUTH_SOURCE_PROVIDER', - fieldLabel: 'krlos', - xtype:'textfield', - value:sprovider, + id: 'AUTH_SOURCE_PROVIDER', + fieldLabel: 'krlos', + xtype: 'textfield', + value: sprovider, width: 200, hideLabel: true, - hidden : true, + hidden: true }); var txtName=new Ext.form.TextField({ - id: 'AUTH_SOURCE_NAME', - fieldLabel: _('ID_NAME'), - xtype:'textfield', - value:'', + id: 'AUTH_SOURCE_NAME', + fieldLabel: _('ID_NAME'), + xtype: 'textfield', + value: '', width: 200, autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '50'}, allowBlank: false, @@ -60,15 +59,17 @@ Ext.onReady(function(){ select: function(c,d,i){ if(i){ formAuthSource.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'samaccountname' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'userprincipalname' + "\n" + 'telephonenumber'); + formAuthSource.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('samaccountname'); } else { formAuthSource.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile'); + formAuthSource.getForm().findField('AUTH_SOURCE_IDENTIFIER_FOR_USER').setValue('uid'); } } } }); var txtServerName=new Ext.form.TextField({ - id: 'AUTH_SOURCE_SERVER_NAME', + id: 'AUTH_SOURCE_SERVER_NAME', fieldLabel: _('ID_SERVER_NAME'), xtype:'textfield', value:'', @@ -84,7 +85,7 @@ Ext.onReady(function(){ }); var txtPort=new Ext.form.TextField({ - id: 'AUTH_SOURCE_PORT', + id: 'AUTH_SOURCE_PORT', fieldLabel: _('ID_PORT'), xtype:'textfield', value:'389', @@ -107,12 +108,14 @@ Ext.onReady(function(){ data : my_valuesTLS }), displayField: 'no', + allowBlank: false, typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'Choose an option...', selectOnFocus:true }); + //cboxTLS.setValue('no'); var my_values_version= [['2'],['3']]; var cboxVersion = new Ext.form.ComboBox({ @@ -122,6 +125,7 @@ Ext.onReady(function(){ fields: ['two','three'], data : my_values_version }), + allowBlank: false, displayField: 'two', typeAhead: true, mode: 'local', @@ -132,8 +136,8 @@ Ext.onReady(function(){ var txtBaseDN=new Ext.form.TextField({ - id: 'AUTH_SOURCE_BASE_DN', - fieldLabel: _('ID_BASE_DN'), + id: 'AUTH_SOURCE_BASE_DN', + fieldLabel: _('ID_BASE_DN'), xtype:'textfield', value:'', width: 200, @@ -158,6 +162,7 @@ Ext.onReady(function(){ displayField: '0', typeAhead: true, mode: 'local', + allowBlank: false, triggerAction: 'all', emptyText:'Choose an option...', selectOnFocus:true, @@ -177,14 +182,14 @@ Ext.onReady(function(){ txtSearchUser.getEl().up('.x-form-item').setDisplayed(false); Ext.getCmp("AUTH_SOURCE_PASSWORD").disable(); Ext.getCmp("AUTH_SOURCE_PASSWORD").hide(); - txtPassword.getEl().up('.x-form-item').setDisplayed(false); + txtPassword.getEl().up('.x-form-item').setDisplayed(false); } } } }); var txtSearchUser=new Ext.form.TextField({ - id: 'AUTH_SOURCE_SEARCH_USER', + id: 'AUTH_SOURCE_SEARCH_USER', fieldLabel: _('ID_SEARCH_USER'), xtype:'textfield', value:'', @@ -199,7 +204,7 @@ Ext.onReady(function(){ }); var txtPassword=new Ext.form.TextField({ - id: 'AUTH_SOURCE_PASSWORD', + id: 'AUTH_SOURCE_PASSWORD', fieldLabel: _('ID_CACHE_PASSWORD'), xtype:'textfield', inputType:'password', @@ -216,7 +221,7 @@ Ext.onReady(function(){ //Identifier for an imported user var txtIdentifier=new Ext.form.TextField({ - id: 'AS_INDENTIFIER', + id: 'AUTH_SOURCE_IDENTIFIER_FOR_USER', fieldLabel: _('ID_IDENTIFIER_IMPORT_USER'), xtype:'textfield', value:'uid', @@ -232,7 +237,7 @@ Ext.onReady(function(){ }); //Object Classes var txtaClass=new Ext.form.TextArea({ - id: 'AUTH_SOURCE_OBJECT_CLASSES', + id: 'AUTH_SOURCE_OBJECT_CLASSES', fieldLabel: _('ID_OBJECT_CLASS'), xtype:'textarea', value:'*', @@ -247,13 +252,13 @@ Ext.onReady(function(){ }); //Additional Filter var txtoAddFilter=new Ext.form.TextField({ - id: 'AUTH_SOURCE_ADDITIONAL_FILTER', - fieldLabel: _('ID_ADDITIONAL_FILTER'), + id: 'AUTH_SOURCE_ADDITIONAL_FILTER', + fieldLabel: _('ID_ADDITIONAL_FILTER'), xtype:'textfield', value:'', width: 200, autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '200'}, - allowBlank: false, + allowBlank: true, listeners: { 'render': function(c) { c.getEl().on('keyup', function() { @@ -263,7 +268,7 @@ Ext.onReady(function(){ }); //Attributes var txtAttributes=new Ext.form.TextArea({ - id: 'AUTH_SOURCE_ATTRIBUTES', + id: 'AUTH_SOURCE_ATTRIBUTES', fieldLabel: _('ID_ATTRIBUTES'), xtype:'textArea', value:'cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile', @@ -278,13 +283,13 @@ Ext.onReady(function(){ }); //here we are setting the fields fieldsAS = new Ext.form.FieldSet({ - title: 'Authentication Source Information', + title: 'Authentication Source Information', items: [ txtSourceId, txtSourceProvider, txtName, cboxType, - txtServerName, + txtServerName, txtPort, cboxTLS, cboxVersion, @@ -296,12 +301,12 @@ Ext.onReady(function(){ txtaClass, txtoAddFilter, txtAttributes - ] + ] }); formAuthSource = new Ext.FormPanel({ - id:'formAuthSource', + id:'formAuthSource', labelWidth: 250, labelAlign:'right', autoScroll: true, @@ -315,7 +320,7 @@ Ext.onReady(function(){ allowBlank: false, resizable: true, msgTarget: 'side', - align:'center' + align:'center' }, items:[ fieldsAS @@ -323,7 +328,7 @@ Ext.onReady(function(){ buttons: [ { text: 'Save', - handler: TestSite + handler: TestSite }, { @@ -381,6 +386,4 @@ Ext.onReady(function(){ } } }); - } - - + } \ No newline at end of file