From dfabd1513704b84a736bff604f3eaaf8d1fdcf45 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 10 Aug 2006 06:41:13 +0000 Subject: [PATCH] Added netatalk acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4456 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/netatalk/class_netatalk.inc | 32 +++++++++++--------- plugins/personal/netatalk/main.inc | 15 ++------- plugins/personal/netatalk/netatalk.tpl | 11 +++++-- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/plugins/personal/netatalk/class_netatalk.inc b/plugins/personal/netatalk/class_netatalk.inc index 177ec4daf..8833b0b64 100644 --- a/plugins/personal/netatalk/class_netatalk.inc +++ b/plugins/personal/netatalk/class_netatalk.inc @@ -54,7 +54,8 @@ class netatalk extends plugin { var $mountDirectory = "/Network/Servers"; /* Attributes to save to LDAP */ - var $attributes = array ("apple-user-homeurl", "apple-user-homeDirectory"); + /* Slip setting those attributes, we can't define class variables with - */ +// var $attributes = array ("apple-user-homeurl", "apple-user-homeDirectory"); /* Attributes to use in smarty template */ var $smarty_attributes = array ("apple_user_homepath_raw", "shares", "selectedshare"); @@ -175,8 +176,8 @@ class netatalk extends plugin { asort($this->shares); /* Assign attributes and ACL to smarty */ - $smarty->assign("netatalkShareACL", chkacl($this->acl, "netatalkShare")); - $smarty->assign("netatalkUserHomepathACL", chkacl($this->acl, "netatalkUserHomepath")); + $smarty->assign("netatalkShareACL", $this->getacl("netatalkShare")); + $smarty->assign("netatalkUserHomepathACL", $this->getacl("netatalkUserHomepath")); foreach ($this->smarty_attributes as $val) { $smarty->assign("$val", $this-> $val); if (in_array($val, $this->is_chk_box)) { @@ -247,7 +248,7 @@ class netatalk extends plugin { } unset ($this->attrs[$name]); } - + /* Write back to ldap */ $ldap->cd($this->dn); $this->cleanup(); @@ -269,7 +270,7 @@ class netatalk extends plugin { function save_object() { if (isset ($_POST['netatalkTab'])) { /* Save ldap attributes */ - plugin :: save_object(); +// plugin :: save_object(); foreach($this->post_attributes as $val) { if (isset ($_POST[$val])) { @@ -323,20 +324,23 @@ class netatalk extends plugin { } - /* Return plugin informations for acl handling - #FIXME Attributes aren't translated */ + /* Return plugin informations for acl handling*/ function plInfo() { return (array( - "plDescription" => _("Apple talk"), + "plDescription" => _("Netatalk"), "plSelfModify" => TRUE, - "plDepends" => array("objectClass" => "gosaAccount"), - "apple-user-homeurl" => _("apple-user-homeurl"), - "apple-user-homeDirectory" => _("apple-user-homeDirectory"))); + "plDepends" => array("user"), + "plPriority" => 1, + "plSection" => "personal", + "plCategory" => array("users"), + "plOptions" => array(), + + "plProvidedAcls" => array( + "netatalkUserHomepath" => _("User home path"), + "netatalkShare" => _("Share")) + )); } - - - } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/personal/netatalk/main.inc b/plugins/personal/netatalk/main.inc index f46142a1b..bdab63162 100644 --- a/plugins/personal/netatalk/main.inc +++ b/plugins/personal/netatalk/main.inc @@ -30,6 +30,8 @@ if (!$remove_lock) { /* Create netatalk object on demand */ if (!isset ($_SESSION['netatalk']) || (isset ($_GET['reset']) && $_GET['reset'] == 1)) { $_SESSION['netatalk'] = new netatalk($config, $ui->dn); + $_SESSION['netatalk']->set_acl_base($ui->dn); + $_SESSION['netatalk']->set_acl_category("users"); } $netatalk = $_SESSION['netatalk']; @@ -54,16 +56,6 @@ if (!$remove_lock) { $_SESSION['edit'] = TRUE; } - /* Adjust acl's to mode */ - if (isset ($_SESSION['edit'])) { - $acl = get_permissions($ui->dn, $ui->subtreeACL); - $netatalk->acl = get_module_permission($acl, "netatalk", $ui->dn); - } else { - $acl = get_permissions($ui->dn, $ui->subtreeACL); - $editacl = get_module_permission($acl, "netatalk", $ui->dn); - $netatalk->acl = "#none#"; - } - /* save changes to LDAP and disable edit mode */ if (isset ($_POST['edit_finish'])) { @@ -74,7 +66,6 @@ if (!$remove_lock) { if (count($message) == 0) { $netatalk->save(); gosa_log("User/netatalk object'".$ui->dn."' has been saved"); - $netatalk->acl = "#none#"; del_lock($ui->dn); sess_del('edit'); @@ -107,7 +98,7 @@ if (!$remove_lock) { $info = "\"\" ".$ui->dn." "; } else { $info = "\"\" ".$ui->dn." "; - if (isset ($editacl) && $editacl != "#none#") { + if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/netatalk"))){ $info .= "\"\" "._("Click the 'Edit' button below to change informations in this dialog"); $display .= "\n"; } diff --git a/plugins/personal/netatalk/netatalk.tpl b/plugins/personal/netatalk/netatalk.tpl index 0f5b4a039..5c9aa908f 100644 --- a/plugins/personal/netatalk/netatalk.tpl +++ b/plugins/personal/netatalk/netatalk.tpl @@ -4,14 +4,21 @@ - + +{render acl=$netatalkShareACL} + +{/render} - +{render acl=$netatalkUserHomepathACL} + +{/render} -- 2.30.2