From 45ee90edb38f3c52a242d248468a992bf19f1c44 Mon Sep 17 00:00:00 2001 From: Matthew Grooms Date: Fri, 25 Jul 2008 02:28:31 +0000 Subject: Rewrite portions of the user manager to ensure data is properly synced to the system password and group databases. This is to provide better support for centralized user management when local account administration is preferred. I also took this opportunity to do some housekeeping. A lot of funtions that were only being used in one place or not at all were removed. The user page privelege checks were also simplified in preperation for future work in this area. --- usr/local/www/system_groupmanager.php | 384 ++++++++++++++++++---------------- 1 file changed, 207 insertions(+), 177 deletions(-) (limited to 'usr/local/www/system_groupmanager.php') diff --git a/usr/local/www/system_groupmanager.php b/usr/local/www/system_groupmanager.php index 59bc1ec..48f3a7b 100644 --- a/usr/local/www/system_groupmanager.php +++ b/usr/local/www/system_groupmanager.php @@ -208,24 +208,24 @@ if (isset($_POST['id'])) if ($_GET['act'] == "del") { if ($a_group[$_GET['id']]) { - $ok_to_delete = true; - if (isset($config['system']['user'])) { - foreach ($config['system']['user'] as $userent) { - if ($userent['groupname'] == $a_group[$_GET['id']]['name']) { - $ok_to_delete = false; - $input_errors[] = "users still exist who are members of this group!"; - break; - } - } - } - if ($ok_to_delete) { - unset($a_group[$_GET['id']]); - write_config(); - header("Location: system_groupmanager.php"); - exit; - } + del_local_group($a_group[$_GET['id']]); + unset($a_group[$_GET['id']]); + write_config(); + header("Location: system_groupmanager.php"); + exit; } } + +if($_GET['act']=="edit"){ + if (isset($id) && $a_group[$id]) { + $pconfig['name'] = $a_group[$id]['name']; + $pconfig['description'] = $a_group[$id]['description']; + if (is_array($a_group[$id]['pages'])) + $pconfig['pages'] = $a_group[$id]['pages']; + else + $pconfig['pages'] = array(); + } +} if ($_POST) { @@ -252,30 +252,30 @@ if ($_POST) { } if (!$input_errors) { - + $group = array(); if (isset($id) && $a_group[$id]) $group = $a_group[$id]; - if($id) - unset($a_group[$id]); - $group['name'] = $_POST['groupname']; $group['description'] = $_POST['description']; + unset($group['pages']); - foreach ($pages as $fname => $title) { $identifier = str_replace('.php','XXXUMXXX',$fname); $identifier = str_replace('.','XXXDOTXXX',$identifier); if ($_POST[$identifier] == 'yes') { $group['pages'][] = $fname; } - } - + } + if (isset($id) && $a_group[$id]) $a_group[$id] = $group; - else + else { + $group['gid'] = $config['system']['nextgid']++; $a_group[] = $group; - + } + + set_local_group($group); write_config(); header("Location: system_groupmanager.php"); @@ -286,161 +286,191 @@ if ($_POST) { include("head.inc"); ?> - - - - - - - - -
-
    - -
-
+ +"> - - - -
- - - - + + + + + + + + + + + + + + + + + + +
Group name - +
+
    + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Group name + +
Description + +
+ Group description, for your own information only +
+
+ Select that pages that this group may access. + Members of this group will be able to perform + all actions that are possible from each + individual web page. Ensure you set access + levels appropriately.
+
+ + +  Note: + + Pages marked with an * are strongly recommended + for every group. + +
+ + +
+ + + + + + + $title): + $identifier = str_replace('.php','XXXUMXXX',$fname); + $identifier = str_replace('.','XXXDOTXXX',$identifier); + $checked = ""; + if (in_array($fname,$pconfig['pages'])) + $checked = "checked"; + ?> + + + + + + +
 Page DescriptionFilename
+ > +
+
  + + + + +
+ + + + + + + + + + + - - - - - - - - -
Group nameDescriptionMember CountPages Accessible
- - -
- - - - - - - $title) { - $identifier = str_replace('.php','XXXUMXXX',$fname); - $identifier = str_replace('.','XXXDOTXXX',$identifier); - ?> - - - - - -
 Page DescriptionFilename
- >
-
  - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
Group nameDescriptionPages Accessible
-   - -   - - -   - -  
- Additional webGui admin groups can be added here. Each group can be restricted to specific portions of the webGUI. Individually select the desired web pages each group may access. For example, a troubleshooting group could be created which has access only to selected Status and Diagnostics pages. -
- + +
+   + +   + + + + + + + + + + +   + + + +
+ + +
+ Additional webGui admin groups can be added here. + Each group can be restricted to specific portions of the webGUI. + Individually select the desired web pages each group may access. + For example, a troubleshooting group could be created which has + access only to selected Status and Diagnostics pages. +
+ + -
- - + + + + -- cgit v1.1