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
d09963d3
Commit
d09963d3
authored
15 years ago
by
Robert Anderson
Browse files
Options
Downloads
Patches
Plain Diff
Added some group support for WiSPs: add
Fixed delete WiSP user to delete group associations
parent
a18420bb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webui/wisp-user-add.php
+56
-0
56 additions, 0 deletions
webui/wisp-user-add.php
webui/wisp-user-delete.php
+20
-10
20 additions, 10 deletions
webui/wisp-user-delete.php
with
76 additions
and
10 deletions
webui/wisp-user-add.php
+
56
−
0
View file @
d09963d3
...
...
@@ -55,6 +55,36 @@ if (!isset($_POST['frmaction'])) {
<td
class=
"entrytitle"
>
Password
</td>
<td><input
type=
"password"
name=
"user_password"
/></td>
</tr>
<tr>
<td
class=
"entrytitle"
>
Group
</td>
<td>
<select
name=
"user_group"
>
<option
selected=
"selected"
value=
"NULL"
>
No group
</option>
<?php
$sql
=
"
SELECT
ID, Name
FROM
${DB_TABLE_PREFIX}groups
ORDER BY
Name
DESC
"
;
$res
=
$db
->
query
(
$sql
);
# If there are any result rows, list items
if
(
$res
->
rowCount
()
>
0
)
{
while
(
$row
=
$res
->
fetchObject
())
{
?>
<option
value=
"
<?php
echo
$row
->
id
;
?>
"
>
<?php
echo
$row
->
name
;
?>
</option>
<?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td><div></div><td>
</tr>
...
...
@@ -203,6 +233,32 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "insert") {
}
if
(
$res
!==
FALSE
)
{
if
(
$_POST
[
'user_group'
]
!==
"NULL"
)
{
# Insert user group
$stmt
=
$db
->
prepare
(
"
INSERT INTO
${DB_TABLE_PREFIX}users_to_groups (UserID,GroupID)
VALUES
(
$userID
,?)
"
);
$res
=
$stmt
->
execute
(
array
(
$_POST
[
'user_group'
]));
if
(
$res
!==
FALSE
)
{
?>
<div
class=
"notice"
>
Added user to group
</div>
<?php
}
else
{
?>
<div
class=
"warning"
>
Failed to add user to group
</div>
<div
class=
"warning"
>
<?php
print_r
(
$stmt
->
errorInfo
())
?>
</div>
<?php
}
}
}
if
(
$res
!==
FALSE
)
{
# Insert IP Address
$stmt
=
$db
->
prepare
(
"
...
...
This diff is collapsed.
Click to expand it.
webui/wisp-user-delete.php
+
20
−
10
View file @
d09963d3
...
...
@@ -80,31 +80,41 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
# Delete user attributes
$res
=
$db
->
exec
(
"DELETE FROM user_attributes WHERE UserID = "
.
$db
->
quote
(
$_POST
[
'user_id'
]));
if
(
$res
!==
FALSE
)
{
# Delete
f
ro
m user
s
$res
=
$db
->
exec
(
"DELETE FROM
user
s WHERE ID = "
.
$db
->
quote
(
$_POST
[
'user_id'
]));
# Delete
g
ro
up association
s
$res
=
$db
->
exec
(
"DELETE FROM
${DB_TABLE_PREFIX}users_to_group
s WHERE
User
ID = "
.
$db
->
quote
(
$_POST
[
'user_id'
]));
if
(
$res
!==
FALSE
)
{
# Delete from users
$res
=
$db
->
exec
(
"DELETE FROM users WHERE ID = "
.
$db
->
quote
(
$_POST
[
'user_id'
]));
if
(
$res
!==
FALSE
)
{
?>
<div
class=
"notice"
>
User with ID:
<?php
print_r
(
$_POST
[
'user_id'
]);
?>
deleted!
</div>
<div
class=
"notice"
>
User with ID:
<?php
print_r
(
$_POST
[
'user_id'
]);
?>
deleted!
</div>
<?php
$db
->
commit
();
$db
->
commit
();
}
else
{
?>
<div
class=
"warning"
>
Failed to delete user!
</div>
<div
class=
"warning"
>
<?php
print_r
(
$res
->
errorInfo
());
?>
</div>
<?php
$db
->
rollback
();
}
}
else
{
?>
<div
class=
"warning"
>
Failed to
delete user!
</div>
<div
class=
"warning"
>
<?php
print_r
(
$
db
->
errorInfo
());
?>
</div>
<div
class=
"warning"
>
Failed to
remove group associations
</div>
<div
class=
"warning"
>
<?php
print_r
(
$
res
->
errorInfo
());
?>
</div>
<?php
$db
->
rollback
();
}
}
else
{
?>
<div
class=
"warning"
>
Failed to delete user
!
</div>
<div
class=
"warning"
>
<?php
print_r
(
$
db
->
errorInfo
());
?>
</div>
<div
class=
"warning"
>
Failed to delete user
attributes
</div>
<div
class=
"warning"
>
<?php
print_r
(
$
res
->
errorInfo
());
?>
</div>
<?php
$db
->
rollback
();
}
}
else
{
?>
<div
class=
"warning"
>
Failed to delete user
!
</div>
<div
class=
"warning"
>
<?php
print_r
(
$
db
->
errorInfo
());
?>
</div>
<div
class=
"warning"
>
Failed to delete user
data
</div>
<div
class=
"warning"
>
<?php
print_r
(
$
res
->
errorInfo
());
?>
</div>
<?php
$db
->
rollback
();
}
...
...
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