BUG 0000 improving the authentication sources code
This commit is contained in:
@@ -72,4 +72,67 @@ class adminProxy extends HttpProxyController
|
||||
|
||||
echo "{success: true}";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getting the kind of the authentication source
|
||||
* @param object $params
|
||||
* @return array $data
|
||||
*/
|
||||
function testingOption($params){
|
||||
|
||||
$data['success'] = true;
|
||||
$data['optionAuthS'] = $params->optionAuthS;
|
||||
return $data;
|
||||
|
||||
}// end testingOption function
|
||||
|
||||
/**
|
||||
* saving the authentication source data
|
||||
* @param object $params
|
||||
* @return array $data
|
||||
*/
|
||||
function saveAuthSources($params){
|
||||
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
$aCommonFields = array('AUTH_SOURCE_UID',
|
||||
'AUTH_SOURCE_NAME',
|
||||
'AUTH_SOURCE_PROVIDER',
|
||||
'AUTH_SOURCE_SERVER_NAME',
|
||||
'AUTH_SOURCE_PORT',
|
||||
'AUTH_SOURCE_ENABLED_TLS',
|
||||
'AUTH_ANONYMOUS',
|
||||
'AUTH_SOURCE_SEARCH_USER',
|
||||
'AUTH_SOURCE_PASSWORD',
|
||||
'AUTH_SOURCE_VERSION',
|
||||
'AUTH_SOURCE_BASE_DN',
|
||||
'AUTH_SOURCE_OBJECT_CLASSES',
|
||||
'AUTH_SOURCE_ATTRIBUTES');
|
||||
|
||||
$aFields = $aData = array();
|
||||
|
||||
unset($params->PHPSESSID);
|
||||
foreach ($params as $sField => $sValue) {
|
||||
if (in_array($sField, $aCommonFields)) {
|
||||
$aFields[$sField] = (($sField=='AUTH_SOURCE_ENABLED_TLS' || $sField=='AUTH_ANONYMOUS'))? ($sValue=='yes')?1:0 :$sValue;
|
||||
}
|
||||
else {
|
||||
$aData[$sField] = ($sValue=='Active Directory')?'ad':$sValue;
|
||||
}
|
||||
}
|
||||
$aFields['AUTH_SOURCE_DATA'] = $aData;
|
||||
if ($aFields['AUTH_SOURCE_UID'] == '') {
|
||||
$RBAC->createAuthSource($aFields);
|
||||
}
|
||||
else {
|
||||
$RBAC->updateAuthSource($aFields);
|
||||
}
|
||||
$data=array();
|
||||
$data['success'] = true;
|
||||
return $data;
|
||||
}//end saveAuthSoruces function
|
||||
}
|
||||
|
||||
102
workflow/engine/controllers/authSourceProxy.php
Executable file
102
workflow/engine/controllers/authSourceProxy.php
Executable file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class authSourceProxy extends HttpProxyController {
|
||||
|
||||
function testingOption($params){
|
||||
/*global $RBAC;
|
||||
|
||||
$fields = array('AUTH_SOURCE_PROVIDER' => $params->optionAuthS);
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$data=array();
|
||||
|
||||
$aCommonFields = array('AUTH_SOURCE_UID',
|
||||
'AUTH_SOURCE_NAME',
|
||||
'AUTH_SOURCE_PROVIDER',
|
||||
'AUTH_SOURCE_SERVER_NAME',
|
||||
'AUTH_SOURCE_PORT',
|
||||
'AUTH_SOURCE_ENABLED_TLS',
|
||||
'AUTH_ANONYMOUS',
|
||||
'AUTH_SOURCE_SEARCH_USER',
|
||||
'AUTH_SOURCE_PASSWORD',
|
||||
'AUTH_SOURCE_VERSION',
|
||||
'AUTH_SOURCE_BASE_DN',
|
||||
'AUTH_SOURCE_OBJECT_CLASSES',
|
||||
'AUTH_SOURCE_ATTRIBUTES');
|
||||
|
||||
$aFields = $aData = array();
|
||||
|
||||
unset($params->PHPSESSID);
|
||||
foreach ($params as $sField => $sValue) {
|
||||
if (in_array($sField, $aCommonFields)) {
|
||||
$aFields[$sField] = (($sField=='AUTH_SOURCE_ENABLED_TLS' || $sField=='AUTH_ANONYMOUS'))? ($sValue=='yes')?1:0 :$sValue;
|
||||
}
|
||||
else {
|
||||
$aData[$sField] = $sValue;
|
||||
}
|
||||
}
|
||||
$aFields['AUTH_SOURCE_DATA'] = $aData;
|
||||
if (isset($aFields['AUTH_SOURCE_UID']) && $aFields['AUTH_SOURCE_UID'] != '') {
|
||||
$RBAC->updateAuthSource($aFields);
|
||||
}
|
||||
else {
|
||||
$aAuth = $RBAC->createAuthSource($aFields);
|
||||
}*/
|
||||
//G::pr($aAuth);die;
|
||||
$data['success'] = true;
|
||||
$data['optionAuthS'] = $params->optionAuthS;
|
||||
//$data['sUID'] = $aAuth;
|
||||
return $data;
|
||||
}
|
||||
|
||||
function saveAuthSources($params){
|
||||
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
$aCommonFields = array('AUTH_SOURCE_UID',
|
||||
'AUTH_SOURCE_NAME',
|
||||
'AUTH_SOURCE_PROVIDER',
|
||||
'AUTH_SOURCE_SERVER_NAME',
|
||||
'AUTH_SOURCE_PORT',
|
||||
'AUTH_SOURCE_ENABLED_TLS',
|
||||
'AUTH_ANONYMOUS',
|
||||
'AUTH_SOURCE_SEARCH_USER',
|
||||
'AUTH_SOURCE_PASSWORD',
|
||||
'AUTH_SOURCE_VERSION',
|
||||
'AUTH_SOURCE_BASE_DN',
|
||||
'AUTH_SOURCE_OBJECT_CLASSES',
|
||||
'AUTH_SOURCE_ATTRIBUTES');
|
||||
|
||||
$aFields = $aData = array();
|
||||
|
||||
unset($params->PHPSESSID);
|
||||
foreach ($params as $sField => $sValue) {
|
||||
if (in_array($sField, $aCommonFields)) {
|
||||
$aFields[$sField] = (($sField=='AUTH_SOURCE_ENABLED_TLS' || $sField=='AUTH_ANONYMOUS'))? ($sValue=='yes')?1:0 :$sValue;
|
||||
}
|
||||
else {
|
||||
$aData[$sField] = $sValue;
|
||||
}
|
||||
}
|
||||
$aFields['AUTH_SOURCE_DATA'] = $aData;
|
||||
if ($aFields['AUTH_SOURCE_UID'] == '') {
|
||||
$RBAC->createAuthSource($aFields);
|
||||
}
|
||||
else {
|
||||
$RBAC->updateAuthSource($aFields);
|
||||
}
|
||||
$data=array();
|
||||
$data['success'] = true;
|
||||
return $data;
|
||||
}//end saveAuthSoruces function
|
||||
|
||||
|
||||
} //end authSourceProxy class
|
||||
@@ -3,7 +3,7 @@
|
||||
* authSources_Ajax.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
* Copyright (C) 2004 - 2011 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
@@ -147,7 +147,36 @@ try {
|
||||
echo '{success: false, error: '.$ex->getMessage().'}';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'authSourcesNew':
|
||||
$arr = Array();
|
||||
$oDirectory = dir(PATH_RBAC . 'plugins' . PATH_SEP);
|
||||
$aAuthSourceTypes = array();
|
||||
while($sObject = $oDirectory->read()) {
|
||||
if (($sObject != '.') && ($sObject != '..') && ($sObject != '.svn') && ($sObject != 'ldap')) {
|
||||
if (is_file(PATH_RBAC . 'plugins' . PATH_SEP . $sObject)) {
|
||||
$sType = trim(str_replace('class.', '', str_replace('.php', '', $sObject)));
|
||||
$aAuthSourceTypes['sType'] = $sType;
|
||||
$aAuthSourceTypes['sLabel'] = $sType;
|
||||
$arr[] = $aAuthSourceTypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '{sources: '.G::json_encode($arr).'}';
|
||||
break;
|
||||
case 'loadauthSourceData':
|
||||
global $RBAC;
|
||||
|
||||
$fields = $RBAC->getAuthSource($_POST['sUID']);
|
||||
if (is_array($fields['AUTH_SOURCE_DATA'])) {
|
||||
foreach($fields['AUTH_SOURCE_DATA'] as $field => $value) {
|
||||
$fields[$field] = $value;
|
||||
}
|
||||
}
|
||||
unset($fields['AUTH_SOURCE_DATA']);
|
||||
$result->success = true;
|
||||
$result->sources = $fields;
|
||||
print(G::json_encode($result));
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch ( Exception $e ) {
|
||||
|
||||
@@ -48,6 +48,7 @@ $G_ID_MENU_SELECTED = 'USERS';
|
||||
$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES';
|
||||
|
||||
$fields = $RBAC->getAuthSource($_GET['sUID']);
|
||||
|
||||
if (is_array($fields['AUTH_SOURCE_DATA'])) {
|
||||
foreach($fields['AUTH_SOURCE_DATA'] as $field => $value) {
|
||||
$fields[$field] = $value;
|
||||
@@ -65,8 +66,11 @@ if (isset($fields['AUTH_ANONYMOUS'])) {
|
||||
}
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
if ($fields['AUTH_SOURCE_PROVIDER'] == 'ldap') {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'authSources/ldapEdit', '', $fields, '../authSources/authSources_Save');
|
||||
if ($fields['AUTH_SOURCE_PROVIDER'] == 'ldap' ) {
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('authSources/authSourcesEdit', false);
|
||||
$oHeadPublisher->assign('sUID',$_GET['sUID']);
|
||||
G::RenderPage('publish', 'extJs');
|
||||
}
|
||||
else {
|
||||
if (file_exists(PATH_PLUGINS . $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) {
|
||||
@@ -81,4 +85,4 @@ else {
|
||||
}
|
||||
}
|
||||
}
|
||||
G::RenderPage('publish', 'blank');
|
||||
G::RenderPage('publish', 'blank');
|
||||
|
||||
@@ -48,4 +48,4 @@ $oHeadPublisher->addContent('authSources/authSourcesList'); //adding a html file
|
||||
$oHeadPublisher->assign('FORMATS',$c->getFormats());
|
||||
$oHeadPublisher->assign('CONFIG', $Config);
|
||||
G::RenderPage('publish', 'extJs');
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* authSources_New.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
* Copyright (C) 2004 - 2011 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
@@ -22,35 +22,33 @@
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'users';
|
||||
$G_ID_MENU_SELECTED = 'USERS';
|
||||
$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES';
|
||||
|
||||
$fields = array('AUTH_SOURCE_PROVIDER' => $_POST['form']['AUTH_SOURCE_PROVIDER']);
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
if ($_POST['form']['AUTH_SOURCE_PROVIDER'] == 'ldap') {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'authSources/ldapEdit', '', $fields, '../authSources/authSources_Save');
|
||||
}
|
||||
else {
|
||||
if (file_exists(PATH_PLUGINS . $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml', '', $fields, '../authSources/authSources_Save');
|
||||
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
else {
|
||||
if (file_exists(PATH_XMLFORM . 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit', '', $fields, '../authSources/authSources_Save');
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'users';
|
||||
$G_ID_MENU_SELECTED = 'USERS';
|
||||
$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES';
|
||||
|
||||
$fields = array('AUTH_SOURCE_PROVIDER' => $_REQUEST['AUTH_SOURCE_PROVIDER']);
|
||||
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
if (file_exists(PATH_PLUGINS . $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml', '', $fields, '../authSources/authSources_Save');
|
||||
}
|
||||
else {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => 'File: ' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' . ' not exists.'));
|
||||
if (file_exists(PATH_XMLFORM . 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit', '', $fields, '../authSources/authSources_Save');
|
||||
}
|
||||
else {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => 'File: ' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' . ' not exists.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
G::RenderPage('publish','blank');
|
||||
G::RenderPage('publish','blank');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* authSources_SelectType.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||
* Copyright (C) 2004 - 2011 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
@@ -49,5 +49,7 @@ $_DBArray['authSourceTypes'] = $aAuthSourceTypes;
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'authSources/authSources_SelectType', '', '', '../authSources/authSources_New');
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('authSources/authSourcesListNew', false); //adding a javascript file .js
|
||||
G::RenderPage('publish', 'extJs');
|
||||
G::RenderPage('publish','blank');
|
||||
|
||||
44
workflow/engine/methods/authSources/authSources_kindof.php
Executable file
44
workflow/engine/methods/authSources/authSources_kindof.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* authSources_SelectType.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2011 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
}
|
||||
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'users';
|
||||
$G_ID_MENU_SELECTED = 'USERS';
|
||||
$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES';
|
||||
|
||||
$aAuthSourceTypes = array(array('sType' => 'char', 'sLabel' => 'char'));
|
||||
$oDirectory = dir(PATH_RBAC . 'plugins' . PATH_SEP);
|
||||
$G_PUBLISH = new Publisher();
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('authSources/authSourceskindof', true); //adding a javascript file .js
|
||||
$oHeadPublisher->assign('sprovider', $_GET['sprovider']);
|
||||
G::RenderPage('publish', 'extJs');
|
||||
G::RenderPage('publish','blank');
|
||||
425
workflow/engine/templates/authSources/authSourcesEdit.js
Normal file
425
workflow/engine/templates/authSources/authSourcesEdit.js
Normal file
@@ -0,0 +1,425 @@
|
||||
/*
|
||||
* @author Carlos P.C <carlos@colosa.com, pckrlos@gmail.com>
|
||||
* Oct 20th, 2011
|
||||
*/
|
||||
|
||||
Ext.onReady(function(){
|
||||
|
||||
var txtSourceId=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_UID',
|
||||
fieldLabel: 'krlos',
|
||||
xtype:'textfield',
|
||||
value:sUID,
|
||||
width: 200,
|
||||
hideLabel: true,
|
||||
hidden : true,
|
||||
});
|
||||
|
||||
var txtName=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_NAME',
|
||||
fieldLabel: _('ID_NAME'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var my_values = [['ldap'],['Active Directory']];
|
||||
var cboxType = new Ext.form.ComboBox({
|
||||
fieldLabel: _('ID_TYPE'),
|
||||
hiddenName: 'LDAP_TYPE',
|
||||
store: new Ext.data.SimpleStore({
|
||||
fields: ['ldap','ad'],
|
||||
data : my_values
|
||||
}),
|
||||
displayField: 'ldap',
|
||||
typeAhead: true,
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
emptyText:'Choose an option...',
|
||||
selectOnFocus:true,
|
||||
listeners:{
|
||||
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');
|
||||
} else {
|
||||
formAuthSourceE.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var txtServerName=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_SERVER_NAME',
|
||||
fieldLabel: _('ID_SERVER_NAME'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var txtPort=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_PORT',
|
||||
fieldLabel: _('ID_PORT'),
|
||||
xtype:'textfield',
|
||||
value:'389',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '10', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
var my_valuesTLS= [['no'],['yes']];
|
||||
var cboxTLS = new Ext.form.ComboBox({
|
||||
fieldLabel: _('ID_ENABLED_TLS'),
|
||||
hiddenName: 'AUTH_SOURCE_ENABLED_TLS',
|
||||
store: new Ext.data.SimpleStore({
|
||||
fields: ['no','yes'],
|
||||
data : my_valuesTLS
|
||||
}),
|
||||
displayField: 'no',
|
||||
typeAhead: true,
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
emptyText:'Choose an option...',
|
||||
selectOnFocus:true
|
||||
});
|
||||
|
||||
var my_values_version= [['2'],['3']];
|
||||
var cboxVersion = new Ext.form.ComboBox({
|
||||
fieldLabel: _('ID_VERSION'),
|
||||
hiddenName: 'AUTH_SOURCE_VERSION',
|
||||
store: new Ext.data.SimpleStore({
|
||||
fields: ['two','three'],
|
||||
data : my_values_version
|
||||
}),
|
||||
displayField: 'two',
|
||||
typeAhead: true,
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
emptyText:'Choose an option...',
|
||||
selectOnFocus:true
|
||||
});
|
||||
|
||||
|
||||
var txtBaseDN=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_BASE_DN',
|
||||
fieldLabel: _('ID_BASE_DN'),
|
||||
xtype:'textfield',
|
||||
value:sUID,
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '10', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var my_values_Anonymous= [['no'],['yes']];
|
||||
var cboxAnonymous = new Ext.form.ComboBox({
|
||||
fieldLabel: _('ID_ANONYMOUS'),
|
||||
hiddenName: 'AUTH_ANONYMOUS',
|
||||
store: new Ext.data.SimpleStore({
|
||||
fields: ['no','yes'],
|
||||
data : my_values_Anonymous
|
||||
}),
|
||||
displayField: 'no',
|
||||
typeAhead: true,
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
emptyText:'Choose an option...',
|
||||
selectOnFocus:true,
|
||||
// width: 110,
|
||||
listeners:{
|
||||
select: function(c,d,i){
|
||||
if (!i){
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").enable();
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").show();
|
||||
txtSearchUser.getEl().up('.x-form-item').setDisplayed(true);
|
||||
Ext.getCmp("AUTH_SOURCE_PASSWORD").enable();
|
||||
Ext.getCmp("AUTH_SOURCE_PASSWORD").show();
|
||||
txtPassword.getEl().up('.x-form-item').setDisplayed(true);
|
||||
}else{
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").disable();
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").hide();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var txtSearchUser=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_SEARCH_USER',
|
||||
fieldLabel: _('ID_SEARCH_USER'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var txtPassword=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_PASSWORD',
|
||||
fieldLabel: _('ID_CACHE_PASSWORD'),
|
||||
xtype:'textfield',
|
||||
inputType:'password',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Identifier for an imported user
|
||||
var txtIdentifier=new Ext.form.TextField({
|
||||
id: 'AS_INDENTIFIER',
|
||||
fieldLabel: _('ID_IDENTIFIER_IMPORT_USER'),
|
||||
xtype:'textfield',
|
||||
value:'uid',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
//Object Classes
|
||||
var txtaClass=new Ext.form.TextArea({
|
||||
id: 'AUTH_SOURCE_OBJECT_CLASSES',
|
||||
fieldLabel: _('ID_OBJECT_CLASS'),
|
||||
xtype:'textarea',
|
||||
value:'*',
|
||||
width: 200,
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
//Additional Filter
|
||||
var txtoAddFilter=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_ADDITIONAL_FILTER',
|
||||
fieldLabel: _('ID_ADDITIONAL_FILTER'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
//Attributes
|
||||
var txtAttributes=new Ext.form.TextArea({
|
||||
id: 'AUTH_SOURCE_ATTRIBUTES',
|
||||
fieldLabel: _('ID_ATTRIBUTES'),
|
||||
xtype:'textArea',
|
||||
value:'cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile',
|
||||
width: 200,
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
//here we are setting the fields
|
||||
fieldsAS = new Ext.form.FieldSet({
|
||||
title: 'Authentication Source Information',
|
||||
items: [
|
||||
txtSourceId,
|
||||
txtName,
|
||||
cboxType,
|
||||
txtServerName,
|
||||
txtPort,
|
||||
cboxTLS,
|
||||
cboxVersion,
|
||||
txtBaseDN,
|
||||
cboxAnonymous,
|
||||
txtSearchUser,
|
||||
txtPassword ,
|
||||
txtIdentifier,
|
||||
txtaClass,
|
||||
txtoAddFilter,
|
||||
txtAttributes
|
||||
]
|
||||
});
|
||||
|
||||
formAuthSourceE = new Ext.FormPanel({
|
||||
id:'formAuthSourceE',
|
||||
labelWidth: 250,
|
||||
labelAlign:'right',
|
||||
autoScroll: true,
|
||||
fileUpload: true,
|
||||
width:800,
|
||||
bodyStyle:'padding:10px',
|
||||
waitMsgTarget : true,
|
||||
frame: true,
|
||||
defaults: {
|
||||
anchor: '100%',
|
||||
allowBlank: false,
|
||||
resizable: true,
|
||||
msgTarget: 'side',
|
||||
align:'center'
|
||||
},
|
||||
items:[
|
||||
fieldsAS
|
||||
],
|
||||
buttons: [
|
||||
{
|
||||
text: 'Save',
|
||||
handler: saveAuthSources
|
||||
},
|
||||
{
|
||||
text: 'Cancel',
|
||||
handler: goback
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
formAuthSourceE.render(document.body);
|
||||
loadAuthSourceData(sUID, txtSearchUser, txtPassword);
|
||||
|
||||
});
|
||||
function goback(){
|
||||
window.location = 'authSources_List';
|
||||
}
|
||||
function saveAuthSources(){
|
||||
formAuthSourceE.getForm().submit({
|
||||
url: '../adminProxy/saveAuthSources',
|
||||
params: {
|
||||
// action : 'tryit',
|
||||
AUTH_SOURCE_UID: formAuthSourceE.getForm().findField('AUTH_SOURCE_UID').getValue(),
|
||||
AUTH_SOURCE_NAME: formAuthSourceE.getForm().findField('AUTH_SOURCE_NAME').getValue(),
|
||||
LDAP_TYPE: formAuthSourceE.getForm().findField('LDAP_TYPE').getValue(),
|
||||
AUTH_SOURCE_SERVER_NAME: formAuthSourceE.getForm().findField('AUTH_SOURCE_SERVER_NAME').getValue(),
|
||||
AUTH_SOURCE_PORT: formAuthSourceE.getForm().findField('AUTH_SOURCE_PORT').getValue(),
|
||||
AUTH_SOURCE_ENABLED_TLS: formAuthSourceE.getForm().findField('AUTH_SOURCE_ENABLED_TLS').getValue(),
|
||||
AUTH_ANONYMOUS: formAuthSourceE.getForm().findField('AUTH_ANONYMOUS').getValue(),
|
||||
AUTH_SOURCE_SEARCH_USER: formAuthSourceE.getForm().findField('AUTH_SOURCE_SEARCH_USER').getValue(),
|
||||
AUTH_SOURCE_PASSWORD: formAuthSourceE.getForm().findField('AUTH_SOURCE_PASSWORD').getValue(),
|
||||
AUTH_SOURCE_VERSION: formAuthSourceE.getForm().findField('AUTH_SOURCE_VERSION').getValue(),
|
||||
AUTH_SOURCE_BASE_DN: formAuthSourceE.getForm().findField('AUTH_SOURCE_BASE_DN').getValue(),
|
||||
AUTH_SOURCE_OBJECT_CLASSES: formAuthSourceE.getForm().findField('AUTH_SOURCE_OBJECT_CLASSES').getValue(),
|
||||
AUTH_SOURCE_ATTRIBUTES: formAuthSourceE.getForm().findField('AUTH_SOURCE_ATTRIBUTES').getValue()
|
||||
},
|
||||
waitMsg : 'testing...',
|
||||
timeout : 3600,
|
||||
success: function(f,a){
|
||||
|
||||
resp = Ext.util.JSON.decode(a.response.responseText);
|
||||
if (resp.success){
|
||||
window.location = 'authSources_List';
|
||||
}
|
||||
},
|
||||
failure: function(f,a){
|
||||
if (a.failureType === Ext.form.Action.CONNECT_FAILURE){
|
||||
Ext.Msg.alert('Failure', 'Server reported:'+a.response.status+' '+a.response.statusText);
|
||||
}
|
||||
if (a.failureType === Ext.form.Action.SERVER_INVALID){
|
||||
Ext.Msg.alert('Warning', 'you have an error');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Load authosource data for the Edit mode
|
||||
function loadAuthSourceData(sUID, txtSearchUser, txtPassword){
|
||||
Ext.Ajax.request({
|
||||
url: 'authSources_Ajax',
|
||||
params: {
|
||||
'action': 'loadauthSourceData',
|
||||
sUID:sUID
|
||||
},
|
||||
waitMsg: _('ID_UPLOADING_PROCESS_FILE'),
|
||||
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();
|
||||
txtSearchUser.getEl().up('.x-form-item').setDisplayed(true);
|
||||
Ext.getCmp("AUTH_SOURCE_PASSWORD").enable();
|
||||
Ext.getCmp("AUTH_SOURCE_PASSWORD").show();
|
||||
txtPassword.getEl().up('.x-form-item').setDisplayed(true);
|
||||
}else{
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").disable();
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").hide();
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ext.getCmp('formAuthSourceE').getForm().setValues({
|
||||
|
||||
AUTH_SOURCE_UID: data.sources.AUTH_SOURCE_UID,
|
||||
AUTH_SOURCE_NAME: data.sources.AUTH_SOURCE_NAME ,
|
||||
LDAP_TYPE: (data.sources.LDAP_TYPE=='ad')?'Active Directory':data.sources.LDAP_TYPE,
|
||||
AUTH_SOURCE_SERVER_NAME: data.sources.AUTH_SOURCE_SERVER_NAME,
|
||||
AUTH_SOURCE_PORT: data.sources.AUTH_SOURCE_PORT,
|
||||
AUTH_SOURCE_ENABLED_TLS: (data.sources.AUTH_SOURCE_ENABLED_TLS)?'yes':'no',
|
||||
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_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,
|
||||
AUTH_SOURCE_ATTRIBUTES:data.sources.AUTH_SOURCE_ATTRIBUTES,
|
||||
AUTH_SOURCE_ADDITIONAL_FILTER:data.sources.AUTH_SOURCE_ADDITIONAL_FILTER
|
||||
})
|
||||
},
|
||||
|
||||
failure:function(r,o){
|
||||
//viewport.getEl().unmask();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
134
workflow/engine/templates/authSources/authSourcesListNew.js
Executable file
134
workflow/engine/templates/authSources/authSourcesListNew.js
Executable file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* @author Carlos P.C <carlos@colosa.com, pckrlos@gmail.com>
|
||||
* Oct 20th, 2011
|
||||
*/
|
||||
Ext.onReady(function(){
|
||||
|
||||
storeAuthSources = new Ext.data.GroupingStore({
|
||||
autoLoad: true,
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
url: 'authSources_Ajax?action=authSourcesNew&cmb=yes'
|
||||
}),
|
||||
reader : new Ext.data.JsonReader( {
|
||||
root: 'sources',
|
||||
fields: [
|
||||
{name: 'sType'},
|
||||
{name: 'sLabel'}
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
var my_values = [
|
||||
['ldap'],
|
||||
['krlos']
|
||||
];
|
||||
var cboxAuthSourse = new Ext.form.ComboBox({
|
||||
fieldLabel: 'Provider',
|
||||
hiddenName: 'AUTH_SOURCE_PROVIDER',
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
store: storeAuthSources,
|
||||
valueField : 'sType',
|
||||
displayField: 'sLabel',
|
||||
emptyText: 'Choose an option...',
|
||||
width: 160,
|
||||
editable: false,
|
||||
//value: _('ID_ALL'),
|
||||
listeners:{
|
||||
select: function(c,d,i){
|
||||
store.setBaseParam('auths',d.data['sType']);
|
||||
UpdateAuthSource(d.data['sType']);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
componAuthSourse = new Ext.form.FieldSet({
|
||||
title: 'Available Authentication Sourc',
|
||||
items: [
|
||||
cboxAuthSourse
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
formAuthSourceOptoins = new Ext.FormPanel({
|
||||
id:'formAuthSourceOptoins',
|
||||
labelWidth: 250,
|
||||
labelAlign:'right',
|
||||
autoScroll: true,
|
||||
fileUpload: true,
|
||||
width:800,
|
||||
bodyStyle:'padding:10px',
|
||||
waitMsgTarget : true,
|
||||
frame: true,
|
||||
defaults: {
|
||||
anchor: '100%',
|
||||
allowBlank: false,
|
||||
resizable: true,
|
||||
msgTarget: 'side',
|
||||
align:'center'
|
||||
},
|
||||
items:[
|
||||
componAuthSourse,
|
||||
],
|
||||
buttons: [
|
||||
{
|
||||
text: 'Continue',
|
||||
handler: gotypesAuthSources
|
||||
},
|
||||
{
|
||||
text: 'Cancel',
|
||||
handler: goBackform
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
formAuthSourceOptoins.render(document.body);
|
||||
|
||||
});
|
||||
function goBackform(){
|
||||
window.location = 'authSources_List';
|
||||
}
|
||||
function gotypesAuthSources(){
|
||||
/*if(formAuthSourceOptoins.getForm().findField('AUTH_SOURCE_PROVIDER').getValue()=='ldap')
|
||||
window.location = 'authSources_kindof';
|
||||
else
|
||||
window.location = 'authSources_New?AUTH_SOURCE_PROVIDER='+formAuthSourceOptoins.getForm().findField('AUTH_SOURCE_PROVIDER').getValue();
|
||||
return false;*/
|
||||
formAuthSourceOptoins.getForm().submit({
|
||||
url: '../adminProxy/testingOption',
|
||||
params: {
|
||||
action : 'test',
|
||||
optionAuthS: formAuthSourceOptoins.getForm().findField('AUTH_SOURCE_PROVIDER').getValue()
|
||||
},
|
||||
method: 'POST',
|
||||
waitMsg : 'loading...',
|
||||
timeout : 500,
|
||||
success: function(f,a){
|
||||
resp = Ext.util.JSON.decode(a.response.responseText);
|
||||
// alert(resp.optionAuthS);return false;
|
||||
// alert(resp.sUID);return false;
|
||||
if (resp.success){
|
||||
if(resp.optionAuthS=='ldap')
|
||||
// window.location = 'authSources_kindof?sUID='+resp.sUID+'&sprovider='+resp.optionAuthS;
|
||||
window.location = 'authSources_kindof?sprovider='+resp.optionAuthS;
|
||||
else
|
||||
window.location = 'authSources_New?AUTH_SOURCE_PROVIDER='+resp.optionAuthS;
|
||||
}
|
||||
|
||||
},
|
||||
failure: function(f,a){
|
||||
if (a.failureType === Ext.form.Action.CONNECT_FAILURE){
|
||||
Ext.Msg.alert('Failure', 'Server reported:'+a.response.status+' '+a.response.statusText);
|
||||
}
|
||||
if (a.failureType === Ext.form.Action.SERVER_INVALID){
|
||||
Ext.Msg.alert('Warning', 'you have an error');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
386
workflow/engine/templates/authSources/authSourceskindof.js
Normal file
386
workflow/engine/templates/authSources/authSourceskindof.js
Normal file
@@ -0,0 +1,386 @@
|
||||
/*
|
||||
* @author Carlos P.C <carlos@colosa.com, pckrlos@gmail.com>
|
||||
* Oct 20th, 2011
|
||||
*/
|
||||
|
||||
Ext.onReady(function(){
|
||||
|
||||
|
||||
var txtSourceId=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_UID',
|
||||
fieldLabel: 'krlos',
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
hideLabel: true,
|
||||
hidden : true,
|
||||
});
|
||||
|
||||
var txtSourceProvider=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_PROVIDER',
|
||||
fieldLabel: 'krlos',
|
||||
xtype:'textfield',
|
||||
value:sprovider,
|
||||
width: 200,
|
||||
hideLabel: true,
|
||||
hidden : true,
|
||||
});
|
||||
|
||||
var txtName=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_NAME',
|
||||
fieldLabel: _('ID_NAME'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var my_values = [['ldap'],['Active Directory']];
|
||||
var cboxType = new Ext.form.ComboBox({
|
||||
fieldLabel: _('ID_TYPE'),
|
||||
hiddenName: 'LDAP_TYPE',
|
||||
store: new Ext.data.SimpleStore({
|
||||
fields: ['ldap','ad'],
|
||||
data : my_values
|
||||
}),
|
||||
displayField: 'ldap',
|
||||
typeAhead: true,
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
emptyText:'Choose an option...',
|
||||
selectOnFocus:true,
|
||||
listeners:{
|
||||
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');
|
||||
} else {
|
||||
formAuthSource.getForm().findField('AUTH_SOURCE_ATTRIBUTES').setValue('cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var txtServerName=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_SERVER_NAME',
|
||||
fieldLabel: _('ID_SERVER_NAME'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var txtPort=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_PORT',
|
||||
fieldLabel: _('ID_PORT'),
|
||||
xtype:'textfield',
|
||||
value:'389',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '10', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
var my_valuesTLS= [['no'],['yes']];
|
||||
var cboxTLS = new Ext.form.ComboBox({
|
||||
fieldLabel: _('ID_ENABLED_TLS'),
|
||||
hiddenName: 'AUTH_SOURCE_ENABLED_TLS',
|
||||
store: new Ext.data.SimpleStore({
|
||||
fields: ['no','yes'],
|
||||
data : my_valuesTLS
|
||||
}),
|
||||
displayField: 'no',
|
||||
typeAhead: true,
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
emptyText:'Choose an option...',
|
||||
selectOnFocus:true
|
||||
});
|
||||
|
||||
var my_values_version= [['2'],['3']];
|
||||
var cboxVersion = new Ext.form.ComboBox({
|
||||
fieldLabel: _('ID_VERSION'),
|
||||
hiddenName: 'AUTH_SOURCE_VERSION',
|
||||
store: new Ext.data.SimpleStore({
|
||||
fields: ['two','three'],
|
||||
data : my_values_version
|
||||
}),
|
||||
displayField: 'two',
|
||||
typeAhead: true,
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
emptyText:'Choose an option...',
|
||||
selectOnFocus:true
|
||||
});
|
||||
|
||||
|
||||
var txtBaseDN=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_BASE_DN',
|
||||
fieldLabel: _('ID_BASE_DN'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '10', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var my_values_Anonymous= [['no'],['yes']];
|
||||
var cboxAnonymous = new Ext.form.ComboBox({
|
||||
fieldLabel: _('ID_ANONYMOUS'),
|
||||
hiddenName: 'AUTH_ANONYMOUS',
|
||||
store: new Ext.data.SimpleStore({
|
||||
fields: ['0','1'],
|
||||
data : my_values_Anonymous
|
||||
}),
|
||||
displayField: '0',
|
||||
typeAhead: true,
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
emptyText:'Choose an option...',
|
||||
selectOnFocus:true,
|
||||
// width: 110,
|
||||
listeners:{
|
||||
select: function(c,d,i){
|
||||
if (!i){
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").enable();
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").show();
|
||||
txtSearchUser.getEl().up('.x-form-item').setDisplayed(true);
|
||||
Ext.getCmp("AUTH_SOURCE_PASSWORD").enable();
|
||||
Ext.getCmp("AUTH_SOURCE_PASSWORD").show();
|
||||
txtPassword.getEl().up('.x-form-item').setDisplayed(true);
|
||||
}else{
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").disable();
|
||||
Ext.getCmp("AUTH_SOURCE_SEARCH_USER").hide();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var txtSearchUser=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_SEARCH_USER',
|
||||
fieldLabel: _('ID_SEARCH_USER'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var txtPassword=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_PASSWORD',
|
||||
fieldLabel: _('ID_CACHE_PASSWORD'),
|
||||
xtype:'textfield',
|
||||
inputType:'password',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Identifier for an imported user
|
||||
var txtIdentifier=new Ext.form.TextField({
|
||||
id: 'AS_INDENTIFIER',
|
||||
fieldLabel: _('ID_IDENTIFIER_IMPORT_USER'),
|
||||
xtype:'textfield',
|
||||
value:'uid',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
//Object Classes
|
||||
var txtaClass=new Ext.form.TextArea({
|
||||
id: 'AUTH_SOURCE_OBJECT_CLASSES',
|
||||
fieldLabel: _('ID_OBJECT_CLASS'),
|
||||
xtype:'textarea',
|
||||
value:'*',
|
||||
width: 200,
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
//Additional Filter
|
||||
var txtoAddFilter=new Ext.form.TextField({
|
||||
id: 'AUTH_SOURCE_ADDITIONAL_FILTER',
|
||||
fieldLabel: _('ID_ADDITIONAL_FILTER'),
|
||||
xtype:'textfield',
|
||||
value:'',
|
||||
width: 200,
|
||||
autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '13'},
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
//Attributes
|
||||
var txtAttributes=new Ext.form.TextArea({
|
||||
id: 'AUTH_SOURCE_ATTRIBUTES',
|
||||
fieldLabel: _('ID_ATTRIBUTES'),
|
||||
xtype:'textArea',
|
||||
value:'cn' + "\n" + 'uid' + "\n" + 'givenname' + "\n" + 'sn' + "\n" + 'mail' + "\n" + 'mobile',
|
||||
width: 200,
|
||||
allowBlank: false,
|
||||
listeners: {
|
||||
'render': function(c) {
|
||||
c.getEl().on('keyup', function() {
|
||||
}, c);
|
||||
}
|
||||
}
|
||||
});
|
||||
//here we are setting the fields
|
||||
fieldsAS = new Ext.form.FieldSet({
|
||||
title: 'Authentication Source Information',
|
||||
items: [
|
||||
txtSourceId,
|
||||
txtSourceProvider,
|
||||
txtName,
|
||||
cboxType,
|
||||
txtServerName,
|
||||
txtPort,
|
||||
cboxTLS,
|
||||
cboxVersion,
|
||||
txtBaseDN,
|
||||
cboxAnonymous,
|
||||
txtSearchUser,
|
||||
txtPassword ,
|
||||
txtIdentifier,
|
||||
txtaClass,
|
||||
txtoAddFilter,
|
||||
txtAttributes
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
formAuthSource = new Ext.FormPanel({
|
||||
id:'formAuthSource',
|
||||
labelWidth: 250,
|
||||
labelAlign:'right',
|
||||
autoScroll: true,
|
||||
fileUpload: true,
|
||||
width:800,
|
||||
bodyStyle:'padding:10px',
|
||||
waitMsgTarget : true,
|
||||
frame: true,
|
||||
defaults: {
|
||||
anchor: '100%',
|
||||
allowBlank: false,
|
||||
resizable: true,
|
||||
msgTarget: 'side',
|
||||
align:'center'
|
||||
},
|
||||
items:[
|
||||
fieldsAS
|
||||
],
|
||||
buttons: [
|
||||
{
|
||||
text: 'Save',
|
||||
handler: TestSite
|
||||
|
||||
},
|
||||
{
|
||||
text: 'Cancel',
|
||||
handler: goback
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
formAuthSource.render(document.body);
|
||||
|
||||
});
|
||||
function goback(){
|
||||
window.location = 'authSources_List';
|
||||
}
|
||||
function TestSite(){
|
||||
formAuthSource.getForm().submit({
|
||||
url: '../adminProxy/saveAuthSources',
|
||||
params: {
|
||||
// action : 'tryit',
|
||||
AUTH_SOURCE_UID: formAuthSource.getForm().findField('AUTH_SOURCE_UID').getValue(),
|
||||
AUTH_SOURCE_NAME: formAuthSource.getForm().findField('AUTH_SOURCE_NAME').getValue(),
|
||||
LDAP_TYPE: formAuthSource.getForm().findField('LDAP_TYPE').getValue(),
|
||||
AUTH_SOURCE_SERVER_NAME: formAuthSource.getForm().findField('AUTH_SOURCE_SERVER_NAME').getValue(),
|
||||
AUTH_SOURCE_PORT: formAuthSource.getForm().findField('AUTH_SOURCE_PORT').getValue(),
|
||||
AUTH_SOURCE_ENABLED_TLS: formAuthSource.getForm().findField('AUTH_SOURCE_ENABLED_TLS').getValue(),
|
||||
AUTH_ANONYMOUS: formAuthSource.getForm().findField('AUTH_ANONYMOUS').getValue(),
|
||||
AUTH_SOURCE_SEARCH_USER: formAuthSource.getForm().findField('AUTH_SOURCE_SEARCH_USER').getValue(),
|
||||
AUTH_SOURCE_PASSWORD: formAuthSource.getForm().findField('AUTH_SOURCE_PASSWORD').getValue(),
|
||||
AUTH_SOURCE_VERSION: formAuthSource.getForm().findField('AUTH_SOURCE_VERSION').getValue(),
|
||||
AUTH_SOURCE_BASE_DN: formAuthSource.getForm().findField('AUTH_SOURCE_BASE_DN').getValue(),
|
||||
AUTH_SOURCE_OBJECT_CLASSES: formAuthSource.getForm().findField('AUTH_SOURCE_OBJECT_CLASSES').getValue(),
|
||||
AUTH_SOURCE_ATTRIBUTES: formAuthSource.getForm().findField('AUTH_SOURCE_ATTRIBUTES').getValue(),
|
||||
AUTH_SOURCE_ADDITIONAL_FILTER: formAuthSource.getForm().findField('AUTH_SOURCE_ADDITIONAL_FILTER').getValue()
|
||||
|
||||
},
|
||||
waitMsg : 'testing...',
|
||||
timeout : 3600,
|
||||
success: function(f,a){
|
||||
|
||||
resp = Ext.util.JSON.decode(a.response.responseText);
|
||||
if (resp.success){
|
||||
window.location = 'authSources_List';
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
failure: function(f,a){
|
||||
if (a.failureType === Ext.form.Action.CONNECT_FAILURE){
|
||||
Ext.Msg.alert('Failure', 'Server reported:'+a.response.status+' '+a.response.statusText);
|
||||
}
|
||||
if (a.failureType === Ext.form.Action.SERVER_INVALID){
|
||||
Ext.Msg.alert('Warning', 'you have an error');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user