Code

ServGeneric acls, not finished yet
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Sep 2006 11:42:13 +0000 (11:42 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Sep 2006 11:42:13 +0000 (11:42 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4729 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servGeneric.inc
plugins/admin/systems/server.tpl

index 3e616ebece1d22b97ac215a65103e6a319b103ae..34397aea6ff261d0f03dc6b5dbac357620df146e 100644 (file)
@@ -140,14 +140,25 @@ class servgeneric extends plugin
 
     /* Fill templating stuff */
     $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* Assign base ACL */
+    $baseACL = $this->getacl("base");
+    if(!$this->acl_is_moveable()) {
+      $baseACL = preg_replace("/w/","",$baseACL);
+    }
+    $smarty->assign("baseACL",          $baseACL);
+
     $smarty->assign("bases", $this->config->idepartments);
 
     /* Assign attributes */
     foreach ($this->attributes as $attr){
-      $smarty->assign($attr."ACL", chkacl($this->acl, $attr));
       $smarty->assign("$attr", $this->$attr);
     }
-    $smarty->assign("baseACL", chkacl($this->acl, "base"));
 
     $smarty->assign("staticAddress", "");
     $smarty->assign("base_select", $this->base);
@@ -204,10 +215,12 @@ class servgeneric extends plugin
   {
     plugin::save_object();
     $this->netConfigDNS->save_object();
-    /* Save base, since this is no LDAP attribute */
-    if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
-      $this->base= $_POST['base'];
+
+    /* Get base selection */
+    if($this->acl_is_moveable() && isset($_POST['base'])){
+      $this->base = $_POST['base'];
     }
+
   }
 
 
@@ -220,14 +233,14 @@ class servgeneric extends plugin
     $this->dn= "cn=".$this->cn.",ou=servers,ou=systems,".$this->base;
 
     /* must: cn */
-    if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
+    if ($this->cn == ""){
       $message[]= _("The required field 'Server name' is not set.");
     }
 
     $ui= get_userinfo();
     $acl= get_permissions ($this->dn, $ui->subtreeACL);
     $acl= get_module_permission($acl, "server", $this->dn);
-    if (chkacl($acl, "create") != ""){
+    if (!$this->acl_is_createable() && $this->dn == "new"){
       $message[]= _("You have no permissions to create a server on this 'Base'.");
     }
 
index f33a589dae5c15815ec6fca3ff177fe8c1aa68ec..3bd985a830c4767974ccfd9bea27eb367c2b210d 100644 (file)
@@ -4,25 +4,34 @@
        <table summary="">
         <tr>
          <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
-         <td><input name="cn" id="cn" size=20 maxlength=60 value="{$cn}"></td>
+         <td>
+{render acl=$cnACL}
+          <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+{/render}
+         </td>
         </tr>
         <tr>
          <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-         <td><input name="description" id="description" size=25 maxlength=80 value="{$description}"></td>
+         <td>
+{render acl=$descriptionACL}
+           <input name="description" id="description" size=25 maxlength=80 value="{$description}">
+{/render}
+          </td>
         </tr>
         <tr>
          <td><br><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
          <td>
           <br>
-          <select size="1" name="base" id="base" title="{t}Choose subtree to place terminal in{/t}" {$baseACL}>
-           {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}
-               </td>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/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>
        <tr>
      <td>{t}Mode{/t}</td>
      <td>
-      <select name="gotoMode" title="{t}Select terminal mode{/t}" {$gotoModeACL}>
+{render acl=$gotoModeACL}
+      <select name="gotoMode" title="{t}Select terminal mode{/t}">
        {html_options options=$modes selected=$gotoMode}
       </select>
+{/render}
      </td>
     </tr>
        </table>
 <table summary="">
  <tr>
   <td>
+{render acl=$FAIstateACL}
    <select size="1" name="saction" title="{t}Select action to execute for this server{/t}">
     <option disabled>&nbsp;</option>
     {html_options options=$actions}
    </select>
+{/render}
   </td>
   <td>
    <input type=submit name="action" value="{t}Execute{/t}">