Skip to content
Snippets Groups Projects
Commit 862a75f8 authored by Robert Anderson's avatar Robert Anderson
Browse files

Small cosmetic changes

Link group to user
Remove user attribute fixes
parent 3c524d66
No related branches found
No related tags found
No related merge requests found
...@@ -96,8 +96,8 @@ ...@@ -96,8 +96,8 @@
# Build hash and push into param list # Build hash and push into param list
$search = array( $search = array(
'Filter' => isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '', 'Filter' => isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '',
'Start' => $_REQUEST['start'], 'Start' => isset($_REQUEST['start']) ? $_REQUEST['start'] : NULL,
'Limit' => $_REQUEST['limit'], 'Limit' => isset($_REQUEST['limit']) ? $_REQUEST['limit'] : NULL,
'Sort' => isset($_REQUEST['sort']) ? $_REQUEST['sort'] : '', 'Sort' => isset($_REQUEST['sort']) ? $_REQUEST['sort'] : '',
'SortDirection' => isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '', 'SortDirection' => isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '',
); );
...@@ -150,7 +150,16 @@ ...@@ -150,7 +150,16 @@
switch ($function) { switch ($function) {
# AdminUserGroups.js functions # addAdminUserGroup.js functions
case "addAdminUserGroup":
$res = addAdminUserGroup($soapParams);
if (isset($res)) {
ajaxException($res);
}
break;
case "removeAdminUserGroup": case "removeAdminUserGroup":
$res = removeAdminUserGroup($soapParams); $res = removeAdminUserGroup($soapParams);
...@@ -195,6 +204,15 @@ ...@@ -195,6 +204,15 @@
echo json_encode($res->export()); echo json_encode($res->export());
break; break;
case "removeAdminUserAttribute":
$res = removeAdminUserAttribute($soapParams);
if (isset($res)) {
ajaxException($res);
}
break;
# WiSPUsers.js functions # WiSPUsers.js functions
case "updateWiSPUser": case "updateWiSPUser":
......
...@@ -3,6 +3,18 @@ ...@@ -3,6 +3,18 @@
include_once("include/db.php"); include_once("include/db.php");
# Remove user attribute
function removeAdminUserAttribute($params) {
global $db;
$res = DBDo("DELETE FROM user_attributes WHERE ID = ?",array($params[0]));
if (!is_numeric($res)) {
return $res;
}
return NULL;
}
# Return list of attributes # Return list of attributes
function getAdminUserAttributes($params) { function getAdminUserAttributes($params) {
global $db; global $db;
......
...@@ -3,6 +3,18 @@ ...@@ -3,6 +3,18 @@
include_once("include/db.php"); include_once("include/db.php");
# Link user to group
function addAdminUserGroup($params) {
global $db;
$res = DBDo("INSERT INTO users_to_groups (UserID,GroupID) VALUES (?,?)",array($params[0]['UserID'],$params[0]['GroupID']));
if (!is_numeric($res)) {
return $res;
}
return NULL;
}
# Unlink user from group # Unlink user from group
function removeAdminUserGroup($params) { function removeAdminUserGroup($params) {
global $db; global $db;
......
...@@ -222,14 +222,14 @@ function showAdminGroupAddEditWindow(id) { ...@@ -222,14 +222,14 @@ function showAdminGroupAddEditWindow(id) {
// Display edit/add form // Display edit/add form
function showAdminGroupRemoveWindow(parent,id) { function showAdminUserAttributeRemoveWindow(parent,id) {
// Mask parent window // Mask parent window
parent.getEl().mask(); parent.getEl().mask();
// Display remove confirm window // Display remove confirm window
Ext.Msg.show({ Ext.Msg.show({
title: "Confirm removal", title: "Confirm removal",
msg: "Are you very sure you wish to remove this group?", msg: "Are you very sure you wish to remove this attribute?",
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.YESNO, buttons: Ext.Msg.YESNO,
modal: false, modal: false,
...@@ -244,8 +244,8 @@ function showAdminGroupRemoveWindow(parent,id) { ...@@ -244,8 +244,8 @@ function showAdminGroupRemoveWindow(parent,id) {
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password, SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype, SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminGroups', SOAPModule: 'AdminUserAttributes',
SOAPFunction: 'removeAdminGroup', SOAPFunction: 'removeAdminUserAttribute',
SOAPParams: 'ID' SOAPParams: 'ID'
} }
}); });
......
function showAdminUserGroupsWindow(id) { function showAdminUserGroupsWindow(userID) {
var AdminUserGroupsWindow = new Ext.ux.GenericGridWindow( var AdminUserGroupsWindow = new Ext.ux.GenericGridWindow(
// Window config // Window config
...@@ -22,7 +22,7 @@ function showAdminUserGroupsWindow(id) { ...@@ -22,7 +22,7 @@ function showAdminUserGroupsWindow(id) {
tooltip:'Add group', tooltip:'Add group',
iconCls:'add', iconCls:'add',
handler: function() { handler: function() {
showAdminUserGroupAddEditWindow(); showAdminUserGroupAddWindow(userID);
} }
}, },
'-', '-',
...@@ -73,7 +73,7 @@ function showAdminUserGroupsWindow(id) { ...@@ -73,7 +73,7 @@ function showAdminUserGroupsWindow(id) {
// Store config // Store config
{ {
baseParams: { baseParams: {
ID: id, ID: userID,
SOAPUsername: globalConfig.soap.username, SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password, SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype, SOAPAuthType: globalConfig.soap.authtype,
...@@ -96,7 +96,7 @@ function showAdminUserGroupsWindow(id) { ...@@ -96,7 +96,7 @@ function showAdminUserGroupsWindow(id) {
// Display edit/add form // Display edit/add form
function showAdminGroupAddEditWindow(id) { function showAdminUserGroupAddWindow(userID,id) {
var submitAjaxConfig; var submitAjaxConfig;
...@@ -108,15 +108,17 @@ function showAdminGroupAddEditWindow(id) { ...@@ -108,15 +108,17 @@ function showAdminGroupAddEditWindow(id) {
SOAPFunction: 'updateAdminGroup', SOAPFunction: 'updateAdminGroup',
SOAPParams: SOAPParams:
'0:ID,'+ '0:ID,'+
'0:Name' '0:GroupID'
}; };
// We doing an Add // We doing an Add
} else { } else {
submitAjaxConfig = { submitAjaxConfig = {
SOAPFunction: 'createAdminGroup', UserID: userID,
SOAPFunction: 'addAdminUserGroup',
SOAPParams: SOAPParams:
'0:Name' '0:UserID,'+
'0:GroupID'
}; };
} }
...@@ -143,11 +145,30 @@ function showAdminGroupAddEditWindow(id) { ...@@ -143,11 +145,30 @@ function showAdminGroupAddEditWindow(id) {
}, },
items: [ items: [
{ {
fieldLabel: 'Name', xtype: 'combo',
name: 'Name', //id: 'combo',
vtype: 'usernamePart', fieldLabel: 'Group',
maskRe: usernamePartRe, name: 'Group',
allowBlank: false allowBlank: false,
width: 160,
store: new Ext.ux.JsonStore({
sortInfo: { field: "Name", direction: "ASC" },
baseParams: {
SOAPUsername: globalConfig.soap.username,
SOAPPassword: globalConfig.soap.password,
SOAPAuthType: globalConfig.soap.authtype,
SOAPModule: 'AdminUserGroups',
SOAPFunction: 'getAdminGroups',
SOAPParams: '__null,__search'
}
}),
displayField: 'Name',
valueField: 'ID',
hiddenName: 'GroupID',
forceSelection: true,
triggerAction: 'all',
editable: false
}, },
], ],
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment