PM-1060: Second migration ldapAdvanced

This commit is contained in:
Paula V. Quispe
2015-06-11 11:08:56 -04:00
parent 4d011b4174
commit 952a7f5d31
7 changed files with 643 additions and 26 deletions

View File

@@ -83,17 +83,8 @@ if ($fields['AUTH_SOURCE_PROVIDER'] == 'ldap') {
$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' )) {
$pluginEnabled = 0;
if (file_exists(PATH_PLUGINS . $fields["AUTH_SOURCE_PROVIDER"] . ".php")) {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginDetail = $pluginRegistry->getPluginDetails($fields["AUTH_SOURCE_PROVIDER"] . ".php");
if ($pluginDetail && $pluginDetail->enabled) {
$pluginEnabled = 1;
}
}
if (file_exists( PATH_XMLFORM . 'ldapAdvanced/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' )) {
$pluginEnabled = 1;
if ($pluginEnabled == 1) {
//The attributes the users
@@ -110,17 +101,17 @@ if ($fields['AUTH_SOURCE_PROVIDER'] == 'ldap') {
}
$fields["AUTH_SOURCE_ATTRIBUTE_IDS"] = $attributes;
if (file_exists(PATH_PLUGINS . $fields["AUTH_SOURCE_PROVIDER"] . PATH_SEP . $fields["AUTH_SOURCE_PROVIDER"] . 'Flag')) {
if (file_exists(PATH_XMLFORM . 'ldapAdvanced/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Flag')) {
$oHeadPublisher = & headPublisher::getSingleton ();
$oHeadPublisher->assign("Fields", $fields);
$oHeadPublisher->addExtJsScript (PATH_PLUGINS . $fields["AUTH_SOURCE_PROVIDER"] . PATH_SEP . 'js' . PATH_SEP . 'library', false, true );
$oHeadPublisher->addExtJsScript (PATH_PLUGINS . $fields["AUTH_SOURCE_PROVIDER"] . PATH_SEP . 'js' . PATH_SEP . 'ldapAdvancedForm', false, true );
$oHeadPublisher->addExtJsScript (PATH_PLUGINS . $fields["AUTH_SOURCE_PROVIDER"] . PATH_SEP . 'js' . PATH_SEP . 'ldapAdvancedList', false, true );
$oHeadPublisher->addExtJsScript (PATH_TPL. 'ldapAdvanced/library.js', false, true );
$oHeadPublisher->addExtJsScript (PATH_TPL. 'ldapAdvanced/ldapAdvancedForm', false, true );
$oHeadPublisher->addExtJsScript (PATH_TPL. 'ldapAdvanced/ldapAdvancedList', false, true );
G::RenderPage ('publish', 'extJs');
die();
}
$G_PUBLISH->AddContent("xmlform", "xmlform", $fields["AUTH_SOURCE_PROVIDER"] . PATH_SEP . $fields["AUTH_SOURCE_PROVIDER"] . "Edit", "", $fields, "../authSources/authSources_Save");
$G_PUBLISH->AddContent("xmlform", "xmlform", 'ldapAdvanced/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit', '', $fields, '../authSources/authSources_Save');
} else {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => G::LoadTranslation( 'ID_AUTH_SOURCE_MISSING' )
) );

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,46 @@
var synchronizeDepartmentsLDAPADV = function() {
iGrid = Ext.getCmp('infoGrid');
rowSelected = iGrid.getSelectionModel().getSelected();
if (rowSelected) {
location.href = '../ldapAdvanced/authSourcesSynchronize?authUid=' + rowSelected.data.AUTH_SOURCE_UID + '&tab=synchronizeDepartments';
}
};
var synchronizeGroupsLDAPADV = function() {
iGrid = Ext.getCmp('infoGrid');
rowSelected = iGrid.getSelectionModel().getSelected();
if (rowSelected) {
location.href = '../ldapAdvanced/authSourcesSynchronize?authUid=' + rowSelected.data.AUTH_SOURCE_UID + '&tab=synchronizeGroups';
}
};
var synchronizeDepartmentsButtonLDAPADV = new Ext.Action({
text: 'Synchronize Departments',
iconCls: 'ICON_DEPARTAMENTS',
disabled: true,
handler: synchronizeDepartmentsLDAPADV
});
var synchronizeGroupsButtonLDAPADV = new Ext.Action({
text: 'Synchronize Groups',
iconCls: 'ICON_GROUPS',
disabled: true,
handler: synchronizeGroupsLDAPADV
});
var _rowselectLDAPADV = function(sm, index, record) {
if (record.get('AUTH_SOURCE_PROVIDER') == 'ldapAdvanced') {
synchronizeDepartmentsButtonLDAPADV.enable();
synchronizeGroupsButtonLDAPADV.enable();
}
};
var _rowdeselectLDAPADV = function(sm, index, record) {
synchronizeDepartmentsButtonLDAPADV.disable();
synchronizeGroupsButtonLDAPADV.disable();
};
_rowselect.push(_rowselectLDAPADV);
_rowdeselect.push(_rowdeselectLDAPADV);
_pluginActionButtons.push(synchronizeDepartmentsButtonLDAPADV);
_pluginActionButtons.push(synchronizeGroupsButtonLDAPADV);

View File

@@ -0,0 +1,3 @@
<div style="padding: 15px">
<div id="list-panel"></div>
</div>

View File

@@ -0,0 +1,229 @@
var viewPort;
var backButton;
var northPanel;
var tabsPanel;
var departmentsPanel;
var groupsPanel;
var treeDepartments;
var treeGroups;
var isSaved = true;
var isFirstTime = true;
Ext.onReady(function() {
nodeChangeCheck = function (node, check)
{
if (node) {
if (node.hasChildNodes()) {
node.eachChild(function (n) { nodeChangeCheck(n, check); });
}
//node.expand();
node.getUI().toggleCheck(check);
}
}
nodeChangeCheckStart = function (node, check)
{
treeDepartments.removeListener("checkchange", nodeChangeCheckStart, this);
nodeChangeCheck(node, check);
treeDepartments.addListener("checkchange", nodeChangeCheckStart, this);
}
try {
Ext.Ajax.timeout = 300000;
backButton = new Ext.Action({
text : _('ID_BACK'),
iconCls: "button_menu_ext ss_sprite ss_arrow_left",
handler: function() {
location.href = '../authSources/authSources_List';
}
});
northPanel = new Ext.Panel({
region: 'north',
xtype: 'panel',
tbar: ['<b>'+ 'Authentication Sources' + '</b>', {xtype: 'tbfill'}, backButton]
});
treeDepartments = new Ext.tree.TreePanel({
title: 'Departments List',
defaults: {flex: 1},
useArrows: true,
autoScroll: true,
animate: true,
enableDD: true,
containerScroll: true,
rootVisible: false,
frame: true,
root: {
nodeType: 'async'
},
maskDisabled: false,
dataUrl: 'authSourcesSynchronizeAjax?m=loadDepartments&authUid=' + AUTHENTICATION_SOURCE.AUTH_SOURCE_UID,
requestMethod: 'POST',
buttons: [{
text: 'Save Changes',
handler: function() {
isSaved = false;
var msg = '', selNodes = treeDepartments.getChecked();
treeDepartments.disabled = true;
var departments = [];
Ext.each(selNodes, function(node) {
departments.push(node.id);
});
Ext.Ajax.request({
url: 'authSourcesSynchronizeAjax',
params: {m: 'saveDepartments', authUid: AUTHENTICATION_SOURCE.AUTH_SOURCE_UID, departmentsDN: departments.join('|')},
success: function(r) {
var response = Ext.util.JSON.decode(r.responseText);
if (response.status == 'OK') {
treeDepartments.getLoader().load(treeDepartments.root);
}
else {
alert(response.message);
}
}
});
}
}],
listeners: {
checkchange: nodeChangeCheckStart
}
});
treeDepartments.loader.on('load', function() {
treeDepartments.getRootNode().expand(true);
if (!isSaved) {
isSaved = true;
treeDepartments.disabled = false;
Ext.Msg.show({
title: 'Changes saved.',
msg: 'All changes have been saved.',
icon: Ext.Msg.INFO,
minWidth: 200,
buttons: Ext.Msg.OK
});
}
});
treeGroups = new Ext.tree.TreePanel({
title: 'Groups List',
defaults: {flex: 1},
useArrows: true,
autoScroll: true,
animate: true,
enableDD: true,
containerScroll: true,
rootVisible: false,
frame: true,
root: {
nodeType: 'async'
},
dataUrl: 'authSourcesSynchronizeAjax?m=loadGroups&authUid=' + AUTHENTICATION_SOURCE.AUTH_SOURCE_UID,
requestMethod: 'POST',
buttons: [{
text: 'Save Changes',
handler: function() {
isSaved = false;
var msg = '', selNodes = treeGroups.getChecked();
treeGroups.disabled = true;
this.disabled = true;
var Groups = [];
Ext.each(selNodes, function(node) {
Groups.push(node.id);
});
Ext.Ajax.request({
url: 'authSourcesSynchronizeAjax',
params: {m: 'saveGroups', authUid: AUTHENTICATION_SOURCE.AUTH_SOURCE_UID, groupsDN: Groups.join('|')},
success: function(r) {
var response = Ext.util.JSON.decode(r.responseText);
if (response.status == 'OK') {
treeGroups.getLoader().load(treeGroups.root);
}
else {
alert(response.message);
}
}
});
}
}]
});
treeGroups.loader.on('load', function() {
treeGroups.getRootNode().expand(true);
if (!isSaved) {
isSaved = true;
treeGroups.disabled = false;
treeGroups.buttons[0].disabled = false;
Ext.Msg.show({
title: 'Changes saved.',
msg: 'All changes have been saved.',
icon: Ext.Msg.INFO,
minWidth: 200,
buttons: Ext.Msg.OK
});
}
});
departmentsPanel = new Ext.Panel({
title: 'Synchronize Departments',
autoWidth: true,
layout: 'hbox',
defaults: {flex: 1},
layoutConfig: {align: 'stretch'},
items: [treeDepartments],
viewConfig: {forceFit: true}
});
groupsPanel = new Ext.Panel({
title: 'Synchronize Groups',
autoWidth: true,
layout: 'hbox',
defaults: {flex: 1},
layoutConfig: {align: 'stretch'},
items: [treeGroups],
viewConfig: {forceFit: true}
});
tabsPanel = new Ext.TabPanel({
region: 'center',
activeTab: AUTHENTICATION_SOURCE.CURRENT_TAB,
items:[departmentsPanel, groupsPanel],
listeners:{
beforetabchange: function(p, t, c) {
if (typeof(t.body) == 'undefined') {
isFirstTime = true;
}
},
tabchange: function(p, t) {
if (!isFirstTime) {
switch(t.title){
case 'Synchronize Departments':
treeDepartments.getLoader().load(treeDepartments.root);
break;
case 'Synchronize Groups':
treeGroups.getLoader().load(treeGroups.root);
break;
}
}
else {
isFirstTime = false;
}
}
}
});
viewport = new Ext.Viewport({
layout: 'border',
items: [northPanel, tabsPanel]
});
}
catch (error) {
alert('->' + error + '<-');
}
});

View File

@@ -26,11 +26,11 @@ Ext.onReady(function() {
var ldapGridProxy = new Ext.data.HttpProxy({
method: 'POST',
api: {
read : '../controllers/ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=read',
create : '../controllers/ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=create',
save : '../controllers/ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=save',
destroy : '../controllers/ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=destroy',
update : '../controllers/ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=update'
read : 'ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=read',
create : 'ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=create',
save : 'ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=save',
destroy : 'ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=destroy',
update : 'ldapAdvancedProxy.php?functionAccion=ldapGrid&tipo=update'
}
});
@@ -291,7 +291,7 @@ Ext.onReady(function() {
};
var ldapForm = new Ext.FormPanel({
url : '../controllers/ldapAdvancedProxy.php?functionAccion=ldapSave',
url : 'ldapAdvancedProxy.php?functionAccion=ldapSave',
frame : true,
title : "Authentication Source Information",
border : false,
@@ -338,7 +338,7 @@ Ext.onReady(function() {
{
if (typeof(Fields.AUTH_SOURCE_UID) != "undefined" && typeof(Fields.AUTH_SOURCE_BASE_DN) != "undefined" && ldapFormBaseDN.getValue() != Fields.AUTH_SOURCE_BASE_DN) {
Ext.Ajax.request({
url: "../controllers/ldapAdvancedProxy.php",
url: "ldapAdvancedProxy.php",
method: "POST",
params: {
functionAccion: "ldapVerifyIfExistsRecordsInDb",
@@ -387,7 +387,7 @@ Ext.onReady(function() {
loadMaskAux.show();
Ext.Ajax.request({
url: "../controllers/ldapAdvancedProxy.php",
url: "ldapAdvancedProxy.php",
method: "POST",
params: {
functionAccion: "ldapTestConnection",

View File

@@ -89,7 +89,7 @@ Ext.onReady(function() {
var storeGridSearch = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
method: 'POST',
url: '../controllers/ldapAdvancedProxy.php',
url: 'ldapAdvancedProxy.php',
timeout: 240000
}),
autoDestroy: true,
@@ -177,7 +177,7 @@ Ext.onReady(function() {
'functionAccion': 'importUsers',
'AUTH_SOURCE_UID': Fields.AUTH_SOURCE_UID
},
url : '../controllers/ldapAdvancedProxy.php',
url : 'ldapAdvancedProxy.php',
success: function (returnData) {
var resp = Ext.decode(returnData.responseText);
Ext.MessageBox.hide();