From: cajus Date: Mon, 31 Aug 2009 16:58:30 +0000 (+0000) Subject: Updated to reflect ssh X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cc8c50519f2973632eb9b149aea59e5a72d93ff6;p=gosa.git Updated to reflect ssh git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14174 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/personal/posix/class_posixAccount.inc b/gosa-core/plugins/personal/posix/class_posixAccount.inc index c26f27af6..788f72cd2 100644 --- a/gosa-core/plugins/personal/posix/class_posixAccount.inc +++ b/gosa-core/plugins/personal/posix/class_posixAccount.inc @@ -72,15 +72,16 @@ class posixAccount extends plugin var $secondaryGroups= array(); var $primaryGroup= 0; var $was_trust_account= FALSE; - var $memberGroup = array(); - var $grouplist = array(); - var $ui = array(); + var $memberGroup= array(); + var $grouplist= array(); + var $ui= array(); + var $ssh= null; - var $GroupRegex = "*"; - var $GroupUserRegex = "*"; - var $SubSearch = false; + var $GroupRegex= "*"; + var $GroupUserRegex= "*"; + var $SubSearch= false; - var $view_logged = FALSE; + var $view_logged= false; /* attribute list for save action */ var $CopyPasteVars = @@ -102,6 +103,8 @@ class posixAccount extends plugin 'dn' from LDAP */ function posixAccount (&$config, $dn= NULL) { + global $class_mapping; + /* Configuration is fine, allways */ $this->config= $config; @@ -180,6 +183,11 @@ class posixAccount extends plugin $this->savedGroupMembership= $this->groupMembership; $this->savedUidNumber= $this->uidNumber; $this->savedGidNumber= $this->gidNumber; + + // Instanciate SSH object if available + if (isset($class_mapping["sshPublicKey"])){ + $this->ssh= new sshPublicKey($this->config, $this->dn); + } } /* Adjust shadow checkboxes */ @@ -302,6 +310,7 @@ class posixAccount extends plugin } } } + /* Trigger group edit? */ if (isset($_POST['edit_groupmembership'])){ $this->group_dialog= TRUE; @@ -451,18 +460,30 @@ class posixAccount extends plugin $smarty->assign("alphabet", generate_alphabet()); $smarty->assign("depselect", session::get('CurrentMainBase')); $smarty->assign("hint", print_sizelimit_warning()); - $smarty->assign("apply", apply_filter()); + $display.= $smarty->fetch (get_template_path('posix_groups.tpl', TRUE, dirname(__FILE__))); return ($display); } + // Handle ssh dialog? + if ($this->ssh && preg_match('/[rw]/', $this->getacl("sshPublicKey"))) { + if ($result= $this->ssh->execute()) { + $this->dialog= true; + return $result; + } + $this->dialog= false; + } + + /* Show main page */ $smarty= get_smarty(); /* In 'MyAccount' mode, we must remove write acls if we are not in editing mode. */ $SkipWrite = (!isset($this->parent) || !$this->parent) && !session::is_set('edit'); + $smarty->assign("sshPublicKeyACL", $this->getacl("sshPublicKey")); + /* Depending on pwmode, currently hardcoded because there are no other methods */ if ( 1 == 1 ){ $smarty->assign("pwmode", dirname(__FILE__)."/posix_shadow"); @@ -638,6 +659,11 @@ class posixAccount extends plugin $smarty->assign("workstations", $this->accessTo); + // Add SSH button if available + if ($this->ssh) { + $smarty->assign("sshPublicKey", 1); + } + $smarty->assign("apply", apply_filter()); $smarty->assign("multiple_support" , $this->multiple_support_active); $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__))); @@ -1010,6 +1036,11 @@ class posixAccount extends plugin /* Remove lock needed for unique id generation */ del_lock ("uidnumber"); + // Save ssh stuff if needed + if ($this->ssh) { + $this->ssh->setDN($this->dn); + $this->ssh->save(); + } /* Take care about groupMembership values: add to groups */ foreach ($this->groupMembership as $key => $value){ diff --git a/gosa-core/plugins/personal/posix/generic.tpl b/gosa-core/plugins/personal/posix/generic.tpl index 061b87840..a02e385f4 100644 --- a/gosa-core/plugins/personal/posix/generic.tpl +++ b/gosa-core/plugins/personal/posix/generic.tpl @@ -116,6 +116,13 @@
+ {if $sshPublicKey == 1} + {render acl=$sshPublicKeyACL} +

{t}SSH keys{/t}

+ +
+ {/render} + {/if}

{t}Account{/t}

{include file="$pwmode.tpl"}