Code

Completed conference acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Oct 2006 07:59:00 +0000 (07:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Oct 2006 07:59:00 +0000 (07:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4945 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/conference/class_divListConferences.inc
plugins/gofon/conference/class_phoneConferenceGeneric.inc
plugins/gofon/conference/class_phoneConferenceManagment.inc

index 9e0389ea9170171602f2e3dccc4e6017f3129c42..339d561aed4d4f6fd36f4cf4fdd5f1670e7da021 100755 (executable)
@@ -67,14 +67,30 @@ class divListConference extends MultiSelectWindow
        which are shown in the listbox on top of the listbox
      */
     $options= "";
-    foreach ($this->config->idepartments as $key => $value){
-      if ($this->selectedBase == $key){
-        $options.= "<option selected='selected' value='$key'>$value</option>";
-      } else {
-        $options.= "<option value='$key'>$value</option>";
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+    $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("gofon");
+    $ids = $this->config->idepartments;
+
+    foreach($deps as $dep){
+      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+        $value = $ids[$dep['dn']];
+        if ($this->selectedBase == $dep['dn']){
+          $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep['dn']."'>$value</option>";
+        }
       }
     }
 
+    $acls = $ui->get_permissions($this->selectedBase,"gofon/conference");
+
     /* NEW LIST MANAGMENT */
     $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
       " <input class='center' type='image' src='images/list_root.png' align='middle' 
@@ -84,12 +100,22 @@ class divListConference extends MultiSelectWindow
       " <input class='center' type='image' align='middle' src='images/list_home.png' 
       title='"._("Go to users department")."' alt='"._("Home")."'            name='dep_home'>&nbsp;".
       " <input class='center' type='image' src='images/list_reload.png' align='middle' 
-      title='"._("Reload list")."' name='submit_department' alt='".        _("Submit")."'>&nbsp;".
-      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-      " <input class='center' type='image' align='middle' src='images/list_new_conference.png' 
-      title='"._("Create new conference")."' alt='"._("New conference")."' name='user_new'>&nbsp;".
-      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
-    $listhead .= $this->get_snapshot_header($this->selectedBase);
+      title='"._("Reload list")."' name='submit_department' alt='".        _("Submit")."'>&nbsp;";
+
+    /* Only display create new conference if we are allowed to create new confe... */
+    if(preg_match("/c/",$acls)){
+      $listhead .=" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+        " <input class='center' type='image' align='middle' src='images/list_new_conference.png' 
+        title='"._("Create new conference")."' alt='"._("New conference")."' name='user_new'>&nbsp;".
+        " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+
+    /* Only display snapshot settings if we are able to write && create new entries */
+    if(preg_match("/[cw]/",$acls)){
+      $listhead .= $this->get_snapshot_header($this->selectedBase);
+    }
+  
+    /* Add the rest (base select ....)*/
     $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle' 
       title='"._("Submit department")."' name='submit_department' alt='".  _("Submit").     "'>&nbsp;".
index fc444e5cabdc87138c41ae0ce7fc27711c3795ef..ef9f91ca14a980d0cd17fc75594c6b45c9f966f6 100644 (file)
@@ -138,7 +138,7 @@ class conference extends plugin
 
     $once = true; 
     foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
+      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
         $once = false;
         $this->dialog = new baseSelectDialog($this->config,$this);
         $this->dialog->setCurrentBase($this->base);
@@ -202,14 +202,23 @@ class conference extends plugin
   /* Save data to object */
   function save_object()
   {
-    plugin::save_object();
     if(isset($_POST['cn'])){
+
+      plugin::save_object();
+
       foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
-            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D","goFonPIN") as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }else{
-          $this->$attrs = false;
+            "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
+
+        /* Acl can't contain _ so we remove it here. */
+        $acl_name = preg_replace("/_/","",$attrs);
+
+        /* Attribute writeable ? */
+        if($this->acl_is_writeable($acl_name)){
+          if(isset($_POST[$attrs])){
+            $this->$attrs = $_POST[$attrs];
+          }else{
+            $this->$attrs = false;
+          }
         }
       }
     }
index 5f55d2aaecceac6270284a7b55e0a63f6ad4dcee..58ee81d325736e4ec41aac9d2da98c76b6572ae2 100644 (file)
@@ -118,17 +118,21 @@ class phoneConferenceManagment extends plugin
      * The entry which will be deleted is defined in $s_entry
      */
     if ($s_action =="del"){
-      $this->dn= $this->conferences[$s_entry]['dn'];
 
-      /* Check locking */
-      if (($conf= get_lock($this->dn)) != ""){
-        $_SESSION['dn']= $this->dn;
-        return(gen_locked_message($conf, $this->dn));
-      } else {
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn));
-        $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
-        return ($display);
+      $acl = $this->ui->get_permissions($this->conferences[$s_entry]['dn'],"gofon/conference"); 
+      if(preg_match("/d/",$acl)){
+        $this->dn= $this->conferences[$s_entry]['dn'];
+
+        /* Check locking */
+        if (($conf= get_lock($this->dn)) != ""){
+          $_SESSION['dn']= $this->dn;
+          return(gen_locked_message($conf, $this->dn));
+        } else {
+          add_lock ($this->dn, $this->ui->dn);
+          $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn));
+          $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
+          return ($display);
+        }
       }
     }
 
@@ -140,9 +144,8 @@ class phoneConferenceManagment extends plugin
     /* If department deletion is accepted ...
      * Finally delete department
      */
-    $acl = $this->ui->get_permissions($this->dn,"gofon/conference"); 
     if (isset($_POST['delete_department_confirm'])){
-      echo "What the hell is going on here ? Huh ?!!";
+      $acl = $this->ui->get_permissions($this->dn,"gofon/conference"); 
       if(preg_match("/d/",$acl)){
         $this->remove_from_parent();
         gosa_log ("Department object'".$this->dn."' has been removed");
@@ -183,12 +186,16 @@ class phoneConferenceManagment extends plugin
   
     /* Insert new entry*/    
     if($s_action == "new" ){
-      
-      /* Set up the users ACL's for this 'dn' */
-      $this->dn= "new";
-      $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofon");
-      $this->conftab->set_acl_base("cn=dummy,ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase);
-      unset($_SESSION['objectinfo']);
+
+      $dummy_dn = "cn=dummy,ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->DivListConference->selectedBase;      
+      $acl = $this->ui->get_permissions($dummy_dn,"gofon/conference"); 
+      if(preg_match("/c/",$acl)){
+        /* Set up the users ACL's for this 'dn' */
+        $this->dn= "new";
+        $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn,"gofon");
+        $this->conftab->set_acl_base($dummy_dn);
+        unset($_SESSION['objectinfo']);
+      }
     }