Changeset 6768

Show
Ignore:
Timestamp:
09/17/08 23:08:54 (5 years ago)
Author:
p_lindheimer
Message:

closes #3211 allow restricting user access to not add new extensions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/core/functions.inc.php

    r6730 r6768  
    45954595  } elseif ( $extdisplay == '' && $tech_hardware == '' ) { // Adding 
    45964596 
    4597     if ( $display != 'extensions') { 
    4598       $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add Device")), 0); 
     4597    if ($_SESSION["AMP_user"]->checkSection('999')) { 
     4598      if ( $display != 'extensions') { 
     4599        $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add Device")), 0); 
     4600      } else { 
     4601        $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add an Extension")), 0); 
     4602      } 
     4603      $currentcomponent->addguielem('_top', new gui_label('instructions', _("Please select your Device below then click Submit"))); 
     4604      $currentcomponent->addguielem('Device', new gui_selectbox('tech_hardware', $currentcomponent->getoptlist('devicelist'), '', _("Device"), '', false)); 
    45994605    } else { 
    4600       $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add an Extension")), 0); 
    4601     } 
    4602     $currentcomponent->addguielem('_top', new gui_label('instructions', _("Please select your Device below then click Submit"))); 
    4603     $currentcomponent->addguielem('Device', new gui_selectbox('tech_hardware', $currentcomponent->getoptlist('devicelist'), '', _("Device"), '', false)); 
     4606      if ( $display != 'extensions') { 
     4607        $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Edit existing Device")), 0); 
     4608      } else { 
     4609        $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Edit existing Extension")), 0); 
     4610      } 
     4611    } 
    46044612 
    46054613  } else { 
     
    46374645        $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add").' '.strtoupper($deviceInfo['tech']).' '._("Extension")), 0); 
    46384646      } 
    4639  
    46404647    } 
    46414648 
     
    47284735    case "add": 
    47294736    // really bad hack - but if core_users_add fails, want to stop core_devices_add 
    4730     if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) { 
     4737 
     4738    if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true || !$_SESSION["AMP_user"]->checkSection('999')) { 
    47314739      if (core_devices_add($deviceid,$tech,$devinfo_dial,$devicetype,$deviceuser,$description,$emergency_cid)) { 
    47324740        needreload(); 
     
    47354743        } 
    47364744      } 
    4737     } 
     4745    } else { 
     4746      // This is a bit messy, because by this time, other modules may have added the device but this tries to block 
     4747      // the user who does not have add permission from adding a new extension. 
     4748      // 
     4749      $GLOBALS['abort'] = true; 
     4750    }  
    47384751    break; 
    47394752    case "del": 
  • modules/branches/2.5/core/page.ampusers.php

    r5953 r6768  
    229229        echo ">"._("Apply Changes Bar")."</option>\n"; 
    230230 
     231        // Apply Changes Bar 
     232        echo "<option value=\"999\""; 
     233        if (in_array("999", $sections)) echo " SELECTED"; 
     234        echo ">".(($amp_conf['AMPEXTENSIONS'] == 'deviceanduser')?_("Add Device"):_("Add Extension"))."</option>\n"; 
     235 
    231236        // All Sections 
    232237        echo "<option value=\"*\""; 
  • modules/branches/2.5/core/page.devices.php

    r2617 r6768  
    1616<?php  
    1717$devices = core_devices_list(); 
    18 drawListMenu($devices, $skip, $type, $display, $extdisplay, _("Device")); 
     18$description = $_SESSION["AMP_user"]->checkSection('999') ? _("Device") : false; 
     19drawListMenu($devices, $skip, $type, $display, $extdisplay, $description); 
    1920?> 
    2021</div> 
  • modules/branches/2.5/core/page.extensions.php

    r2842 r6768  
    1616<?php  
    1717$extens = core_users_list(); 
    18 drawListMenu($extens, $skip, $type, $display, $extdisplay, _("Extension")); 
     18$description = $_SESSION["AMP_user"]->checkSection('999') ? _("Extension") : false; 
     19drawListMenu($devices, $skip, $type, $display, $extdisplay, $description); 
    1920?> 
    2021  <br />