Code

Some acl changes made for phone objects
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Sep 2006 08:18:27 +0000 (08:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Sep 2006 08:18:27 +0000 (08:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4832 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_phoneGeneric.inc
plugins/admin/systems/phone.tpl
plugins/admin/systems/phonesettings.tpl

index 2a98149b2c37c476b98104ca4a20dc6d2f196861..f35a0ca0336e6de465be9bfd4564b1377171ae9f 100644 (file)
@@ -192,7 +192,20 @@ class phoneGeneric extends plugin
   
     /* Fill templating stuff */
     $smarty= get_smarty();
-    $smarty->assign("bases", $this->config->idepartments);
+
+     /* Assign base ACL */
+    $baseACL = $this->getacl("base");
+    if(!$this->acl_is_moveable()) {
+      $baseACL = preg_replace("/w/","",$baseACL);
+    }
+    $smarty->assign("baseACL",          $baseACL);
+    $smarty->assign("bases", $this->get_allowed_bases());
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
     $smarty->assign("staticAddress","<font class=\"must\">*</font>");// $this->config->idepartments);
 
     /* Create Arrays for samrty select boxes */
@@ -204,7 +217,7 @@ class phoneGeneric extends plugin
 
     /* deativate all fields that are not used by the specified type */
     foreach($this->attributes as $att){
-      if((!in_array($att,$this->usedattrs[$this->selected_categorie]))||(chkacl($this->acl,$att)!="")){
+      if((!in_array($att,$this->usedattrs[$this->selected_categorie]))){
         $smarty->assign($att."USED", "disabled" );
         $smarty->assign($att, "");
       }else{
@@ -216,11 +229,9 @@ class phoneGeneric extends plugin
     $smarty->assign("selected_categorie",$this->selected_categorie);
 
     /* Assign attributes */
-    foreach ($this->attributes as $attr){
-      $smarty->assign($attr."ACL", chkacl($this->acl, $attr));
-    }
+    
+
     $smarty->assign("base_select", $this->base);
-    $smarty->assign("baseACL", chkacl($this->acl,"base"));
    
     $smarty->assign("goFonDefaultIPs",array("dynamic"=>_("dynamic"),"network"=>_("Networksettings")));
  
@@ -264,7 +275,7 @@ class phoneGeneric extends plugin
     plugin::save_object();
     $this->netConfigDNS->save_object();
     /* Save base, since this is no LDAP attribute */
-    if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){
+    if (isset($_POST['base']) && $this->acl_is_moveable()){
       $this->base= $_POST['base'];
     }
   }
@@ -288,17 +299,15 @@ class phoneGeneric extends plugin
       }
     }
 
-    if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
+    if ($this->cn == ""){
       $message[]= _("The required field 'Phone name' is not set.");
     }
-    if ($this->cn == "0" && chkacl ($this->acl, "cn") == ""){
+    if ($this->cn == "0"){ 
       $message[]= _("The 'Phone name' '0' is reserved and cannot be used.");
     }
 
     $ui= get_userinfo();
-    $acl= get_permissions ($this->dn, $ui->subtreeACL);
-    $acl= get_module_permission($acl, "phone", $this->dn);
-    if (chkacl($acl, "create") != ""){
+    if ($this->dn == "new" && $this->acl_is_createable()){
       $message[]= _("You have no permissions to create a phone on this 'Base'.");
     }
 
@@ -336,11 +345,6 @@ class phoneGeneric extends plugin
       if(!in_array($att,$this->usedattrs[$mode])){
         $this->attrs[$att] = array();
       }
-    
-      /* Test rights of this user ... */
-      if(chkacl($this->acl,$att)!=""){
-        unset($this->attrs[$att]);
-      }
     }
 
     /* unset the categorie*/
@@ -417,11 +421,18 @@ class phoneGeneric extends plugin
           "plProvidedAcls"=> array(
             "cn"                  => _("Name"),
             "description"         => _("Description"),
-            "goFonType"           => _("Mode"),
-            "goFonDmtfMode"       => _("DTMF mode"),
-            "goFonDefaultIP"      => _("Default ip"),
-            "goFonQualify"        => _("Qualify"),
-            "selected_categorie"  => _("Hardware type"))
+            "goFonType"           => _("SIP Mode"),
+            "goFonDmtfMode"       => _("SIP DTMF mode"),
+            "goFonDefaultIP"      => _("SIP Default ip"),
+            "goFonQualify"        => _("SIP Qualify"),
+            "goFonAuth"           => _("IAX authentication type"),
+            "goFonSecret"         => _("IAX secret"),
+            "goFonAccountCode"    => _("IAX account code"),
+            "goFonTrunk"          => _("IAX trunk lines"),
+            "goFonPermit"         => _("IAX permit settings"),
+            "goFonDeny"           => _("IAX deny settings"),
+            "goFonMSN"            => _("CAPI MSN"),
+            "categorie"  => _("Hardware type"))
           ));
   }
 
