1 |
4c291f4c
|
Renato Botelho
|
<?php
|
2 |
fab7ff44
|
Bill Marquette
|
/*
|
3 |
4c291f4c
|
Renato Botelho
|
$Id: system_groupmanager.php
|
4 |
d88c6a9f
|
Scott Ullrich
|
part of m0n0wall (http://m0n0.ch/wall)
|
5 |
29aef6c4
|
Jim Thompson
|
part of pfSense
|
6 |
|
|
|
7 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
8 |
29aef6c4
|
Jim Thompson
|
All rights reserved.
|
9 |
d88c6a9f
|
Scott Ullrich
|
|
10 |
6b07c15a
|
Matthew Grooms
|
Copyright (C) 2008 Shrew Soft Inc.
|
11 |
4c291f4c
|
Renato Botelho
|
All rights reserved.
|
12 |
6b07c15a
|
Matthew Grooms
|
|
13 |
d88c6a9f
|
Scott Ullrich
|
Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
|
14 |
4c291f4c
|
Renato Botelho
|
All rights reserved.
|
15 |
d88c6a9f
|
Scott Ullrich
|
|
16 |
|
|
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
|
17 |
|
|
All rights reserved.
|
18 |
4c291f4c
|
Renato Botelho
|
|
19 |
d88c6a9f
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
20 |
|
|
modification, are permitted provided that the following conditions are met:
|
21 |
4c291f4c
|
Renato Botelho
|
|
22 |
d88c6a9f
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
23 |
|
|
this list of conditions and the following disclaimer.
|
24 |
4c291f4c
|
Renato Botelho
|
|
25 |
d88c6a9f
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
26 |
|
|
notice, this list of conditions and the following disclaimer in the
|
27 |
|
|
documentation and/or other materials provided with the distribution.
|
28 |
4c291f4c
|
Renato Botelho
|
|
29 |
d88c6a9f
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
30 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
31 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
32 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
33 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
34 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
35 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
36 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
37 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
38 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
39 |
fab7ff44
|
Bill Marquette
|
*/
|
40 |
1d333258
|
Scott Ullrich
|
/*
|
41 |
|
|
pfSense_MODULE: auth
|
42 |
|
|
*/
|
43 |
fab7ff44
|
Bill Marquette
|
|
44 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
45 |
|
|
##|*IDENT=page-system-groupmanager
|
46 |
|
|
##|*NAME=System: Group manager page
|
47 |
|
|
##|*DESCR=Allow access to the 'System: Group manager' page.
|
48 |
|
|
##|*MATCH=system_groupmanager.php*
|
49 |
|
|
##|-PRIV
|
50 |
fab7ff44
|
Bill Marquette
|
|
51 |
3fa86ecd
|
sullrich
|
require("guiconfig.inc");
|
52 |
d88c6a9f
|
Scott Ullrich
|
|
53 |
bbf825ab
|
Vinicius Coque
|
$pgtitle = array(gettext("System"), gettext("Group manager"));
|
54 |
fab7ff44
|
Bill Marquette
|
|
55 |
6b07c15a
|
Matthew Grooms
|
if (!is_array($config['system']['group']))
|
56 |
|
|
$config['system']['group'] = array();
|
57 |
d81c2ad1
|
Scott Ullrich
|
|
58 |
6b07c15a
|
Matthew Grooms
|
$a_group = &$config['system']['group'];
|
59 |
d81c2ad1
|
Scott Ullrich
|
|
60 |
7ea27b0d
|
Renato Botelho
|
unset($id);
|
61 |
|
|
if (isset($_POST['groupid']) && is_numericint($_POST['groupid']))
|
62 |
|
|
$id = $_POST['groupid'];
|
63 |
d81c2ad1
|
Scott Ullrich
|
|
64 |
7ea27b0d
|
Renato Botelho
|
$act = (isset($_POST['act']) ? $_POST['act'] : '');
|
65 |
31b53653
|
Scott Ullrich
|
|
66 |
7ea27b0d
|
Renato Botelho
|
if ($act == "delgroup") {
|
67 |
|
|
|
68 |
|
|
if (!isset($id) || !isset($_POST['groupname']) || !isset($a_group[$id]) || ($_POST['groupname'] != $a_group[$id]['name'])) {
|
69 |
6b07c15a
|
Matthew Grooms
|
pfSenseHeader("system_groupmanager.php");
|
70 |
|
|
exit;
|
71 |
|
|
}
|
72 |
31b53653
|
Scott Ullrich
|
|
73 |
920dbb26
|
Renato Botelho
|
conf_mount_rw();
|
74 |
7ea27b0d
|
Renato Botelho
|
local_group_del($a_group[$id]);
|
75 |
920dbb26
|
Renato Botelho
|
conf_mount_ro();
|
76 |
7ea27b0d
|
Renato Botelho
|
$groupdeleted = $a_group[$id]['name'];
|
77 |
|
|
unset($a_group[$id]);
|
78 |
6b07c15a
|
Matthew Grooms
|
write_config();
|
79 |
|
|
$savemsg = gettext("Group")." {$groupdeleted} ".
|
80 |
7ea27b0d
|
Renato Botelho
|
gettext("successfully deleted")."<br />";
|
81 |
fab7ff44
|
Bill Marquette
|
}
|
82 |
d88c6a9f
|
Scott Ullrich
|
|
83 |
7ea27b0d
|
Renato Botelho
|
if ($act == "delpriv") {
|
84 |
fab7ff44
|
Bill Marquette
|
|
85 |
7ea27b0d
|
Renato Botelho
|
if (!isset($id) || !isset($a_group[$id])) {
|
86 |
6b07c15a
|
Matthew Grooms
|
pfSenseHeader("system_groupmanager.php");
|
87 |
|
|
exit;
|
88 |
|
|
}
|
89 |
fab7ff44
|
Bill Marquette
|
|
90 |
7ea27b0d
|
Renato Botelho
|
$privdeleted = $priv_list[$a_group[$id]['priv'][$_POST['privid']]]['name'];
|
91 |
|
|
unset($a_group[$id]['priv'][$_POST['privid']]);
|
92 |
6b07c15a
|
Matthew Grooms
|
|
93 |
2ee08031
|
Erik Fonnesbeck
|
if (is_array($a_group[$id]['member'])) {
|
94 |
|
|
foreach ($a_group[$id]['member'] as $uid) {
|
95 |
|
|
$user = getUserEntryByUID($uid);
|
96 |
|
|
if ($user)
|
97 |
|
|
local_user_set($user);
|
98 |
|
|
}
|
99 |
d88c6a9f
|
Scott Ullrich
|
}
|
100 |
6b07c15a
|
Matthew Grooms
|
|
101 |
|
|
write_config();
|
102 |
7ea27b0d
|
Renato Botelho
|
$act = "edit";
|
103 |
6b07c15a
|
Matthew Grooms
|
$savemsg = gettext("Privilege")." {$privdeleted} ".
|
104 |
8cd558b6
|
ayvis
|
gettext("successfully deleted")."<br />";
|
105 |
6b07c15a
|
Matthew Grooms
|
}
|
106 |
45ee90ed
|
Matthew Grooms
|
|
107 |
7ea27b0d
|
Renato Botelho
|
if ($act == "edit") {
|
108 |
|
|
if (isset($id) && isset($a_group[$id])) {
|
109 |
45ee90ed
|
Matthew Grooms
|
$pconfig['name'] = $a_group[$id]['name'];
|
110 |
6b07c15a
|
Matthew Grooms
|
$pconfig['gid'] = $a_group[$id]['gid'];
|
111 |
|
|
$pconfig['gtype'] = $a_group[$id]['scope'];
|
112 |
45ee90ed
|
Matthew Grooms
|
$pconfig['description'] = $a_group[$id]['description'];
|
113 |
6b07c15a
|
Matthew Grooms
|
$pconfig['members'] = $a_group[$id]['member'];
|
114 |
|
|
$pconfig['priv'] = $a_group[$id]['priv'];
|
115 |
45ee90ed
|
Matthew Grooms
|
}
|
116 |
|
|
}
|
117 |
6b07c15a
|
Matthew Grooms
|
|
118 |
c0c5b8cc
|
bruno
|
if(isset($_POST['dellall_x'])) {
|
119 |
|
|
|
120 |
|
|
$del_groups = $_POST['delete_check'];
|
121 |
|
|
|
122 |
|
|
if(!empty($del_groups)) {
|
123 |
|
|
foreach($del_groups as $groupid) {
|
124 |
|
|
if(isset($a_group[$groupid]) && $a_group[$groupid]['scope'] != "system") {
|
125 |
|
|
conf_mount_rw();
|
126 |
|
|
local_group_del($a_group[$groupid]);
|
127 |
|
|
conf_mount_ro();
|
128 |
|
|
unset($a_group[$groupid]);
|
129 |
|
|
}
|
130 |
|
|
}
|
131 |
|
|
$savemsg = gettext("Selected groups removed successfully!");
|
132 |
|
|
write_config($savemsg);
|
133 |
|
|
}
|
134 |
|
|
}
|
135 |
|
|
|
136 |
7ea27b0d
|
Renato Botelho
|
if (isset($_POST['save'])) {
|
137 |
fab7ff44
|
Bill Marquette
|
|
138 |
d88c6a9f
|
Scott Ullrich
|
unset($input_errors);
|
139 |
|
|
$pconfig = $_POST;
|
140 |
|
|
|
141 |
|
|
/* input validation */
|
142 |
|
|
$reqdfields = explode(" ", "groupname");
|
143 |
b4fd804b
|
Carlos Eduardo Ramos
|
$reqdfieldsn = array(gettext("Group Name"));
|
144 |
4c291f4c
|
Renato Botelho
|
|
145 |
1e9b4611
|
Renato Botelho
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
146 |
4c291f4c
|
Renato Botelho
|
|
147 |
d88c6a9f
|
Scott Ullrich
|
if (preg_match("/[^a-zA-Z0-9\.\-_ ]/", $_POST['groupname']))
|
148 |
bbf825ab
|
Vinicius Coque
|
$input_errors[] = gettext("The group name contains invalid characters.");
|
149 |
4c291f4c
|
Renato Botelho
|
|
150 |
3db408b3
|
PiBa-NL
|
if (strlen($_POST['groupname']) > 16)
|
151 |
|
|
$input_errors[] = gettext("The group name is longer than 16 characters.");
|
152 |
4c291f4c
|
Renato Botelho
|
|
153 |
d88c6a9f
|
Scott Ullrich
|
if (!$input_errors && !(isset($id) && $a_group[$id])) {
|
154 |
|
|
/* make sure there are no dupes */
|
155 |
|
|
foreach ($a_group as $group) {
|
156 |
|
|
if ($group['name'] == $_POST['groupname']) {
|
157 |
bbf825ab
|
Vinicius Coque
|
$input_errors[] = gettext("Another entry with the same group name already exists.");
|
158 |
d88c6a9f
|
Scott Ullrich
|
break;
|
159 |
|
|
}
|
160 |
|
|
}
|
161 |
|
|
}
|
162 |
4c291f4c
|
Renato Botelho
|
|
163 |
d88c6a9f
|
Scott Ullrich
|
if (!$input_errors) {
|
164 |
45ee90ed
|
Matthew Grooms
|
$group = array();
|
165 |
d88c6a9f
|
Scott Ullrich
|
if (isset($id) && $a_group[$id])
|
166 |
|
|
$group = $a_group[$id];
|
167 |
4c291f4c
|
Renato Botelho
|
|
168 |
d88c6a9f
|
Scott Ullrich
|
$group['name'] = $_POST['groupname'];
|
169 |
|
|
$group['description'] = $_POST['description'];
|
170 |
45ee90ed
|
Matthew Grooms
|
|
171 |
70d6b5c4
|
Ermal
|
if (empty($_POST['members']))
|
172 |
|
|
unset($group['member']);
|
173 |
|
|
else if ($group['gid'] != 1998) // all group
|
174 |
6b07c15a
|
Matthew Grooms
|
$group['member'] = $_POST['members'];
|
175 |
45ee90ed
|
Matthew Grooms
|
|
176 |
d88c6a9f
|
Scott Ullrich
|
if (isset($id) && $a_group[$id])
|
177 |
|
|
$a_group[$id] = $group;
|
178 |
45ee90ed
|
Matthew Grooms
|
else {
|
179 |
|
|
$group['gid'] = $config['system']['nextgid']++;
|
180 |
d88c6a9f
|
Scott Ullrich
|
$a_group[] = $group;
|
181 |
45ee90ed
|
Matthew Grooms
|
}
|
182 |
|
|
|
183 |
920dbb26
|
Renato Botelho
|
conf_mount_rw();
|
184 |
659fa7f2
|
Matthew Grooms
|
local_group_set($group);
|
185 |
920dbb26
|
Renato Botelho
|
conf_mount_ro();
|
186 |
2a0e8512
|
jim-p
|
|
187 |
|
|
/* Refresh users in this group since their privileges may have changed. */
|
188 |
5709072a
|
jim-p
|
if (is_array($group['member'])) {
|
189 |
|
|
$a_user = &$config['system']['user'];
|
190 |
|
|
foreach ($a_user as & $user) {
|
191 |
|
|
if (in_array($user['uid'], $group['member']))
|
192 |
|
|
local_user_set($user);
|
193 |
|
|
}
|
194 |
2a0e8512
|
jim-p
|
}
|
195 |
|
|
|
196 |
d88c6a9f
|
Scott Ullrich
|
write_config();
|
197 |
4c291f4c
|
Renato Botelho
|
|
198 |
d88c6a9f
|
Scott Ullrich
|
header("Location: system_groupmanager.php");
|
199 |
|
|
exit;
|
200 |
|
|
}
|
201 |
fab7ff44
|
Bill Marquette
|
}
|
202 |
|
|
|
203 |
|
|
include("head.inc");
|
204 |
|
|
|
205 |
|
|
?>
|
206 |
45ee90ed
|
Matthew Grooms
|
|
207 |
f6510207
|
xbipin
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
|
208 |
6b07c15a
|
Matthew Grooms
|
<?php include("fbegin.inc"); ?>
|
209 |
a65c5a99
|
bruno
|
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
|
210 |
9dfaf533
|
Colin Fleming
|
<script type="text/javascript">
|
211 |
|
|
//<![CDATA[
|
212 |
6b07c15a
|
Matthew Grooms
|
|
213 |
|
|
function setall_selected(id) {
|
214 |
|
|
selbox = document.getElementById(id);
|
215 |
|
|
count = selbox.options.length;
|
216 |
|
|
for (index = 0; index<count; index++)
|
217 |
|
|
selbox.options[index].selected = true;
|
218 |
|
|
}
|
219 |
|
|
|
220 |
61dec0b0
|
Renato Botelho
|
function delete_empty(id) {
|
221 |
|
|
selbox = document.getElementById(id);
|
222 |
|
|
count = selbox.options.length;
|
223 |
|
|
for (index = 0; index<count; index++)
|
224 |
|
|
if (selbox.options[index].value == '')
|
225 |
|
|
selbox.remove(index);
|
226 |
|
|
}
|
227 |
|
|
|
228 |
6b07c15a
|
Matthew Grooms
|
function clear_selected(id) {
|
229 |
|
|
selbox = document.getElementById(id);
|
230 |
|
|
count = selbox.options.length;
|
231 |
|
|
for (index = 0; index<count; index++)
|
232 |
|
|
selbox.options[index].selected = false;
|
233 |
|
|
}
|
234 |
|
|
|
235 |
|
|
function remove_selected(id) {
|
236 |
|
|
selbox = document.getElementById(id);
|
237 |
|
|
index = selbox.options.length - 1;
|
238 |
|
|
for (; index >= 0; index--)
|
239 |
|
|
if (selbox.options[index].selected)
|
240 |
|
|
selbox.remove(index);
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
function copy_selected(srcid, dstid) {
|
244 |
|
|
src_selbox = document.getElementById(srcid);
|
245 |
|
|
dst_selbox = document.getElementById(dstid);
|
246 |
4c4c59b9
|
Renato Botelho
|
count = dst_selbox.options.length;
|
247 |
|
|
for (index = count - 1; index >= 0; index--) {
|
248 |
|
|
if (dst_selbox.options[index].value == '') {
|
249 |
|
|
dst_selbox.remove(index);
|
250 |
|
|
}
|
251 |
|
|
}
|
252 |
6b07c15a
|
Matthew Grooms
|
count = src_selbox.options.length;
|
253 |
|
|
for (index = 0; index < count; index++) {
|
254 |
|
|
if (src_selbox.options[index].selected) {
|
255 |
|
|
option = document.createElement('option');
|
256 |
|
|
option.text = src_selbox.options[index].text;
|
257 |
|
|
option.value = src_selbox.options[index].value;
|
258 |
|
|
dst_selbox.add(option, null);
|
259 |
|
|
}
|
260 |
|
|
}
|
261 |
|
|
}
|
262 |
|
|
|
263 |
|
|
function move_selected(srcid, dstid) {
|
264 |
|
|
copy_selected(srcid, dstid);
|
265 |
|
|
remove_selected(srcid);
|
266 |
|
|
}
|
267 |
|
|
|
268 |
|
|
function presubmit() {
|
269 |
61dec0b0
|
Renato Botelho
|
delete_empty('members');
|
270 |
|
|
delete_empty('notmembers');
|
271 |
6b07c15a
|
Matthew Grooms
|
clear_selected('notmembers');
|
272 |
|
|
setall_selected('members');
|
273 |
|
|
}
|
274 |
|
|
|
275 |
9dfaf533
|
Colin Fleming
|
//]]>
|
276 |
6b07c15a
|
Matthew Grooms
|
</script>
|
277 |
fab7ff44
|
Bill Marquette
|
<?php
|
278 |
45ee90ed
|
Matthew Grooms
|
if ($input_errors)
|
279 |
|
|
print_input_errors($input_errors);
|
280 |
|
|
if ($savemsg)
|
281 |
|
|
print_info_box($savemsg);
|
282 |
fab7ff44
|
Bill Marquette
|
?>
|
283 |
9dfaf533
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="group manager">
|
284 |
45ee90ed
|
Matthew Grooms
|
<tr>
|
285 |
e30001cf
|
Matthew Grooms
|
<td>
|
286 |
4c291f4c
|
Renato Botelho
|
<?php
|
287 |
|
|
$tab_array = array();
|
288 |
|
|
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
|
289 |
|
|
$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
|
290 |
|
|
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
|
291 |
|
|
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
|
292 |
|
|
display_top_tabs($tab_array);
|
293 |
|
|
?>
|
294 |
45ee90ed
|
Matthew Grooms
|
</td>
|
295 |
4c291f4c
|
Renato Botelho
|
</tr>
|
296 |
45ee90ed
|
Matthew Grooms
|
<tr>
|
297 |
e30001cf
|
Matthew Grooms
|
<td id="mainarea">
|
298 |
|
|
<div class="tabcont">
|
299 |
|
|
|
300 |
4c291f4c
|
Renato Botelho
|
<?php
|
301 |
7ea27b0d
|
Renato Botelho
|
if($act == "new" || $act == "edit"):
|
302 |
4c291f4c
|
Renato Botelho
|
?>
|
303 |
e30001cf
|
Matthew Grooms
|
<form action="system_groupmanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
|
304 |
7ea27b0d
|
Renato Botelho
|
<input type="hidden" id="act" name="act" value="" />
|
305 |
|
|
<input type="hidden" id="groupid" name="groupid" value="<?=(isset($id) ? $id : '');?>" />
|
306 |
|
|
<input type="hidden" id="privid" name="privid" value="" />
|
307 |
9dfaf533
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
308 |
4c291f4c
|
Renato Botelho
|
<?php
|
309 |
|
|
$ro = "";
|
310 |
|
|
if ($pconfig['gtype'] == "system")
|
311 |
|
|
$ro = "readonly=\"readonly\"";
|
312 |
|
|
?>
|
313 |
e30001cf
|
Matthew Grooms
|
<tr>
|
314 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
|
315 |
|
|
<td width="78%" class="vtable">
|
316 |
|
|
<strong><?=strtoupper($pconfig['gtype']);?></strong>
|
317 |
dd5bf424
|
Scott Ullrich
|
<input name="gtype" type="hidden" value="<?=htmlspecialchars($pconfig['gtype'])?>"/>
|
318 |
e30001cf
|
Matthew Grooms
|
</td>
|
319 |
|
|
</tr>
|
320 |
4c291f4c
|
Renato Botelho
|
<tr>
|
321 |
bbf825ab
|
Vinicius Coque
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Group name");?></td>
|
322 |
4c291f4c
|
Renato Botelho
|
<td width="78%" class="vtable">
|
323 |
3db408b3
|
PiBa-NL
|
<input name="groupname" type="text" class="formfld group" id="groupname" size="20" maxlength="16" value="<?=htmlspecialchars($pconfig['name']);?>" <?=$ro;?> />
|
324 |
e30001cf
|
Matthew Grooms
|
</td>
|
325 |
|
|
</tr>
|
326 |
4c291f4c
|
Renato Botelho
|
<tr>
|
327 |
bbf825ab
|
Vinicius Coque
|
<td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
|
328 |
4c291f4c
|
Renato Botelho
|
<td width="78%" class="vtable">
|
329 |
9dfaf533
|
Colin Fleming
|
<input name="description" type="text" class="formfld unknown" id="description" size="20" value="<?=htmlspecialchars($pconfig['description']);?>" />
|
330 |
8cd558b6
|
ayvis
|
<br />
|
331 |
bbf825ab
|
Vinicius Coque
|
<?=gettext("Group description, for your own information only");?>
|
332 |
e30001cf
|
Matthew Grooms
|
</td>
|
333 |
|
|
</tr>
|
334 |
4c291f4c
|
Renato Botelho
|
<?php
|
335 |
|
|
if ($pconfig['gid'] != 1998): // all users group
|
336 |
|
|
?>
|
337 |
e30001cf
|
Matthew Grooms
|
<tr>
|
338 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Group Memberships");?></td>
|
339 |
|
|
<td width="78%" class="vtable" align="center">
|
340 |
9dfaf533
|
Colin Fleming
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="membership">
|
341 |
e30001cf
|
Matthew Grooms
|
<tr>
|
342 |
|
|
<td align="center" width="50%">
|
343 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Not Members");?></strong><br />
|
344 |
|
|
<br />
|
345 |
9dfaf533
|
Colin Fleming
|
<select size="10" style="width: 75%" name="notmembers[]" class="formselect" id="notmembers" onchange="clear_selected('members')" multiple="multiple">
|
346 |
4c291f4c
|
Renato Botelho
|
<?php
|
347 |
|
|
$rowIndex = 0;
|
348 |
|
|
foreach ($config['system']['user'] as $user):
|
349 |
|
|
if (is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members']))
|
350 |
|
|
continue;
|
351 |
|
|
$rowIndex++;
|
352 |
|
|
?>
|
353 |
e30001cf
|
Matthew Grooms
|
<option value="<?=$user['uid'];?>" <?=$selected;?>>
|
354 |
|
|
<?=htmlspecialchars($user['name']);?>
|
355 |
|
|
</option>
|
356 |
4c291f4c
|
Renato Botelho
|
<?php
|
357 |
|
|
endforeach;
|
358 |
|
|
if ($rowIndex == 0)
|
359 |
|
|
echo "<option></option>";
|
360 |
|
|
?>
|
361 |
e30001cf
|
Matthew Grooms
|
</select>
|
362 |
8cd558b6
|
ayvis
|
<br />
|
363 |
e30001cf
|
Matthew Grooms
|
</td>
|
364 |
|
|
<td>
|
365 |
8cd558b6
|
ayvis
|
<br />
|
366 |
e30001cf
|
Matthew Grooms
|
<a href="javascript:move_selected('notmembers','members')">
|
367 |
bbf825ab
|
Vinicius Coque
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_right.gif" title="<?=gettext("Add Members");?>" alt="<?=gettext("Add Members");?>" width="17" height="17" border="0" />
|
368 |
e30001cf
|
Matthew Grooms
|
</a>
|
369 |
8cd558b6
|
ayvis
|
<br /><br />
|
370 |
e30001cf
|
Matthew Grooms
|
<a href="javascript:move_selected('members','notmembers')">
|
371 |
bbf825ab
|
Vinicius Coque
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_left.gif" title="<?=gettext("Remove Members");?>" alt="<?=gettext("Remove Members");?>" width="17" height="17" border="0" />
|
372 |
e30001cf
|
Matthew Grooms
|
</a>
|
373 |
|
|
</td>
|
374 |
|
|
<td align="center" width="50%">
|
375 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Members");?></strong><br />
|
376 |
|
|
<br />
|
377 |
9dfaf533
|
Colin Fleming
|
<select size="10" style="width: 75%" name="members[]" class="formselect" id="members" onchange="clear_selected('notmembers')" multiple="multiple">
|
378 |
4c291f4c
|
Renato Botelho
|
<?php
|
379 |
|
|
$rowIndex = 0;
|
380 |
|
|
foreach ($config['system']['user'] as $user):
|
381 |
|
|
if (!(is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members'])))
|
382 |
|
|
continue;
|
383 |
|
|
$rowIndex++;
|
384 |
|
|
?>
|
385 |
e30001cf
|
Matthew Grooms
|
<option value="<?=$user['uid'];?>">
|
386 |
|
|
<?=htmlspecialchars($user['name']);?>
|
387 |
|
|
</option>
|
388 |
4c291f4c
|
Renato Botelho
|
<?php
|
389 |
|
|
endforeach;
|
390 |
|
|
if ($rowIndex == 0)
|
391 |
|
|
echo "<option></option>";
|
392 |
|
|
?>
|
393 |
e30001cf
|
Matthew Grooms
|
</select>
|
394 |
8cd558b6
|
ayvis
|
<br />
|
395 |
e30001cf
|
Matthew Grooms
|
</td>
|
396 |
|
|
</tr>
|
397 |
|
|
</table>
|
398 |
|
|
<?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
|
399 |
|
|
</td>
|
400 |
|
|
</tr>
|
401 |
4c291f4c
|
Renato Botelho
|
<?php
|
402 |
|
|
endif;
|
403 |
7ea27b0d
|
Renato Botelho
|
if ($act != "new"):
|
404 |
4c291f4c
|
Renato Botelho
|
?>
|
405 |
e30001cf
|
Matthew Grooms
|
<tr>
|
406 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Assigned Privileges");?></td>
|
407 |
|
|
<td width="78%" class="vtable">
|
408 |
9dfaf533
|
Colin Fleming
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="privileges">
|
409 |
e30001cf
|
Matthew Grooms
|
<tr>
|
410 |
|
|
<td width="40%" class="listhdrr"><?=gettext("Name");?></td>
|
411 |
|
|
<td width="60%" class="listhdrr"><?=gettext("Description");?></td>
|
412 |
|
|
<td class="list"></td>
|
413 |
|
|
</tr>
|
414 |
4c291f4c
|
Renato Botelho
|
<?php
|
415 |
|
|
if(is_array($pconfig['priv'])):
|
416 |
|
|
$i = 0;
|
417 |
|
|
foreach ($pconfig['priv'] as $priv):
|
418 |
|
|
?>
|
419 |
e30001cf
|
Matthew Grooms
|
<tr>
|
420 |
|
|
<td class="listr">
|
421 |
|
|
<?=htmlspecialchars($priv_list[$priv]['name']);?>
|
422 |
|
|
</td>
|
423 |
|
|
<td class="listbg">
|
424 |
33300c73
|
Scott Ullrich
|
<?=htmlspecialchars($priv_list[$priv]['descr']);?>
|
425 |
e30001cf
|
Matthew Grooms
|
</td>
|
426 |
9dfaf533
|
Colin Fleming
|
<td valign="middle" class="list nowrap">
|
427 |
7ea27b0d
|
Renato Botelho
|
<input type="image" name="delpriv[]" width="17" height="17" border="0"
|
428 |
|
|
src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif"
|
429 |
|
|
onclick="document.getElementById('privid').value='<?=$i;?>';
|
430 |
|
|
document.getElementById('groupid').value='<?=$id;?>';
|
431 |
|
|
document.getElementById('act').value='<?php echo "delpriv";?>';
|
432 |
|
|
return confirm('<?=gettext("Do you really want to delete this privilege?");?>');"
|
433 |
|
|
title="<?=gettext("delete privilege");?>" />
|
434 |
e30001cf
|
Matthew Grooms
|
</td>
|
435 |
|
|
</tr>
|
436 |
4c291f4c
|
Renato Botelho
|
<?php
|
437 |
|
|
$i++;
|
438 |
|
|
endforeach;
|
439 |
|
|
endif;
|
440 |
|
|
?>
|
441 |
e30001cf
|
Matthew Grooms
|
<tr>
|
442 |
|
|
<td class="list" colspan="2"></td>
|
443 |
|
|
<td class="list">
|
444 |
dd5bf424
|
Scott Ullrich
|
<a href="system_groupmanager_addprivs.php?groupid=<?=htmlspecialchars($id)?>">
|
445 |
9dfaf533
|
Colin Fleming
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" />
|
446 |
e30001cf
|
Matthew Grooms
|
</a>
|
447 |
4d86a13d
|
Scott Ullrich
|
|
448 |
e30001cf
|
Matthew Grooms
|
</td>
|
449 |
|
|
</tr>
|
450 |
4d86a13d
|
Scott Ullrich
|
|
451 |
e30001cf
|
Matthew Grooms
|
</table>
|
452 |
|
|
</td>
|
453 |
|
|
</tr>
|
454 |
4c291f4c
|
Renato Botelho
|
<?php
|
455 |
|
|
endif;
|
456 |
|
|
?>
|
457 |
|
|
<tr>
|
458 |
e30001cf
|
Matthew Grooms
|
<td width="22%" valign="top"> </td>
|
459 |
4c291f4c
|
Renato Botelho
|
<td width="78%">
|
460 |
9dfaf533
|
Colin Fleming
|
<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
461 |
86481f75
|
Phil Davis
|
<input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='/system_groupmanager.php'" />
|
462 |
e30001cf
|
Matthew Grooms
|
<?php if (isset($id) && $a_group[$id]): ?>
|
463 |
9dfaf533
|
Colin Fleming
|
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
|
464 |
|
|
<input name="gid" type="hidden" value="<?=htmlspecialchars($pconfig['gid']);?>" />
|
465 |
e30001cf
|
Matthew Grooms
|
<?php endif; ?>
|
466 |
|
|
</td>
|
467 |
|
|
</tr>
|
468 |
|
|
</table>
|
469 |
|
|
</form>
|
470 |
4c291f4c
|
Renato Botelho
|
<?php
|
471 |
|
|
else:
|
472 |
|
|
?>
|
473 |
7ea27b0d
|
Renato Botelho
|
<form action="system_groupmanager.php" method="post" name="iform2" id="iform2">
|
474 |
|
|
<input type="hidden" id="act" name="act" value="" />
|
475 |
|
|
<input type="hidden" id="groupid" name="groupid" value="<?=(isset($id) ? $id : '');?>" />
|
476 |
|
|
<input type="hidden" id="groupname" name="groupname" value="" />
|
477 |
|
|
<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
|
478 |
|
|
<thead>
|
479 |
|
|
<tr>
|
480 |
a65c5a99
|
bruno
|
<th width="5%" class="list"> </th>
|
481 |
7ea27b0d
|
Renato Botelho
|
<th width="25%" class="listhdrr"><?=gettext("Group name");?></th>
|
482 |
|
|
<th width="25%" class="listhdrr"><?=gettext("Description");?></th>
|
483 |
|
|
<th width="30%" class="listhdrr"><?=gettext("Member Count");?></th>
|
484 |
|
|
<th width="10%" class="list"></th>
|
485 |
|
|
</tr>
|
486 |
|
|
</thead>
|
487 |
|
|
<tfoot>
|
488 |
|
|
<tr>
|
489 |
a65c5a99
|
bruno
|
<td class="list" colspan="4"></td>
|
490 |
7ea27b0d
|
Renato Botelho
|
<td class="list">
|
491 |
|
|
<input type="image" name="addcert" width="17" height="17" border="0"
|
492 |
|
|
src="/themes/<?=$g['theme'];?>/images/icons/icon_plus.gif"
|
493 |
|
|
onclick="document.getElementById('act').value='<?php echo "new";?>';"
|
494 |
|
|
title="<?=gettext("add group");?>" />
|
495 |
c0c5b8cc
|
bruno
|
<input type="image" src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" name="dellall" title="<?=gettext('Delete selected groups')?>" onClick="return confirm('<?=gettext("Do you really want to delete selected groups?");?>')" />
|
496 |
7ea27b0d
|
Renato Botelho
|
</td>
|
497 |
|
|
</tr>
|
498 |
|
|
<tr>
|
499 |
a65c5a99
|
bruno
|
<td colspan="4">
|
500 |
7ea27b0d
|
Renato Botelho
|
<p>
|
501 |
|
|
<?=gettext("Additional webConfigurator groups can be added here.
|
502 |
|
|
Group permissions can be assigned which are inherited by users who are members of the group.
|
503 |
|
|
An icon that appears grey indicates that it is a system defined object.
|
504 |
|
|
Some system object properties can be modified but they cannot be deleted.");?>
|
505 |
|
|
</p>
|
506 |
|
|
</td>
|
507 |
|
|
</tr>
|
508 |
|
|
</tfoot>
|
509 |
|
|
<tbody>
|
510 |
4c291f4c
|
Renato Botelho
|
<?php
|
511 |
7ea27b0d
|
Renato Botelho
|
$i = 0;
|
512 |
|
|
foreach($a_group as $group):
|
513 |
|
|
if($group['scope'] == "system")
|
514 |
|
|
$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group-grey.png";
|
515 |
|
|
else
|
516 |
|
|
$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group.png";
|
517 |
|
|
$groupcount = count($group['member']);
|
518 |
|
|
if ($group["name"] == "all")
|
519 |
|
|
$groupcount = count($config['system']['user']);
|
520 |
4c291f4c
|
Renato Botelho
|
?>
|
521 |
7ea27b0d
|
Renato Botelho
|
<tr ondblclick="document.getElementById('act').value='<?php echo "edit";?>';
|
522 |
|
|
document.getElementById('groupid').value='<?=$i;?>';
|
523 |
a65c5a99
|
bruno
|
document.iform2.submit();" id="fr<?=$i?>">
|
524 |
|
|
<td class="list" id="frd<?=$i?>">
|
525 |
|
|
<?php if($group['scope'] != "system") : ?>
|
526 |
|
|
<input type="checkbox" id="frc<?=$i?>" onclick="fr_bgcolor(<?=$i?>)" name="delete_check[]" value="<?=$i?>" />
|
527 |
|
|
<?php endif; ?>
|
528 |
|
|
</td>
|
529 |
|
|
<td class="listlr" id="frd<?=$i?>" onclick="fr_toggle(<?=$i?>)">
|
530 |
7ea27b0d
|
Renato Botelho
|
<table border="0" cellpadding="0" cellspacing="0" summary="">
|
531 |
|
|
<tr>
|
532 |
|
|
<td align="left" valign="middle">
|
533 |
|
|
<img src="<?=$grpimg;?>" alt="<?=gettext("User");?>" title="<?=gettext("User");?>" border="0" height="16" width="16" />
|
534 |
|
|
</td>
|
535 |
|
|
<td align="left" valign="middle">
|
536 |
|
|
<?=htmlspecialchars($group['name']); ?>
|
537 |
|
|
</td>
|
538 |
|
|
</tr>
|
539 |
|
|
</table>
|
540 |
|
|
</td>
|
541 |
a65c5a99
|
bruno
|
<td class="listr" id="frd<?=$i?>" onclick="fr_toggle(<?=$i?>)">
|
542 |
7ea27b0d
|
Renato Botelho
|
<?=htmlspecialchars($group['description']);?>
|
543 |
|
|
</td>
|
544 |
a65c5a99
|
bruno
|
<td class="listbg" onclick="fr_toggle(<?=$i?>)">
|
545 |
7ea27b0d
|
Renato Botelho
|
<?=$groupcount;?>
|
546 |
|
|
</td>
|
547 |
|
|
<td valign="middle" class="list nowrap">
|
548 |
|
|
<input type="image" name="editgroup[]" width="17" height="17" border="0"
|
549 |
|
|
src="/themes/<?=$g['theme'];?>/images/icons/icon_e.gif"
|
550 |
|
|
onclick="document.getElementById('groupid').value='<?=$i;?>';
|
551 |
|
|
document.getElementById('act').value='<?php echo "edit";?>';"
|
552 |
|
|
title="<?=gettext("edit group");?>" />
|
553 |
|
|
|
554 |
4c291f4c
|
Renato Botelho
|
<?php
|
555 |
7ea27b0d
|
Renato Botelho
|
if($group['scope'] != "system"):
|
556 |
4c291f4c
|
Renato Botelho
|
?>
|
557 |
7ea27b0d
|
Renato Botelho
|
<input type="image" name="delgroup[]" width="17" height="17" border="0"
|
558 |
|
|
src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif"
|
559 |
|
|
onclick="document.getElementById('groupid').value='<?=$i;?>';
|
560 |
|
|
document.getElementById('groupname').value='<?=$group['name'];?>';
|
561 |
|
|
document.getElementById('act').value='<?php echo "delgroup";?>';
|
562 |
|
|
return confirm('<?=gettext("Do you really want to delete this group?");?>');"
|
563 |
|
|
title="<?=gettext("delete group");?>" />
|
564 |
4c291f4c
|
Renato Botelho
|
<?php
|
565 |
7ea27b0d
|
Renato Botelho
|
endif;
|
566 |
4c291f4c
|
Renato Botelho
|
?>
|
567 |
7ea27b0d
|
Renato Botelho
|
</td>
|
568 |
|
|
</tr>
|
569 |
4c291f4c
|
Renato Botelho
|
<?php
|
570 |
7ea27b0d
|
Renato Botelho
|
$i++;
|
571 |
|
|
endforeach;
|
572 |
4c291f4c
|
Renato Botelho
|
?>
|
573 |
7ea27b0d
|
Renato Botelho
|
</tbody>
|
574 |
|
|
</table>
|
575 |
|
|
</form>
|
576 |
4c291f4c
|
Renato Botelho
|
<?php
|
577 |
|
|
endif;
|
578 |
|
|
?>
|
579 |
|
|
</div>
|
580 |
45ee90ed
|
Matthew Grooms
|
</td>
|
581 |
|
|
</tr>
|
582 |
|
|
</table>
|
583 |
3e321df2
|
Ermal Luçi
|
<?php include("fend.inc"); ?>
|
584 |
9dfaf533
|
Colin Fleming
|
</body>
|
585 |
|
|
</html>
|