Code

Added branches container for old stuff
[gosa.git] / gosa-plugins / gofon / gofon / phoneaccount / class_phoneAccount.inc
index 548bc34ad7f420cc61ee2e2b0f67361f646c909c..cdde338d23707dc1633d2ef41693645db15bd4ef 100644 (file)
@@ -3,8 +3,9 @@
 class phoneAccount extends plugin
 {
   /* Definitions */
-  var $plHeadline= "Phone";
+  var $plHeadline   = "Phone";
   var $plDescription= "This does something";
+  var $plIcon       = "plugins/gofon/images/phoneAccount.png";
 
   /* Attributes */
   var $telephoneNumber        = array();
@@ -159,7 +160,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 +187,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 +201,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 +211,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']);
 
@@ -396,8 +407,6 @@ class phoneAccount extends plugin
 
     $i_is_accounted = false;  // Ensure that extension entry, for name to number is only once in table
 
-    restore_error_handler();
-
     /* Prepare some basic attributes */
     $oldnums = array();
     foreach($this->a_old_telenums as $tele){
@@ -1600,9 +1609,9 @@ class phoneAccount extends plugin
 
           "plProvidedAcls"  => array(
             "telephoneNumber"     => _("Telephone number"),
-            "goFonHomeServer"     => _("Home server"),
             "goFonMacro"          => _("Macro settings"),
             "goFonHardware"       => _("Phone hardware"),
+            "goFonHomeServer"     => _("Home server"),
             "goFonContext"          => _("Phone context"),
             "goFonVoiceMailContext" => _("Voice mail context"),
             "goFonPIN"            => _("Telephone pin"),