index d8172cf63b1e2a56f0c792ee5f6aacd1905d19f7..a7e652cea442a4928b20ed6edfd3d6d1af6a6ee2 100644 (file)
@@ -4,7 +4,11 @@
        <table summary="">
         <tr>
          <td><LABEL for="cn">{t}Phone name{/t}</LABEL>{$must}</td>
-         <td><input id="cn" name="cn" size=20 maxlength=60 value="{$cn}"></td>
+         <td>
+{render acl=$cnACL}
+          <input id="cn" name="cn" size=20 maxlength=60 value="{$cn}">
+{/render}
+         </td>
         </tr>
         <tr>
           <td colspan=2>&nbsp;</td>
         <tr>
          <td><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
          <td>
-          <select size="1" id="base" name="base" title="{t}Choose subtree to place terminal in{/t}" {$baseACL}>
-           {html_options options=$bases selected=$base_select}
-          </select>
-               {if $baseACL == ""}
-            <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-        {else}
-            <img src="images/folder_gray.png" class="center" title="{t}Select a base{/t}">
-        {/if}
-               </td>
+{render acl=$baseACL}
+      <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
+       {html_options options=$bases selected=$base_select}
+      </select>
+{/render}
+{render acl=$baseACL disable_picture='images/folder_gray.png'}
+        <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+          </td>
          </tr>
        </table>
   </td>
        <table summary="">
         <tr>
          <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-         <td><input name="description" id="description" size=25 maxlength=80 value="{$description}"></td>
+         <td>
+{render acl=$descriptionACL}
+          <input name="description" id="description" size=25 maxlength=80 value="{$description}">
+{/render}
+          </td>
         </tr>
        </table>
   </td>
index 2f1b9ced9752ffb576069bac8545d2f281c415cb..19385ac8681872fab75f1f2029b86637ce01e60c 100644 (file)
@@ -4,9 +4,11 @@
        <tr>
                <td colspan="2">
                <LABEL for="selected_categorie">{t}Phone type{/t}</LABEL>{$staticAddress}
+{render acl=$categorieACL}
                <select id="selected_categorie" size="1" name="selected_categorie" title="{t}Choose a phone type{/t}" onchange="mainform.submit();">
                        {html_options options=$categories selected=$selected_categorie}
                </select>
+{/render}
                {if $javascript eq 'false'}
                        <input type="submit" value="{t}refresh{/t}" name="refresh">
                {/if}
                                        
                                </td>
                                <td>
+{render acl=$goFonTypeACL}
                                        <select id="goFonType" size="1" name="goFonType" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTypeUSED}>
                                                {html_options options=$goFonTypes selected=$goFonType}
                                        </select>
+{/render}
                                </td>
                         </tr>
                         <tr>
                                        <LABEL for="goFonDmtfMode">{t}DTMF mode{/t}</LABEL>
                                </td>
                                <td>
+{render acl=$goFonDmtfModeACL}
                                        <select size="1" id="goFonDmtfMode" name="goFonDmtfMode" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonDmtfModeUSED}>
                                                {html_options options=$goFonDmtfModes selected=$goFonDmtfMode}
                                        </select>
+{/render}
                                </td>
                        </tr>
                </table>
                                        <LABEL for="goFonDefaultIP">{t}Default IP{/t}</LABEL>
                                </td>
                 <td>
+{render acl=$goFonDefaultIPACL}
                     <select id="goFonDefaultIP" size="1" name="goFonDefaultIP" title="{t}Choose a phone type{/t}" style="width:200px;" >
                         {html_options options=$goFonDefaultIPs selected=$goFonDefaultIP}
                     </select>
+{/render}
                    </td>
                        </tr>
                        <tr>
@@ -58,7 +66,9 @@
                                        <LABEL for="goFonQualify">{t}Response timeout{/t}</LABEL>
                                </td>
                                <td>
+{render acl=$goFonQualifyACL}
                                        <input id="goFonQualify" style="width:200px" name="goFonQualify" value="{$goFonQualify}" {$goFonQualifyUSED}>
+{/render}
                                </td>
                        </tr>
                        </table>
                                        <LABEL for="goFonType">{t}Modus{/t}{$staticAddress}</LABEL>
                                </td>
                                <td >
+{render acl=$goFonTypeACL}
                                        <select size="1" id="goFonType" name="goFonType" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonTypeUSED}>
                                                {html_options options=$goFonTypes selected=$goFonType}
                                        </select>
+{/render}
                                </td>
                         </tr>
                        <tr>
@@ -87,7 +99,9 @@
                                        <LABEL for="goFonDefaultIP">{t}Default IP{/t}</LABEL>
                                </td>
                                <td>
