[Fusionforge-commits] r16174 - in trunk/src: common/include www/account

Franck VILLAUME nerville at fusionforge.org
Wed Aug 29 20:24:19 CEST 2012


Author: nerville
Date: 2012-08-29 20:24:18 +0200 (Wed, 29 Aug 2012)
New Revision: 16174

Modified:
   trunk/src/common/include/User.class.php
   trunk/src/www/account/index.php
Log:
fix update account with new ssh key handling

Modified: trunk/src/common/include/User.class.php
===================================================================
--- trunk/src/common/include/User.class.php	2012-08-28 16:29:45 UTC (rev 16173)
+++ trunk/src/common/include/User.class.php	2012-08-29 18:24:18 UTC (rev 16174)
@@ -185,7 +185,7 @@
 	 * @param	int	The user_id
 	 * @param	int	The database result set OR array of data
 	 */
-	function GFUser($id = false, $res = false) {
+	function __construct($id = false, $res = false) {
 		$this->Error();
 		if (!$id) {
 			//setting up an empty object
@@ -658,6 +658,19 @@
 			return false;
 		}
 		$this->data_array = db_fetch_array($res);
+		if (($this->getUnixStatus() == 'A') && (forge_get_config('use_shell'))) {
+			$this->data_array['authorized_keys'] = array();
+			$res = db_query_params('select * from sshkeys where userid = $1 and deleted = 0', array($this->getID()));
+			while ($arr = db_fetch_array($res)) {
+				$this->data_array['authorized_keys'][$arr['id_sshkeys']]['upload'] = $arr['upload'];
+				$this->data_array['authorized_keys'][$arr['id_sshkeys']]['name'] = $arr['name'];
+				$this->data_array['authorized_keys'][$arr['id_sshkeys']]['fingerprint'] = $arr['fingerprint'];
+				$this->data_array['authorized_keys'][$arr['id_sshkeys']]['algorithm'] = $arr['algorithm'];
+				$this->data_array['authorized_keys'][$arr['id_sshkeys']]['deploy'] = $arr['deploy'];
+				$this->data_array['authorized_keys'][$arr['id_sshkeys']]['key'] = $arr['sshkey'];
+				$this->data_array['authorized_keys'][$arr['id_sshkeys']]['keyid'] = $arr['id_sshkeys'];
+			}
+		}
 		return true;
 	}
 

Modified: trunk/src/www/account/index.php
===================================================================
--- trunk/src/www/account/index.php	2012-08-28 16:29:45 UTC (rev 16173)
+++ trunk/src/www/account/index.php	2012-08-29 18:24:18 UTC (rev 16174)
@@ -300,7 +300,7 @@
 	<br />'._('SSH Shared Authorized Keys').': <strong>';
 		global $HTML;
 		$sshKeysArray = $u->getAuthorizedKeys();
-		if (count($sshKeysArray)) {
+		if (is_array($sshKeysArray && count($sshKeysArray)) {
 			$tabletop = array(_('Name'), _('Algorithm'), _('Fingerprint'), _('Uploaded'), _('Ready ?'));
 			$classth = array('', '', '', '', '');
 			echo $HTML->listTableTop($tabletop, false, 'sortable_sshkeys_listlinks', 'sortable', $classth);




More information about the Fusionforge-commits mailing list