Code

Updated phoneAccount
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Jun 2008 06:21:25 +0000 (06:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 26 Jun 2008 06:21:25 +0000 (06:21 +0000)
-Ensure that we don't edit an entry twice, be reloading the browser.
-Keep the currently selected macro selected, also if we have no acls to read the currently selected macro.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11445 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc
gosa-plugins/gofon/gofon/phoneaccount/main.inc

index 548bc34ad7f420cc61ee2e2b0f67361f646c909c..111bfc8a82aba6798515bf582f5ee05ed7de7056 100644 (file)
@@ -159,7 +159,7 @@ class phoneAccount extends plugin
      * Search for all available phone hardware  
      */
     $tmp = get_sub_list("(objectClass=goFonHardware)","phone",array(get_ou("phoneou")),
-                  $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
+                  $this->config->current['BASE'],array("cn","description"), GL_SUBSEARCH);
     foreach($tmp as $attrs){
       $cn= $attrs['cn'][0];
       $description= "";
@@ -186,7 +186,7 @@ class phoneAccount extends plugin
         get_ou("phoneou"));
 
     $tmp = get_sub_list("(goFonHardware=*)","phone",$deps_a,$this->config->current['BASE'],
-        array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
+        array('cn','dn','goFonHardware'),GL_SUBSEARCH);
     foreach($tmp as $attrs){
       $cn = $attrs['goFonHardware'][0];
       if(isset($this->hardware_list[$cn])){
@@ -200,7 +200,7 @@ class phoneAccount extends plugin
      *  an array with name and parameters 
      */
     $tmp = get_sub_list("(&(objectClass=goFonMacro)(goFonMacroVisible=1))","gofonmacro",array(get_ou("macroou")),
-                  $this->config->current['BASE'],array("displayName","goFonMacroParameter","dn","cn"), GL_NONE);
+                  $this->config->current['BASE'],array("displayName","goFonMacroParameter","dn","cn"), GL_NO_ACL_CHECK | GL_SUBSEARCH );
     
 
     /* Add none for no macro*/
@@ -210,6 +210,16 @@ class phoneAccount extends plugin
     /* Fetch all Macros*/
     foreach($tmp as $attrs){
 
+      $ui = get_userinfo(); 
+      $acl = $ui->get_permissions($attrs['dn'],"gofonmacro/macro","");
+
+      /* Skip all macros we are not able to read 
+          execpt, the currently selected macro.
+       */
+      if(!preg_match("/r/",$acl) && !preg_match("/^".normalizePreg($attrs['dn'])."/",$this->goFonMacro)){
+        continue;
+      }
+
       /* unset Count, we don't need that here */
       unset($attrs['displayName']['count']);
 
index 04318a13af42de2046f4c46b78e32b08bf3bc2cc..179b22af8dc36d43b71c7cfa7bc31c12ddba0102 100644 (file)
@@ -45,7 +45,7 @@ if (!$remove_lock){
        }
 
        /* Enter edit mode? */
-       if (isset($_POST['edit'])){
+       if (isset($_POST['edit']) && !session::is_set('edit')){
 
                /* Check locking */
                if (($username= get_lock($ui->dn)) != ""){