+{render acl=$goFonDefaultIPACL}
                                        <input id="goFonDefaultIP" style="width:200px" name="goFonDefaultIP" value="{$goFonDefaultIP}" {$goFonDefaultIPUSED}>
+{/render}
                                </td>
                        </tr>
                        <tr>
                                        <LABEL for="goFonQualify">{t}Response timeout{/t}</LABEL>
                                </td>
                                <td>
+{render acl=$goFonQualifyACL}
                                        <input id="goFonQualify" style="width:200px" name="goFonQualify" value="{$goFonQualify}" {$goFonQualifyUSED}>
+{/render}
                                </td>
                        </tr>
                        <tr>
                                        <LABEL for="goFonAuth">{t}Authtype{/t}</LABEL>
                                </td>
                                <td>
+{render acl=$goFonAuthACL}
                                        <select size="1" id="goFonAuth" name="goFonAuth" title="{t}Choose a phone type{/t}" style="width:200px;" {$goFonAuthUSED}>
                                                {html_options options=$goFonAuths selected=$goFonAuth}
                                        </select>
+{/render}
                                </td>
                        </tr>
                        <tr>
                                         <LABEL for="goFonSecret">{t}Secret{/t}</LABEL>
                                </td>
                                <td>
+{render acl=$goFonSecretACL}
                                        <input id="goFonSecret" style="width:200px" name="goFonSecret" value="{$goFonSecret}" {$goFonSecretUSED}>
+{/render}
                                </td>
                        </tr>
 <!--                   <tr>
                     <LABEL for="goFonAccountCode">{t}Account code{/t}</LABEL>
                 </td>
                 <td>
+{render acl=$goFonAccountCodeACL}
                     <input id="goFonAccountCode" style="width:200px" name="goFonAccountCode" value="{$goFonAccountCode}" {$goFonAccountCodeUSED}>
+{/render}
                 </td>
             </tr>
             <tr>
                     <LABEL for="goFonTrunk">{t}Trunk lines{/t}</LABEL>
                 </td>
                 <td>
+{render acl=$goFonTrunkACL}
                      <select size="1" id="goFonTrunk" name="goFonTrunk" title="{t}Choose a phone type{/t}" {$goFonTrunkUSED}>
                         {html_options options=$goFonTrunks selected=$goFonTrunk}
                      </select>
+{/render}
                  </td>
             </tr>
 
                <tr>
                     <td style="vertical-align:top;">
                         <LABEL for="goFonPermitS">{t}Hosts that are allowed to connect{/t}</LABEL><br>
+{render acl=$goFonPermitACL}
                         <select id="goFonPermitS" style="width:100%; height:80px;" name="goFonPermitS" size=15
                             multiple title="{t}List of alternative mail addresses{/t}">
                             {html_options values=$goFonPermit output=$goFonPermit}
                             <option disabled>&nbsp;</option>
                         </select>
+{/render}
                         <br>
+{render acl=$goFonPermitACL}
                             <input name="goFonPermitNew" size=30 align="middle" maxlength="65" value="">
+{/render}
+{render acl=$goFonPermitACL}
                         <input type=submit value="{t}Add{/t}" name="goFonPermitAdd">
+{/render}
+{render acl=$goFonPermitACL}
                         <input type=submit value="{t}Delete{/t}" name="goFonPermitDel">
+{/render}
                                                <br><br>
                     </td>
                 </tr>
                                <tr>
                     <td style="vertical-align:top;">
                        <LABEL for="goFonDenyS">{t}Hosts that are not allowed to connect{/t}</LABEL><br>
+{render acl=$goFonDenyACL}
                         <select id="goFonDenyS" style="width:100%; height:80px;" name="goFonDenyS" size=15
                             multiple title="{t}List of alternative mail addresses{/t}">
                             {html_options values=$goFonDeny output=$goFonDeny}
                             <option disabled>&nbsp;</option>
                         </select>
+{/render}
                         <br>
+{render acl=$goFonDenyACL}
                             <input name="goFonDenyNew" size=30 align="middle" maxlength="65" value="">
+{/render}
+{render acl=$goFonDenyACL}
                         <input type=submit value="{t}Add{/t}" name="goFonDenyAdd">
+{/render}
+{render acl=$goFonDenyACL}
                         <input type=submit value="{t}Delete{/t}" name="goFonDenyDel">
+{/render}
                     </td>
                 </table>
     </tr>
                                <tr>
                                        <td>
                                                <LABEL for="goFonMSN">{t}MSN{/t}</LABEL>&nbsp;
+{render acl=$goFonMSNACL}
                                                <input id="goFonMSN" style="width:200px" name="goFonMSN" value="{$goFonMSN}" {$goFonMSNUSED}>
+{/render}
                                        </td>
                                </tr>
                        </table>