Code

Added netatalk acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Aug 2006 06:41:13 +0000 (06:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Aug 2006 06:41:13 +0000 (06:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4456 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/netatalk/class_netatalk.inc
plugins/personal/netatalk/main.inc
plugins/personal/netatalk/netatalk.tpl

index 177ec4daf809bbad7396de6dd238ea87296ca56f..8833b0b6425295aa27e3d2b9b8a1d35de6d6f736 100644 (file)
@@ -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:
index f46142a1b7f89ba1e3d3e65c6f56a23044e6ec8b..bdab63162c4b404386eb11639ca2df6f434c198a 100644 (file)
@@ -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 = "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$ui->dn."&nbsp;";
     } else {
       $info = "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png')."\"> ".$ui->dn."&nbsp;";
-      if (isset ($editacl) && $editacl != "#none#") {
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/netatalk"))){
         $info .= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png')."\"> "._("Click the 'Edit' button below to change informations in this dialog");
         $display .= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
       }
index 0f5b4a0394aa947f7081517832fee4be5afa3100..5c9aa908f20a5a0ed4951f808f0c77360340e819 100644 (file)
@@ -4,14 +4,21 @@
                <label for="apple_user_share">{t}Share{/t}</label>
        </td>
        <td>
-               <select name="apple_user_share" id="apple_user_share" {$netatalkShareACL} >{html_options options=$shares selected=$selectedshare}</select>
+
+{render acl=$netatalkShareACL}
+               <select name="apple_user_share" id="apple_user_share">
+                       {html_options options=$shares selected=$selectedshare}
+               </select>
+{/render}
        </td>
 <tr>
        <td>
                <label for="apple_user_homepath_raw">{t}Path{/t}</label>
        </td>
        <td>
-               <input name="apple_user_homepath_raw" id="apple_user_homepath_raw" type="text" value="{$apple_user_homepath_raw}" size="25" maxlength="65" {$netatalkUserHomepathACL} />
+{render acl=$netatalkUserHomepathACL}
+               <input name="apple_user_homepath_raw" id="apple_user_homepath_raw" type="text" value="{$apple_user_homepath_raw}" size="25" maxlength="65"/>
+{/render}
        </td>
 </tr>
 </table>