mango r166 - in trunk: . lib www



Author: ovitters
Date: Sat May 31 20:51:33 2008
New Revision: 166
URL: http://svn.gnome.org/viewvc/mango?rev=166&view=rev

Log:
	* lib/user.php: Typo fix.
	* www/update_user.php: Remove savedkey handling. Just pass the entire
	key to the form, much easier.
	* www/update_user.xsl: Follow changes made above.



Modified:
   trunk/ChangeLog
   trunk/lib/user.php
   trunk/www/update_user.php
   trunk/www/update_user.xsl

Modified: trunk/lib/user.php
==============================================================================
--- trunk/lib/user.php	(original)
+++ trunk/lib/user.php	Sat May 31 20:51:33 2008
@@ -236,7 +236,7 @@
         }
 
         // Change of shell access?
-        if ($olduser->_has_shell() xor $user->_should_have_shell()) {
+        if ($olduser->_has_shell() xor $this->_should_have_shell()) {
             $userchanges['loginShell'][] = $this->which_shell();
             $userchanges['homeDirectory'][] = $this->which_homedir();
 

Modified: trunk/www/update_user.php
==============================================================================
--- trunk/www/update_user.php	(original)
+++ trunk/www/update_user.php	Sat May 31 20:51:33 2008
@@ -30,9 +30,6 @@
     // Details for the user being created
     var $user;
 
-    // Remember existing SSH keys between requests
-    var $savedKeys;
-    
     // Groups the user belongs to that we're not responsible for
     var $othergroups;
     
@@ -52,7 +49,6 @@
         }
 
         $this->user = $user;
-        $this->savedKeys = $user->authorizedKeys;
         $this->othergroups = array_diff($user->groups, $AFFECTEDGROUPS);
         $this->tab = "general";
     }
@@ -108,20 +104,6 @@
         // Add current details to form
         $this->user->add_to_node($dom, $formnode);
         
-        // Add SSH keys with indices
-        if($this->tab == "sshkeys") {
-            $savedkeysnode = $formnode->appendChild($dom->createElement("savedkeys"));
-            foreach($this->savedKeys as $ref => $key) {
-                $keynode = $savedkeysnode->appendChild($dom->createElement("key"));
-                $fingerprint = is_valid_ssh_pub_key($key, False, True);
-                if ($fingerprint !== false) {
-                    $keynode->setAttribute("fingerprint", $fingerprint);
-                }
-                $keynode->setAttribute("ref", $ref);
-                $keynode->appendChild($dom->createTextNode($key));
-            }
-        }
-        
         // Add initialisation error, if any
         if(PEAR::isError($this->error)) {
             $node = $formnode->appendChild($dom->createElement("error"));
@@ -215,20 +197,13 @@
             if(empty($key) || substr($key, 0, 3) != "ssh") continue;
             $this->user->authorizedKeys[] = $key;
         }
-        foreach($_POST as $key => $value) {
-            if(substr($key, 0, 14) == "authorizedKey-") {
-                $i = substr($key, 14);
-                if(!empty($this->savedKeys[$i]))
-                    $this->user->authorizedKeys[] = $this->savedKeys[$i];
-            }
+        foreach($_POST['authorizedKey'] as $value) {
+            $this->user->authorizedKeys[] = $value;
         }
 
         // Deduplicate keys
         $this->user->authorizedKeys = array_unique($this->user->authorizedKeys);
 
-        // Remember keys for next hit   
-        $this->savedKeys = $this->user->authorizedKeys;
-
         return true;
     }
     

Modified: trunk/www/update_user.xsl
==============================================================================
--- trunk/www/update_user.xsl	(original)
+++ trunk/www/update_user.xsl	Sat May 31 20:51:33 2008
@@ -116,9 +116,9 @@
        SSH key(s)
       </th>
       <td>
-       <xsl:for-each select="savedkeys/key">
+       <xsl:for-each select="authorizedKey">
         <div>
-         <input type="checkbox" name="authorizedKey-{ ref}" value="{.}" checked="true"/>
+         <input type="checkbox" name="authorizedKey[]" value="{.}" checked="true"/>
 	 <span>
 	   <xsl:choose>
 	     <xsl:when test="boolean(@fingerprint)">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]