Code

Added ogroup acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Aug 2006 05:40:48 +0000 (05:40 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Aug 2006 05:40:48 +0000 (05:40 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4549 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/generic.tpl

index 9a220b980b699612ef27147d7f581d6740786937..3243c58552ffefc85ed3302c160eaa85e2853569 100644 (file)
@@ -85,12 +85,6 @@ class ogroup extends plugin
      $this->base = $_SESSION['CurrentMainBase'];
     }
 
-     /* set permissions */
-    $ui= get_userinfo();
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $this->acl= get_module_permission($acl, "ogroup", $ui->dn);
-
-
     /* Load member data */
     $this->reload();
   }
@@ -176,6 +170,12 @@ class ogroup extends plugin
     /* Load templating engine */
     $smarty= get_smarty();
 
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+
     /* Base select dialog */
     $once = true;
     foreach($_POST as $name => $value){
@@ -312,12 +312,6 @@ class ogroup extends plugin
     /* Fields */
     foreach ($this->attributes as $val){
       $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
-    }
-
-    /* Assign ACL's */
-    foreach (array("base", "members") as $val){
-      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
 
     return ($smarty->fetch (get_template_path('generic.tpl', TRUE)));
@@ -330,11 +324,6 @@ class ogroup extends plugin
     /* Save additional values for possible next step */
     if (isset($_POST['ogroupedit'])){
       plugin::save_object();
-
-      if (chkacl ($this->acl, "base") == "" && isset($_POST["base"])){
-        $this->base= $_POST["base"];
-      }
-
     }
   }
 
@@ -649,15 +638,13 @@ class ogroup extends plugin
       $message[]= _("There is already an object with this cn.");
     } 
 
-    $ui= get_userinfo();
-    $acl= get_permissions ($new_dn, $ui->subtreeACL);
-    $acl= get_module_permission($acl, "group", $new_dn);
-    if (chkacl($acl, "create") != ""){
+    print_a($this);
+    if ($this->acl_is_createable()){
       $message[]= _("You have no permissions to create a group on this 'Base'.");
     }
 
     /* must: cn */
-    if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
+    if ($this->cn == "" && $this->acl_is_writeable("cn")){
       $message[]= "The required field 'Name' is not set.";
     }
 
@@ -760,6 +747,7 @@ class ogroup extends plugin
                                                       "objectClass"  => "gosaGroupOfNames")),
           "plProvidedAcls"=> array(
             "cn"                => _("Name"),
+            "base"              => _("Base"),
             "description"       => _("Description"),
             "member"            => _("Member"))
           ));
index 182f28ec3d11abea5daf912bbf95b45454a6149b..2585d2c8cfdb6798fe899c6a47aeb24492e6132a 100644 (file)
@@ -6,12 +6,17 @@
     <tr>
      <td><LABEL for="cn">{t}Group name{/t}</LABEL>{$must}</td>
      <td>
-       <input name="cn" id="cn" size=25 maxlength=60 {$cnACL} value="{$cn}" title="{t}Name of the group{/t}">
+{render acl=$cnACL}
+       <input name="cn" id="cn" size=25 maxlength=60 value="{$cn}" title="{t}Name of the group{/t}">
+{/render}
      </td>
     </tr>
     <tr>
      <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-     <td><input id="description" name="description" size=40 maxlength=80 {$descriptionACL} value="{$description}" title="{t}Descriptive text for this group{/t}">
+     <td>
+{render acl=$descriptionACL}
+       <input id="description" name="description" size=40 maxlength=80 value="{$description}" title="{t}Descriptive text for this group{/t}">
+{/render}
      </td>
     </tr>
     <tr>
     <tr>
      <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
      <td>
-      <select size="1" id="base" name="base" {$baseACL} title="{t}Choose subtree to place group in{/t}">
+{render acl=$baseACL}
+      <select size="1" id="base" name="base" title="{t}Choose subtree to place group in{/t}">
        {html_options options=$bases selected=$base_select}
       </select>
-               {if $baseACL==""}
-                       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-               {else}
-                       <img src="images/folder_gray.png" class="center" title="{t}Select a base{/t}">
-               {/if}
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
      </td>
     </tr>
    </table>
   <td style="border-left:1px solid #A0A0A0; padding-left:10px;">
    <b><LABEL for="members">{t}Member objects{/t}</LABEL></b>&nbsp;({$combinedObjects})
    <br>
-   <select style="width:100%; height:450px;" id="members" name="members[]" size="15" multiple {$gosaGroupObjectsACL}>
+{render acl=$memberACL}
+   <select style="width:100%; height:450px;" id="members" name="members[]" size="15" multiple>
     {$members}
    </select>
+{/render}
    <br>
-   <input type=submit value="{t}Add{/t}" name="edit_membership" {$gosaGroupObjectsACL}>&nbsp;
-   <input type=submit value="{t}Delete{/t}" name="delete_membership" {$gosaGroupObjectsACL}>
+{render acl=$memberACL}
+   <input type=submit value="{t}Add{/t}" name="edit_membership">&nbsp;
+{/render}
+{render acl=$memberACL}
+   <input type=submit value="{t}Delete{/t}" name="delete_membership">
+{/render}
   </td>
  </tr>
 </table>