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
22a9001d
Commit
22a9001d
authored
16 years ago
by
Robert Anderson
Browse files
Options
Downloads
Patches
Plain Diff
Assign group to selected user
parent
8fbe540a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webui/user-groups-add.php
+133
-0
133 additions, 0 deletions
webui/user-groups-add.php
with
133 additions
and
0 deletions
webui/user-groups-add.php
0 → 100644
+
133
−
0
View file @
22a9001d
<?php
# Policy groups main screen
# Copyright (C) 2008, LinuxRulz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
session_start
();
include_once
(
"includes/header.php"
);
include_once
(
"includes/footer.php"
);
include_once
(
"includes/db.php"
);
$db
=
connect_db
();
printHeader
(
array
(
));
if
(
isset
(
$_SESSION
[
'groups_user_id'
]))
{
if
(
$_POST
[
'frmaction'
]
==
"add"
)
{
?>
<p
class=
"pageheader"
>
Available Groups
</p>
<form
id=
"main_form"
action=
"user-groups-add.php"
method=
"post"
>
<div
class=
"textcenter"
>
<input
type=
"hidden"
name=
"frmaction"
value=
"add2"
/>
<table
class=
"entry"
>
<tr>
<td
class=
"entrytitle"
>
Users to Groups Comment
</td>
<td><input
type=
"text"
name=
"users_to_groups_comment"
/></td>
</tr>
<tr>
<td>
<select
name=
"users_group_disabled"
>
<option
value=
"0"
>
No
</option>
<option
value=
"1"
>
Yes
</option>
</select>
</td>
</tr>
<tr>
<td>
<input
type=
"submit"
value=
"Submit"
/>
</td>
</tr>
</table>
</div>
<p
/>
<table
class=
"results"
style=
"width: 75%;"
>
<tr
class=
"resultstitle"
>
<td
class=
"textcenter"
>
ID
</td>
<td
class=
"textcenter"
>
Name
</td>
<td
class=
"textcenter"
>
Priority
</td>
<td
class=
"textcenter"
>
Disabled
</td>
<td
class=
"textcenter"
>
Comment
</td>
</tr>
<?php
# List current available groups
$sql
=
"SELECT ID, Name, Priority, Disabled, Comment FROM ${DB_TABLE_PREFIX}groups ORDER BY ID"
;
$res
=
$db
->
query
(
$sql
);
while
(
$row
=
$res
->
fetchObject
())
{
?>
<tr
class=
"resultsitem"
>
<td><input
type=
"radio"
name=
"group_id"
value=
"
<?php
echo
$row
->
id
?>
"
/></td>
<td>
<?php
echo
$row
->
name
?>
</td>
<td>
<?php
echo
$row
->
priority
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
disabled
?
'yes'
:
'no'
?>
</td>
<td>
<?php
echo
$row
->
comment
?>
</td>
</tr>
<?php
}
$res
->
closeCursor
();
?>
</table>
</form>
<?php
}
elseif
(
$_POST
[
'frmaction'
]
==
"add2"
)
{
?>
<p
class=
"pageheader"
>
Group assignment results
</p>
<?php
if
(
isset
(
$_POST
[
'group_id'
])
&&
!
empty
(
$_POST
[
'users_to_groups_comment'
]))
{
$stmt
=
$db
->
prepare
(
"INSERT INTO ${DB_TABLE_PREFIX}users_to_groups (UserID,GroupID,Comment,Disabled) VALUES (?,?,?,?)"
);
# Which user am I working with?
$groups_user_id
=
$_SESSION
[
'groups_user_id'
];
$res
=
$stmt
->
execute
(
array
(
$groups_user_id
,
$_POST
[
'group_id'
],
$_POST
[
'users_group_comment'
],
$_POST
[
'users_group_disabled'
],
));
if
(
$res
)
{
?>
<div
class=
"notice"
>
Group assignment successful
</div>
<?php
}
else
{
?>
<div
class=
"warning"
>
Failed to assign group to user
</div>
<div
class=
"warning"
>
<?php
print_r
(
$stmt
->
errorInfo
())
?>
</div>
<?php
}
}
else
{
?>
<div
class=
"warning"
>
One or more values not set
</div>
<?php
}
}
}
else
{
?>
<div
class=
"warning"
>
No user id received
</div>
<?php
}
printFooter
();
# vim: ts=4
?>
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