]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
* If we are editing a group show a comment that in the radiusd sql module the group...
authorkkalev <kkalev>
Sat, 7 Sep 2002 14:52:33 +0000 (14:52 +0000)
committerkkalev <kkalev>
Sat, 7 Sep 2002 14:52:33 +0000 (14:52 +0000)
  after the user tables. As a result user values should in general overwrite default values.
* Add support for the default_user_profile of the sql module in lib/sql/defaults.php3

Changelog
conf/admin.conf
htdocs/user_edit.php3
lib/sql/defaults.php3

index 1f74d85423cf2018357e8c93164bf6a393ca0bf7..8c24c9a396b9b6d314d5e22dc082e072263a759a 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -16,6 +16,9 @@ Ver 1.56:
 * In the user edit page print a message under the User Password field about if it exists or not. Update
   the user_info.php3 lib files to check for it.
 * In lib/ldap/defaults.php3 Dialup-Access should not be added in the default_vals. It is not inherited.
+* If we are editing a group show a comment that in the radiusd sql module the group tables are evaluated
+  after the user tables. As a result user values should in general overwrite default values.
+* Add support for the default_user_profile of the sql module in lib/sql/defaults.php3
 Ver 1.55:
 * Update the FAQ about missing attributes from the user/group edit pages and add a few comments
   in the configuration files
index 363cd8158d4ba357f47d85482ab600b1b4b5942f..47393a85c05a68e44d342ad287c315dd50f86ceb 100644 (file)
@@ -105,6 +105,11 @@ sql_usergroup_table: usergroup
 sql_use_user_info_table: true
 sql_use_operators: true
 #
+# Set this to the value of the default_user_profile in your
+# sql.conf if that one is set. If it is not set leave blank
+# or commented out
+#sql_default_user_profile: DEFAULT
+#
 #
 sql_password_attribute: User-Password
 sql_date_format: Y-m-d
index 8779940bf5960312cc585b8c26b53668ecf37a2a..010317032cbd9116a4518af7bfc6d147bb2f21e5 100644 (file)
@@ -107,6 +107,14 @@ else if ($badusers == 1){
       <input type=hidden name=badusers value="0">
        <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
 <?php
+if ($user_type == 'group')
+       echo <<<EOM
+Note: The attributes contained in the groups the user belongs to<br>
+are extracted after the attributes in the radcheck/radreply tables.<br>
+Please take that into consideration when adding attributes in the group<br>
+and selecting operators.
+<br>
+EOM;
 if ($user_type != 'group'){
        echo <<<EOM
 <tr>
index 6c706a5a890644c8f725fefc4ecf0c7355ce43f8..fbaa3ef3629e3c198a56772bc7f0a8c6de10556f 100644 (file)
@@ -14,34 +14,26 @@ if ($login != ''){
                $op = "";
                $use_op = 0;
        }
-       unset($item_vals);
-       unset($tmp);
-       $link = @da_sql_pconnect($config);
-       if ($link){
-               $res = @da_sql_query($link,$config,
-               "SELECT GroupName FROM $config[sql_usergroup_table] WHERE UserName = '$login';");
-               if ($res){
-                       while(($row = @da_sql_fetch_array($res,$config)))
-                               $member_groups[] = $row[GroupName];
-               }
-               if (isset($member_groups)){
-                       foreach ($member_groups as $group){
-                               $res = @da_sql_query($link,$config,
-                               "SELECT Attribute,Value $op FROM $config[sql_groupcheck_table]
-                               WHERE GroupName = '$group';");
-                               if ($res){
-                                       while(($row = @da_sql_fetch_array($res,$config))){
-                                               $attr = $row[Attribute];
-                                               $val = $row[Value];
-                                               if ($use_op){
-                                                       $oper = $row[op];
-                                                       $tmp["$attr"][operator][]="$oper";
-                                               }
-                                               $tmp["$attr"][]="$val";
-                                               $tmp["$attr"][count]++;
-                                       }
+       $overwrite_defaults = 1;
+       $stop = 0;
+       $times = 0;
+       do{
+               unset($item_vals);
+               unset($member_groups);
+               unset($tmp);
+               $times++;
+               $link = @da_sql_pconnect($config);
+               if ($link){
+                       $res = @da_sql_query($link,$config,
+                       "SELECT GroupName FROM $config[sql_usergroup_table] WHERE UserName = '$login';");
+                       if ($res){
+                               while(($row = @da_sql_fetch_array($res,$config)))
+                                       $member_groups[] = $row[GroupName];
+                       }
+                       if (isset($member_groups)){
+                               foreach ($member_groups as $group){
                                        $res = @da_sql_query($link,$config,
-                                       "SELECT Attribute,Value $op FROM $config[sql_groupreply_table]
+                                       "SELECT Attribute,Value $op FROM $config[sql_groupcheck_table]
                                        WHERE GroupName = '$group';");
                                        if ($res){
                                                while(($row = @da_sql_fetch_array($res,$config))){
@@ -51,27 +43,59 @@ if ($login != ''){
                                                                $oper = $row[op];
                                                                $tmp["$attr"][operator][]="$oper";
                                                        }
-                                                       $tmp["$attr"][] = "$val";
+                                                       $tmp["$attr"][]="$val";
                                                        $tmp["$attr"][count]++;
                                                }
+                                               $res = @da_sql_query($link,$config,
+                                               "SELECT Attribute,Value $op FROM $config[sql_groupreply_table]
+                                               WHERE GroupName = '$group';");
+                                               if ($res){
+                                                       while(($row = @da_sql_fetch_array($res,$config))){
+                                                               $attr = $row[Attribute];
+                                                               $val = $row[Value];
+                                                               if ($use_op){
+                                                                       $oper = $row[op];
+                                                                       $tmp["$attr"][operator][]="$oper";
+                                                               }
+                                                               $tmp["$attr"][] = "$val";
+                                                               $tmp["$attr"][count]++;
+                                                       }
+                                               }
+                                               else
+                                                       echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n";
                                        }
                                        else
-                                               echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n";
-                               }
-                               else
-                                       echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
-                               foreach($attrmap as $key => $val){
-                                       if (isset($tmp[$val])){
-                                               if ($use_op)
-                                                       $default_vals["$key"][operator] = $tmp["$val"][operator];
-                                               if ($tmp[$val][0] != '')
-                                                       $default_vals["$key"] = $tmp["$val"];
+                                               echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
+                                       foreach($attrmap as $key => $val){
+                                               if (isset($tmp[$val])){
+                                                       if (isset($default_vals["$key"]) && $overwrite_defaults){
+                                                               if ($use_op)
+                                                                       $default_vals["$key"][operator] = $tmp["$val"][operator];
+                                                               if ($tmp[$val][0] != '')
+                                                                       $default_vals["$key"] = $tmp["$val"];
+                                                       }
+                                               }
                                        }
                                }
                        }
+                       if ($times == 1){
+                               if ($config[sql_default_user_profile] == '')
+                                       $stop = 1;
+                               else{
+                                       $saved_login = $login;
+                                       $saved_member_groups = $member_groups;
+                                       $login = $config[sql_default_user_profile];
+                                       $overwrite_defaults = 0;
+                               }
+                       }
+                       if ($times == 2){
+                               $login = $saved_login;
+                               $member_groups = $saved_member_groups;
+                               $stop = 1;
+                       }
                }
-       }
-       else
-               echo "<b>Could not connect to database</b><br>\n";
+               else
+                       echo "<b>Could not connect to database</b><br>\n";
+       }while($stop == 0);
 }
 ?>