Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
smradius
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shail
smradius
Commits
37a84136
Commit
37a84136
authored
15 years ago
by
Robert Anderson
Browse files
Options
Downloads
Patches
Plain Diff
Fixed up WiSPUsers to use UserID
parent
9b4f4f8e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webgui/include/ajax/functions/WiSPUsers.php
+145
-0
145 additions, 0 deletions
webgui/include/ajax/functions/WiSPUsers.php
webgui/js/app/windows/WiSPUsers.js
+26
-172
26 additions, 172 deletions
webgui/js/app/windows/WiSPUsers.js
with
171 additions
and
172 deletions
webgui/include/ajax/functions/WiSPUsers.php
0 → 100644
+
145
−
0
View file @
37a84136
<?php
include_once
(
"include/db.php"
);
# Return list of wisp users
function
getWiSPUsers
(
$params
)
{
global
$db
;
# Filters and sorts are the same here
$filtersorts
=
array
(
'Username'
=>
'users.Username'
,
'Disabled'
=>
'users.Disabled'
,
'ID'
=>
'wisp_userdata.UserID'
,
'Firstname'
=>
'wisp_userdata.Firstname'
,
'Lastname'
=>
'wisp_userdata.Lastname'
,
'Email'
=>
'wisp_userdata.Email'
,
'Phone'
=>
'wisp_userdata.Phone'
);
$res
=
DBSelectSearch
(
"
SELECT
users.Username,
users.Disabled,
wisp_userdata.UserID,
wisp_userdata.FirstName,
wisp_userdata.LastName,
wisp_userdata.Email,
wisp_userdata.Phone
FROM
users, wisp_userdata
WHERE
wisp_userdata.UserID = users.ID
"
,
$params
[
1
],
$filtersorts
,
$filtersorts
);
$sth
=
$res
[
0
];
$numResults
=
$res
[
1
];
# If STH is blank, return the error back to whoever requested the data
if
(
!
isset
(
$sth
))
{
return
$res
;
}
$resultArray
=
array
();
# loop through rows
while
(
$row
=
$sth
->
fetchObject
())
{
$item
=
array
();
$item
[
'ID'
]
=
$row
->
userid
;
$item
[
'Username'
]
=
$row
->
username
;
$item
[
'Disabled'
]
=
$row
->
disabled
;
$item
[
'Firstname'
]
=
$row
->
firstname
;
$item
[
'Lastname'
]
=
$row
->
lastname
;
$item
[
'Email'
]
=
$row
->
email
;
$item
[
'Phone'
]
=
$row
->
phone
;
# push this row onto array
array_push
(
$resultArray
,
$item
);
}
return
array
(
$resultArray
,
$numResults
);
}
# Return specific wisp user row
function
getWiSPUser
(
$params
)
{
global
$db
;
$res
=
DBSelect
(
"SELECT ID, Username FROM users WHERE ID = ?"
,
array
(
$params
[
0
]));
if
(
!
is_object
(
$res
))
{
return
$res
;
}
$resultArray
=
array
();
$row
=
$res
->
fetchObject
();
$resultArray
[
'ID'
]
=
$row
->
id
;
$resultArray
[
'Username'
]
=
$row
->
username
;
return
$resultArray
;
}
# Remove wisp user
function
removeWiSPUser
(
$params
)
{
global
$db
;
DBBegin
();
$res
=
DBDo
(
"DELETE FROM wisp_userdata WHERE UserID = ?"
,
array
(
$params
[
0
]));
if
(
$res
!==
FALSE
)
{
$res
=
DBDo
(
"DELETE FROM users WHERE ID = ?"
,
array
(
$params
[
0
]));
}
else
{
DBRollback
();
return
$res
;
}
if
(
$res
!==
FALSE
)
{
DBCommit
();
return
$res
;
}
else
{
DBRollback
();
}
return
NULL
;
}
# Add wisp user
function
createWiSPUser
(
$params
)
{
global
$db
;
DBBegin
();
$res
=
DBDo
(
"INSERT INTO users (Username) VALUES (?)"
,
array
(
$params
[
0
][
'Username'
]));
if
(
$res
!==
FALSE
)
{
$userID
=
DBLastInsertID
();
$res
=
DBDo
(
"INSERT INTO wisp_userdata (UserID) VALUES (?)"
,
array
(
$userID
));
}
if
(
$res
!==
FALSE
)
{
DBCommit
();
return
$res
;
}
else
{
DBRollback
();
}
# if (!is_numeric($res)) {
# return $res;
# }
return
NULL
;
}
# Edit admin group
function
updateWiSPUser
(
$params
)
{
global
$db
;
$res
=
DBDo
(
"UPDATE users SET Username = ? WHERE ID = ?"
,
array
(
$params
[
0
][
'Username'
],
$params
[
0
][
'ID'
]));
if
(
!
is_numeric
(
$res
))
{
return
$res
;
}
return
NULL
;
}
?>
This diff is collapsed.
Click to expand it.
webgui/js/app/windows/WiSPUsers.js
+
26
−
172
View file @
37a84136
...
@@ -142,42 +142,42 @@ function showWiSPUserWindow() {
...
@@ -142,42 +142,42 @@ function showWiSPUserWindow() {
colModel
:
new
Ext
.
grid
.
ColumnModel
([
colModel
:
new
Ext
.
grid
.
ColumnModel
([
{
{
id
:
'
ID
'
,
id
:
'
ID
'
,
header
:
"
ID
"
,
header
:
"
User
ID
"
,
sortable
:
true
,
sortable
:
true
,
dataIndex
:
'
ID
'
dataIndex
:
'
ID
'
},
},
{
{
header
:
"
AgentN
ame
"
,
header
:
"
Usern
ame
"
,
sortable
:
true
,
sortable
:
true
,
dataIndex
:
'
AgentN
ame
'
dataIndex
:
'
Usern
ame
'
},
},
{
{
header
:
"
Username
"
,
header
:
"
Disabled
"
,
sortable
:
true
,
sortable
:
true
,
dataIndex
:
'
Username
'
dataIndex
:
'
Disabled
'
},
},
{
{
header
:
"
Servic
e
"
,
header
:
"
First Nam
e
"
,
sortable
:
true
,
sortable
:
true
,
dataIndex
:
'
Servic
e
'
dataIndex
:
'
Firstnam
e
'
},
},
{
{
header
:
"
Usage Cap
"
,
header
:
"
Last Name
"
,
sortable
:
true
,
sortable
:
true
,
dataIndex
:
'
UsageCap
'
dataIndex
:
'
Lastname
'
},
},
{
{
header
:
"
Agent Ref
"
,
header
:
"
Email
"
,
sortable
:
true
,
sortable
:
true
,
dataIndex
:
'
AgentRef
'
dataIndex
:
'
Email
'
},
},
{
{
header
:
"
Disabled
"
,
header
:
"
Phone
"
,
sortable
:
fals
e
,
sortable
:
tru
e
,
dataIndex
:
'
Disabled
'
dataIndex
:
'
Phone
'
}
}
]),
]),
autoExpandColumn
:
'
Servic
e
'
autoExpandColumn
:
'
Usernam
e
'
},
},
// Store config
// Store config
{
{
...
@@ -194,11 +194,12 @@ function showWiSPUserWindow() {
...
@@ -194,11 +194,12 @@ function showWiSPUserWindow() {
{
{
filters
:
[
filters
:
[
{
type
:
'
numeric
'
,
dataIndex
:
'
ID
'
},
{
type
:
'
numeric
'
,
dataIndex
:
'
ID
'
},
{
type
:
'
string
'
,
dataIndex
:
'
AgentName
'
},
{
type
:
'
string
'
,
dataIndex
:
'
Username
'
},
{
type
:
'
string
'
,
dataIndex
:
'
Username
'
},
{
type
:
'
string
'
,
dataIndex
:
'
Service
'
},
{
type
:
'
boolean
'
,
dataIndex
:
'
Disabled
'
},
{
type
:
'
numeric
'
,
dataIndex
:
'
UsageCap
'
},
{
type
:
'
string
'
,
dataIndex
:
'
Firstname
'
},
{
type
:
'
string
'
,
dataIndex
:
'
AgentRef
'
}
{
type
:
'
string
'
,
dataIndex
:
'
Lastname
'
},
{
type
:
'
string
'
,
dataIndex
:
'
Email
'
},
{
type
:
'
string
'
,
dataIndex
:
'
Phone
'
}
]
]
}
}
);
);
...
@@ -221,40 +222,17 @@ function showWiSPUserEditWindow(id) {
...
@@ -221,40 +222,17 @@ function showWiSPUserEditWindow(id) {
SOAPFunction
:
'
updateWiSPUser
'
,
SOAPFunction
:
'
updateWiSPUser
'
,
SOAPParams
:
SOAPParams
:
'
0:ID,
'
+
'
0:ID,
'
+
'
0:UsageCap,
'
+
'
0:Username
'
'
0:AgentRef,
'
+
'
0:AgentDisabled:boolean
'
};
};
editMode
=
true
;
// We doing an Add
// We doing an Add
}
else
{
}
else
{
submitAjaxConfig
=
{
submitAjaxConfig
=
{
SOAPFunction
:
'
createWiSPUser
'
,
SOAPFunction
:
'
createWiSPUser
'
,
SOAPParams
:
SOAPParams
:
'
0:AgentID,
'
+
'
0:Username
'
'
0:UserName,
'
+
'
0:UsageCap,
'
+
'
0:AgentRef,
'
+
'
0:AgentDisabled:boolean
'
};
};
editMode
=
false
;
}
}
// Service store
var
serviceStore
=
new
Ext
.
ux
.
JsonStore
({
ID
:
id
,
sortInfo
:
{
field
:
"
Name
"
,
direction
:
"
ASC
"
},
baseParams
:
{
SOAPUsername
:
globalConfig
.
soap
.
username
,
SOAPPassword
:
globalConfig
.
soap
.
password
,
SOAPAuthType
:
globalConfig
.
soap
.
authtype
,
SOAPModule
:
'
WiSPUsers
'
,
SOAPFunction
:
'
getClasses
'
,
AgentID
:
1
,
SOAPParams
:
'
0:AgentID,__search
'
}
});
// Create window
// Create window
var
wispUserFormWindow
=
new
Ext
.
ux
.
GenericFormWindow
(
var
wispUserFormWindow
=
new
Ext
.
ux
.
GenericFormWindow
(
...
@@ -284,148 +262,24 @@ function showWiSPUserEditWindow(id) {
...
@@ -284,148 +262,24 @@ function showWiSPUserEditWindow(id) {
vtype
:
'
usernamePart
'
,
vtype
:
'
usernamePart
'
,
maskRe
:
usernamePartRe
,
maskRe
:
usernamePartRe
,
allowBlank
:
false
,
allowBlank
:
false
,
disabled
:
editMode
},
{
xtype
:
'
combo
'
,
// We use an ID so we can get the box later
id
:
'
agent_combobox
'
,
fieldLabel
:
'
Agent
'
,
name
:
'
Agent
'
,
allowBlank
:
false
,
width
:
225
,
store
:
new
Ext
.
ux
.
JsonStore
({
ID
:
id
,
sortInfo
:
{
field
:
"
Name
"
,
direction
:
"
ASC
"
},
baseParams
:
{
SOAPUsername
:
globalConfig
.
soap
.
username
,
SOAPPassword
:
globalConfig
.
soap
.
password
,
SOAPAuthType
:
globalConfig
.
soap
.
authtype
,
SOAPModule
:
'
Agents
'
,
SOAPFunction
:
'
getAgents
'
,
SOAPParams
:
'
__search
'
}
}),
displayField
:
'
Name
'
,
valueField
:
'
ID
'
,
hiddenName
:
'
AgentID
'
,
forceSelection
:
false
,
triggerAction
:
'
all
'
,
editable
:
false
,
disabled
:
editMode
},
{
xtype
:
'
combo
'
,
// We use an ID so we can get the box later
id
:
'
service_combobox
'
,
fieldLabel
:
'
Service
'
,
name
:
'
Service
'
,
allowBlank
:
false
,
width
:
340
,
store
:
serviceStore
,
displayField
:
'
Service
'
,
valueField
:
'
ID
'
,
hiddenName
:
'
ClassID
'
,
forceSelection
:
false
,
triggerAction
:
'
all
'
,
editable
:
false
,
disabled
:
true
},
{
fieldLabel
:
'
Usage Cap
'
,
name
:
'
UsageCap
'
,
},
{
fieldLabel
:
'
Agent Ref
'
,
name
:
'
AgentRef
'
},
},
{
xtype
:
'
checkbox
'
,
fieldLabel
:
'
Disabled
'
,
name
:
'
AgentDisabled
'
}
/*,
{
xtype: 'tabpanel',
plain: 'true',
deferredRender: false, // Load all panels!
activeTab: 0,
height: 100,
defaults: {
layout: 'form',
bodyStyle: 'padding: 10px;'
},
items: [
{
title: 'Policy Settings',
layout: 'form',
defaultType: 'textfield',
items: [
{
fieldLabel: 'Transport Policy',
name: 'Policy',
vtype: 'number',
value: '1'
}
]
}
]
}*/
],
],
},
},
// Submit button config
// Submit button config
submitAjaxConfig
submitAjaxConfig
);
);
// Events
if
(
!
id
)
{
wispUserFormWindow
.
findById
(
'
agent_combobox
'
).
on
({
select
:
{
fn
:
function
()
{
var
tb
=
this
.
ownerCt
.
findById
(
'
service_combobox
'
);
if
(
this
.
getValue
())
{
tb
.
reset
();
serviceStore
.
baseParams
.
AgentID
=
this
.
getValue
();
serviceStore
.
reload
();
tb
.
enable
();
}
else
{
tb
.
reset
();
tb
.
disable
();
}
}
},
});
}
wispUserFormWindow
.
show
();
wispUserFormWindow
.
show
();
if
(
id
)
{
if
(
id
)
{
wispUserFormWindow
.
getComponent
(
'
formpanel
'
).
load
({
wispUserFormWindow
.
getComponent
(
'
formpanel
'
).
load
({
params
:
{
params
:
{
id
:
id
,
ID
:
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
:
'
WiSPUsers
'
,
SOAPModule
:
'
WiSPUsers
'
,
SOAPFunction
:
'
getWiSPUser
'
,
SOAPFunction
:
'
getWiSPUser
'
,
SOAPParams
:
'
id
'
SOAPParams
:
'
ID
'
}
}
});
});
}
}
...
@@ -453,13 +307,13 @@ function showWiSPUserRemoveWindow(parent,id) {
...
@@ -453,13 +307,13 @@ function showWiSPUserRemoveWindow(parent,id) {
// Do ajax request
// Do ajax request
uxAjaxRequest
(
parent
,{
uxAjaxRequest
(
parent
,{
params
:
{
params
:
{
id
:
id
,
ID
:
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
:
'
WiSPUsers
'
,
SOAPModule
:
'
WiSPUsers
'
,
SOAPFunction
:
'
removeWiSPUser
'
,
SOAPFunction
:
'
removeWiSPUser
'
,
SOAPParams
:
'
id
'
SOAPParams
:
'
ID
'
}
}
});
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment