Code

some server updates
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Jan 2007 05:18:05 +0000 (05:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Jan 2007 05:18:05 +0000 (05:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5554 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_glpiAccount.inc
plugins/admin/systems/class_servDNS.inc
plugins/admin/systems/servdns.tpl
plugins/admin/systems/servservice.tpl

index 9ff5019138a6059b2d135fd975a33db5767d911d..329a3bf080eaa36bd6204638c7a5aa63e3701a23 100644 (file)
@@ -192,14 +192,14 @@ class glpiAccount extends plugin
  
     /* Add Device was requested, open new dialog
      */
-    if(isset($_POST['AddDevice'])){
+    if(isset($_POST['AddDevice']) && chkacl($this->acl,"usedDevices") == ""){
       $this->dialog =true;
       $this->cur_dialog = new glpiDeviceManagement($this->config,$this->dn,$this->usedDevices);
     }
 
     /* Attachment pool was closed with use
      */
-    if(isset($_POST['UseAttachment'])){
+    if(isset($_POST['UseAttachment']) && chkacl($this->acl,"usedAttachments") == ""){
       if(count($this->cur_dialog->check())){
         foreach($this->cur_dialog->check() as $msg){
           print_red($msg);
@@ -230,7 +230,7 @@ class glpiAccount extends plugin
      */
     $once = true;
     foreach($_POST as $name => $value){
-      if((preg_match("/^delAttachment_/",$name))&&($once)){
+      if((preg_match("/^delAttachment_/",$name))&&($once) && chkacl($this->acl,"usedAttachments") == ""){
         $once= false;
         $name = preg_replace("/^delAttachment_/","",$name);
         $entry = preg_replace("/_.*$/","",$name);
@@ -239,7 +239,7 @@ class glpiAccount extends plugin
         }
       }
     }
-    if((isset($_POST['RemoveAttachment']))&&(isset($_POST['Attachments']))){
+    if((isset($_POST['RemoveAttachment']))&&(isset($_POST['Attachments'])) && chkacl($this->acl,"usedAttachments") == ""){
       foreach($_POST['Attachments'] as $entry){
         if(isset($this->usedAttachments[$entry])){
           unset($this->usedAttachments[$entry]);
@@ -267,7 +267,7 @@ class glpiAccount extends plugin
 
     /* System type management
      */
-    if(isset($_POST['edit_type'])){
+    if(isset($_POST['edit_type']) && chkacl($this->acl,"type") == ""){
       $this->dialog = true;
       $this->edit_type=true;
     }
@@ -286,7 +286,7 @@ class glpiAccount extends plugin
 
     /* This appends a new system to our sytem types
      */
-    if((isset($_POST['add_type']))&&(!empty($_POST['type_string']))){
+    if((isset($_POST['add_type']))&&(!empty($_POST['type_string'])) && chkacl($this->acl,"type") == ""){
       $attr = $this->handle->getSystemTypes();
       if(in_array(trim($_POST['type_string']),$attr)){
         print_red(_("Adding new sytem type failed, this system type name is already used.")) ;
@@ -297,7 +297,7 @@ class glpiAccount extends plugin
 
     /* Remove selected type from our system types list
      */
-    if((isset($_POST['del_type']))&&(!empty($_POST['select_type']))){
+    if((isset($_POST['del_type']))&&(!empty($_POST['select_type'])) && chkacl($this->acl,"type") == ""){
       $tmp = $this->handle->is_systemTypeUsed($_POST['select_type']);
       if(count($tmp)){
         $names = "";
@@ -328,7 +328,7 @@ class glpiAccount extends plugin
     }
     
   
-    if((isset($_POST['rename_type'])&&(!empty($_POST['select_type'])))||($this->renameTypeDialog)){
+    if((isset($_POST['rename_type'])&&(!empty($_POST['select_type'])))||($this->renameTypeDialog) && chkacl($this->acl,"type") == ""){
       if(isset($_POST['select_type'])){
         $this->select_type = $_POST['select_type'];
       }
@@ -359,7 +359,7 @@ class glpiAccount extends plugin
 
     /* System os management
      */
-    if(isset($_POST['edit_os'])){
+    if(isset($_POST['edit_os']) && chkacl($this->acl,"os") == ""){
       $this->dialog = true;
       $this->edit_os=true;
     }
@@ -373,7 +373,7 @@ class glpiAccount extends plugin
 
     /* Add new os to the db
      */
-    if((isset($_POST['add_os']))&&(!empty($_POST['is_string']))){
+    if((isset($_POST['add_os']))&&(!empty($_POST['is_string'])) && chkacl($this->acl,"os") == ""){
       $attr = $this->handle->getOSTypes();
       if(in_array(trim($_POST['is_string']),$attr)){
         print_red(_("Adding new operating system failed, specifed name is already used.")) ;
@@ -384,7 +384,7 @@ class glpiAccount extends plugin
 
     /* Delete selected os from list and db
      */
-    if((isset($_POST['del_os']))&&(!empty($_POST['select_os']))){
+    if((isset($_POST['del_os']))&&(!empty($_POST['select_os'])) && chkacl($this->acl,"os") == ""){
       $tmp = $this->handle->is_osUsed($_POST['select_os']);
   
       if(count($tmp)){
@@ -416,7 +416,7 @@ class glpiAccount extends plugin
         $this->renameOSDialog = false;
       }
     }
-    if((isset($_POST['rename_os'])&&(!empty($_POST['select_os'])))||($this->renameOSDialog)){
+    if((isset($_POST['rename_os'])&&(!empty($_POST['select_os'])))||($this->renameOSDialog) && chkacl($this->acl,"os") == ""){
       if(isset($_POST['select_os'])){
         $this->select_type = $_POST['select_os'];
       }
@@ -434,7 +434,7 @@ class glpiAccount extends plugin
 
     /* Open dialog to edit os types 
      */
-    if($this->edit_os){
+    if($this->edit_os && chkacl($this->acl,"os") == ""){
       $smarty->assign("Method","edit");
       $smarty->assign("OSs",            $this->handle->getOSTypes());
       $smarty->assign("OSKeys",         array_flip($this->handle->getOSTypes()));
@@ -447,14 +447,14 @@ class glpiAccount extends plugin
     /* Show dialog to select a new contact person
      * Select a contact person
      */
-    if(isset($_POST['SelectContactPerson'])){
+    if(isset($_POST['SelectContactPerson']) && chkacl($this->acl,"user_tech_num") == ""){
       $this->addUser = "contact";
       $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
     }
 
     /* Open dialog which allows to edit the manufacturers
      */
-    if(isset($_POST['edit_manufacturer'])){
+    if(isset($_POST['edit_manufacturer']) && chkacl($this->acl,"user_tech_num") == ""){
       $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
       $this->dialog = true;
     }
@@ -477,13 +477,13 @@ class glpiAccount extends plugin
 
     /* Selecte technical responsible person
      */
-    if(isset($_POST['SelectTechPerson'])){
+    if(isset($_POST['SelectTechPerson']) && chkacl($this->acl,"user_tech_num") == ""){
       $this->addUser ="tech";
       $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
     }
 
     /* Technical responsible person selected*/
-    if(isset($_GET['act'])&&($_GET['act']=="user_tech_num")){
+    if(isset($_GET['act'])&&($_GET['act']=="user_tech_num") && chkacl($this->acl,"user_tech_num") == ""){
 
       /* Get posted id */
       $id = base64_decode($_GET['id']);
@@ -556,8 +556,17 @@ class glpiAccount extends plugin
     }
 
     /* Do we need to flip is_account state? */
+    
     if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
+
+      /* Only change account state if allowed */
+      if($this->is_account && $this->acl == "#all#"){
+        $this->is_account= !$this->is_account;
+        $this->is_modified = true;
+      }elseif(!$this->is_account && chkacl($this->acl,"create") == "" ){
+        $this->is_account= !$this->is_account;
+        $this->is_modified = true;
+      }
     }
 
     /* Show tab dialog headers */
@@ -691,11 +700,6 @@ class glpiAccount extends plugin
       return ;
     }
     plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = stripslashes ($_POST[$attrs]);
-      }
-    }
   }
 
 
index c109d44a6fa2d4fbf5d92be5a5ce1a1c69f74223..2a27325ddfbe8db08f79cd97a098851fa0d94549 100644 (file)
@@ -60,7 +60,15 @@ class servdns extends plugin
     /* Do we need to flip is_account state? 
      */
     if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
+
+      /* Only change account state if allowed */
+      if($this->is_account && $this->acl == "#all#"){
+        $this->is_account= !$this->is_account;
+        $this->is_modified = true;
+      }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
+        $this->is_account= !$this->is_account;
+        $this->is_modified = true;
+      }
     }
 
     if ($this->is_account){
@@ -104,7 +112,7 @@ class servdns extends plugin
 
     /* Add empty new zone 
      */
-    if(isset($_POST['AddZone'])){
+    if(isset($_POST['AddZone']) && chkacl($this->acl,"servdns") == ""){
       $this->dialog = new servdnseditZone($this->config,$this->dn);
     }
 
@@ -115,7 +123,7 @@ class servdns extends plugin
   
       /* check all post for edit request 
        */
-      if(preg_match("/^editZone_/",$name)&&!$once){
+      if(preg_match("/^editZone_/",$name)&&!$once && chkacl($this->acl,"servdns") == ""){
         $once =true;
         $tmp = preg_replace("/^editZone_/","",$name);
         $tmp = base64_decode(preg_replace("/_.*$/","",$tmp));
@@ -124,7 +132,7 @@ class servdns extends plugin
 
       /* check posts for delete zone 
        */
-      if(preg_match("/^delZone_/",$name)&&!$once){
+      if(preg_match("/^delZone_/",$name)&&!$once && chkacl($this->acl,"servdns") == ""){
 
         $once =true;
         $tmp = preg_replace("/^delZone_/","",$name);
@@ -162,7 +170,9 @@ class servdns extends plugin
             array("string" =>str_replace("%s",base64_encode($zone),$editImg))
             ));
     }    
-
+  
+    $smarty->assign("servdnsACL",chkacl($this->acl,"servdns"));
+  
     /* Display tempalte 
      */
     $smarty->assign("ZoneList",$ZoneList->DrawList());
index ba53940884ad9bea5ff698678f0acbfe23ca6023..7cd08b7d945285fcd47264cd33c4aaa50d54a4fb 100644 (file)
@@ -3,9 +3,9 @@
 <tr>
        <td style="width:100%;vertical-align:top;">
                {$ZoneList}
-               <input type="submit" name="AddZone" value="{t}Add{/t}">
-               <input type="submit" name="EditZone" value="{t}Edit{/t}">
-               <input type="submit" name="RemoveZone" value="{t}Remove{/t}">
+               <input type="submit" name="AddZone" value="{t}Add{/t}" {$servdnsACL}>
+               <input type="submit" name="EditZone" value="{t}Edit{/t}" {$servdnsACL}>
+               <input type="submit" name="RemoveZone" value="{t}Remove{/t}" {$servdnsACL}>
        </td>
 </tr>
 </table>
index a457f171ecba644628fb9df20e076c61db0b8f9c..d8540b7660304a6d5633f688315fb263ded6c500 100644 (file)
@@ -2,7 +2,7 @@
  <tr>
   <td style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;" width="50%">
 
-   <input type=checkbox name="goShareServer" value="1" {$goShareServer} {$goExportEntryACL} 
+   <input type=checkbox name="goShareServer" value="1" {$goShareServer}  
        onchange="changeState('goExportEntry');
                        changeState('NewNfsEditId');
                        changeState('DelNfsEntId');
@@ -12,7 +12,7 @@
    <table summary="" style="width:100%">
     <tr>
      <td>
-               <select style="width:100%" id="goExportEntry" name="goExportEntryList[]" {$goExportEntryACL} {$goShareServerState} size=12 multiple >
+               <select style="width:100%" id="goExportEntry" name="goExportEntryList[]" {$goShareServerState} size=12 multiple >
                {html_options values=$goExportEntry output=$goExportEntryKeys}
                        <option disabled>&nbsp;</option>
            </select>