Code

Ogroup acl updates
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Aug 2006 09:32:40 +0000 (09:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Aug 2006 09:32:40 +0000 (09:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4554 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/ogroups/class_mailogroup.inc
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/class_ogroupManagement.inc
plugins/admin/ogroups/class_termgroup.inc
plugins/admin/ogroups/mail.tpl
plugins/admin/ogroups/tabs_ogroups.inc
plugins/admin/ogroups/termgroup.tpl

index 0fb270913057afc88941844345b8bfd3fc5d3a52..33aaf01207c67ced96cd1d3a6b4eac6a6a800cdf 100644 (file)
@@ -48,9 +48,13 @@ class mailogroup extends plugin
     /* Initialize templating engine */
     $smarty= get_smarty();
 
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl("mail"));
+    }
+
     /* Assign mail attribute */
     $smarty->assign("mail", $this->mail);
-    $smarty->assign("mailACL", chkacl($this->acl, "mail"));
 
     /* Show main page */
     return ($display.$smarty->fetch (get_template_path('mail.tpl', TRUE)));
@@ -149,7 +153,7 @@ class mailogroup extends plugin
   }
 
 
-     function plInfo()
+   function plInfo()
   {
     return (array(
           "plShortName"   => _("Mail"),
index 3243c58552ffefc85ed3302c160eaa85e2853569..5867d460da27d4dd3545ac1e60a9be17a6596288 100644 (file)
@@ -638,8 +638,7 @@ class ogroup extends plugin
       $message[]= _("There is already an object with this cn.");
     } 
 
-    print_a($this);
-    if ($this->acl_is_createable()){
+    if ($this->orig_dn == "new" && $this->acl_is_createable()){
       $message[]= _("You have no permissions to create a group on this 'Base'.");
     }
 
index 0c64897d726c4003adc65fe339d7783cf3c668cb..a852876df8eb608d018392f2b5c9831cafc87b05 100644 (file)
@@ -172,9 +172,8 @@ class ogroupManagement extends plugin
 
       /* Load permissions for selected 'dn' and check if
          we're allowed to remove this 'dn' */
-      $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
-      $this->acl= get_module_permission($acl, "ogroup", $this->dn);
-      if (chkacl($this->acl, "delete") == ""){
+      $acl = $this->ui->get_permissions($this->dn,"ogroup");
+      if(preg_match("/d/",$acl)){
 
         /* Check locking, save current plugin in 'back_plugin', so
            the dialog knows where to return. */
@@ -204,7 +203,8 @@ class ogroupManagement extends plugin
 
       /* Some nice guy may send this as POST, so we've to check
          for the permissions again. */
-      if (chkacl($this->acl, "delete") == ""){
+      $acl = $this->ui->get_permissions($this->dn,"groups");
+      if(preg_match("/d/",$acl)){
 
         /* Delete request is permitted, perform LDAP action */
         $this->ogroup= new ogrouptabs($this->config,
@@ -258,13 +258,9 @@ class ogroupManagement extends plugin
          above dialog */
       add_lock ($this->dn, $this->ui->dn);
 
-      /* Set up the users ACL's for this 'dn' */
-      $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
-
       /* Register grouptab to trigger edit dialog */
-      $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'],
-          $this->dn);
-      $this->ogroup->set_acl($acl);
+      $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $this->dn, "ogroups");
+      $this->ogroup->set_acl_base($this->dn);
       $_SESSION['objectinfo']= $this->dn;
     }
 
index b6a505cb975f7df099dcb92b15acadf6731d3bdf..2d3d5e94217b6958006577bbf2ad962b33eb835a 100644 (file)
@@ -14,7 +14,6 @@ class termgroup extends plugin
   var $gotoNtpServers     = array();
   var $modes              = array();
   var $inheritTimeServer  = true;
-  var $acl                ;
   var $is_account                    = true; 
   var $orig_dn            = "";
   var $didAction          = FALSE;
@@ -38,10 +37,6 @@ class termgroup extends plugin
     $ldap= $config->get_ldap_link();
 
     $this->is_account = true;
-    $ui               = get_userinfo();
-    $acl              = get_permissions ($this->dn, $ui->subtreeACL);
-    $this->acl        = get_module_permission($acl, "group", $this->dn);
-
     $this->modes["active"]= _("Activated");
     $this->modes["locked"]= _("Locked");
 //    $this->modes["memcheck"]= _("Memory test");
@@ -109,7 +104,7 @@ class termgroup extends plugin
      /* Call common method to give check the hook */
     $message= plugin::check();
 
-    if (chkacl($this->acl, "create") != ""){
+    if ($this->acl_is_createable()){
       $message[]= _("You have no permissions to create a workstation on this 'Base'.");
     }
 
@@ -235,15 +230,18 @@ class termgroup extends plugin
     /* Set government mode */
     $smarty= get_smarty();
 
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated) {
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
     foreach($this->attributes as $attr){
       $smarty->assign($attr,      $this->$attr);
-      $smarty->assign($attr."ACL",chkacl($this->acl,$this->$attr));
     }
 
     /* Variables */
     foreach(array("gotoMode","gotoNtpServer") as $val){
       $smarty->assign($val."_select", $this->$val);
-      $smarty->assign($val."ACL", chkacl($this->acl, $val));
     }
 
     $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
@@ -256,7 +254,6 @@ class termgroup extends plugin
 
     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
     $smarty->assign("modes", $this->modes);
-    $smarty->assign("actionACL", chkacl($this->acl, 'action'));
 
     $tmp = array();
     foreach($this->gotoNtpServers as $server){
index 8039ab9920d26422f80a8d2a179dfdfc770f6dd1..6dd9d750492f4d89a2531a1b721b9ea9e020b449 100644 (file)
@@ -8,7 +8,11 @@
    <table summary="">
     <tr>
      <td><LABEL for="mail">{t}Primary address{/t}</LABEL>{$must}</td>
-     <td><input id="mail" name="mail" size=25 maxlength=65 {$mailACL} value="{$mail}" title="{t}Primary mail address for this distribution list{/t}"></td>
+     <td>
+{render acl=$mailACL}
+       <input id="mail" name="mail" size=50 maxlength=65 value="{$mail}" title="{t}Primary mail address for this distribution list{/t}">
+{/render}
+     </td>
     </tr>
    </table>
   </td>
index a8944ce26070a3dad00befd58a3ff3d686d158cf..35d19c4ff23b4a7a2f2c347f8708a1a7b6130c15 100644 (file)
@@ -3,7 +3,8 @@
 class ogrouptabs extends tabs
 {
   var $base= "";
-  
+  var $acl_category; 
   function reload($dd){
     $objects= preg_replace('/[\[\]]/', '', $dd);
     
@@ -117,6 +118,12 @@ class ogrouptabs extends tabs
       unset($this->by_name['reference']);
       $this->by_name['reference'] = $tmp;
     }
+
+    /* Reset acls */
+    $this->set_acl_base($this->base);
+    foreach($this->by_object as $name => $obj){
+      $this->by_object[$name]->set_acl_category($this->acl_category);
+    }
   }
 
   function execute(){
@@ -133,6 +140,7 @@ class ogrouptabs extends tabs
 
     tabs::tabs($config, $data, $dn, $category);
     $this->base= $this->by_object['ogroup']->base;
+    $this->acl_category = $category;
 
     /* Insert extra tabs for several object types - if present */
 
index 009d9a51fdc08128c49de9a7d815d72fddeaf8e8..b35458c99794f7da2489118d9466f12e37d8294c 100644 (file)
                           <table width="100%">
                                <tr>
                                 <td colspan="2" style='padding-top:5px;'><LABEL for="gotoNtpServerSelected">{t}NTP server{/t}</LABEL><br>
+{render acl=$gotoNtpServerACL}
                                  <select name="gotoNtpServerSelected[]" id="gotoNtpServerSelected" multiple size=5 style="width:100%;"
-                                               title="{t}Choose server to use for synchronizing time{/t}" {$gotoNtpServerACL} {if $inheritTimeServer} disabled {/if}>
+                                               title="{t}Choose server to use for synchronizing time{/t}" {if $inheritTimeServer} disabled {/if}>
                                   {html_options options=$gotoNtpServer_select}
                                  </select>
+{/render}
                                 <br>
-                                 <select name="gotoNtpServers" id="gotoNtpServers" {$gotoNtpServerACL} {if $inheritTimeServer} disabled {/if} >
+{render acl=$gotoNtpServerACL}
+                                 <select name="gotoNtpServers" id="gotoNtpServers" {if $inheritTimeServer} disabled {/if} >
                                   {html_options output=$gotoNtpServers values=$gotoNtpServers}
                                  </select>
-                                       <input type="submit" name="addNtpServer" value="{t}Add{/t}"     id="addNtpServer" {$gotoNtpServerACL}
+{/render}
+{render acl=$gotoNtpServerACL}
+                                       <input type="submit" name="addNtpServer" value="{t}Add{/t}"     id="addNtpServer"
                                         {if ($inheritTimeServer) || (!$gotoNtpServers)} disabled {/if}>
-                                       <input type="submit" name="delNtpServer" value="{t}Delete{/t}"  id="delNtpServer" {$gotoNtpServerACL}
+{/render}
+
+{render acl=$gotoNtpServerACL}
+                                       <input type="submit" name="delNtpServer" value="{t}Delete{/t}"  id="delNtpServer"
                                         {if ($inheritTimeServer) || (!$gotoNtpServer_select)} disabled {/if} >
+{/render}
                                 </td>
                                </tr>
                           </table>
                                <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}
                                  </select>
+{/render}
                                 </td>
                                </tr>
                                <tr><td colspan="2">&nbsp;</td></tr>
                                <tr>
                                 <td><LABEL for="gotoSyslogServer">{t}Syslog server{/t}</LABEL></td>
                                 <td>
-                                 <select id="gotoSyslogServer" name="gotoSyslogServer" title="{t}Choose server to use for logging{/t}" {$gotoSyslogServerACL}>
+{render acl=$gotoSyslogServerACL}
+                                 <select id="gotoSyslogServer" name="gotoSyslogServer" title="{t}Choose server to use for logging{/t}">
                                   {html_options values=$syslogservers output=$syslogservers selected=$gotoSyslogServer_select}
                                  </select>
+{/render}
                                 </td>
                                </tr>
                                </table>
                                <table summary="">
                                 <tr>
                                  <td>
-                                  <select size="1" name="saction" {$actionACL} title="{t}Select action to execute for this terminal{/t}">
+{render acl=$FAIstateACL}
+                                  <select size="1" name="saction" {$FAIstateACL} title="{t}Select action to execute for this terminal{/t}">
                                        <option>&nbsp;</option>
                                        {html_options options=$actions}
                                   </select>
+{/render}
                                  </td>
                                  <td>
+{render acl=$FAIstateACL}
                                   <input type=submit name="action" value="{t}Execute{/t}">
+{/render}
                                  </td>
                                 </tr>
                                </table>