From 2837ea88e4ec1195760f5424d1158a2510f1e92f Mon Sep 17 00:00:00 2001
From: cajus
Date: Tue, 1 Sep 2009 06:51:10 +0000
Subject: [PATCH] Add ACL to ssh
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14178 594d385d-05f5-0310-b6e9-bd551577e9d8
---
gosa-plugins/ssh/personal/ssh/class_sshPublicKey.inc | 10 +++++++---
gosa-plugins/ssh/personal/ssh/sshPublicKey.tpl | 2 ++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gosa-plugins/ssh/personal/ssh/class_sshPublicKey.inc b/gosa-plugins/ssh/personal/ssh/class_sshPublicKey.inc
index a87787c63..bd286eaaf 100644
--- a/gosa-plugins/ssh/personal/ssh/class_sshPublicKey.inc
+++ b/gosa-plugins/ssh/personal/ssh/class_sshPublicKey.inc
@@ -29,12 +29,14 @@ class sshPublicKey
var $dn;
var $dialog= false;
var $enabled= false;
+ var $acl;
- function sshPublicKey(&$config, $dn)
+ function sshPublicKey(&$config, $dn, $acl)
{
/* Configuration is fine, allways */
$this->config= &$config;
$this->dn= $dn;
+ $this->acl= $acl;
// Load list of public keys
$data= array();
@@ -99,7 +101,7 @@ class sshPublicKey
}
// Remove action?
- if (isset($_POST['remove_sshpublickey']) && isset($_POST['keylist'])){
+ if (isset($_POST['remove_sshpublickey']) && isset($_POST['keylist']) && preg_match('/w/', $this->acl)){
foreach($_POST['keylist'] as $index){
if (isset($this->publicKeys[$index])){
unset($this->publicKeys[$index]);
@@ -110,7 +112,7 @@ class sshPublicKey
}
// Upload action?
- if (isset($_POST['upload_sshpublickey'])) {
+ if (isset($_POST['upload_sshpublickey']) && preg_match('/w/', $this->acl)) {
if ($_FILES['key']['error'] > 0){
msg_dialog::display(_("Upload error"), _("Error uploading the key!")." (".$_FILES['key']['error'].")", ERROR_DIALOG);
} else {
@@ -153,6 +155,7 @@ class sshPublicKey
$data[$index]= sprintf(_("SSH %s key, Fingerprint: %s, Comment: %s"), $info['type']=='ssh-dss'?"DSA":"RSA", $info['fingerprint'], $info['comment']);
}
$smarty->assign("keylist", $data);
+ $smarty->assign("sshPublicKeyACL", $this->acl);
return $smarty->fetch (get_template_path('sshPublicKey.tpl', TRUE, dirname(__FILE__)));
}
@@ -217,6 +220,7 @@ class sshPublicKey
return rtrim($result, ':');
}
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/gosa-plugins/ssh/personal/ssh/sshPublicKey.tpl b/gosa-plugins/ssh/personal/ssh/sshPublicKey.tpl
index 132eec558..a53b64e6d 100644
--- a/gosa-plugins/ssh/personal/ssh/sshPublicKey.tpl
+++ b/gosa-plugins/ssh/personal/ssh/sshPublicKey.tpl
@@ -6,11 +6,13 @@
{html_options options=$keylist}
+{render acl=$sshPublicKeyACL}
+{/render}
--
2.30.2