zimbraSingle.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <?php
  2. /**
  3. * WHMCS Zimbra Provisioning Module
  4. *
  5. * Provisioning for private mailboxes on a Zimbra Server
  6. *
  7. * @see https://www.zimbra.com
  8. * @copyright Copyright (c) Thurdata GmbH 2020
  9. * @license GPL
  10. */
  11. if (!defined('WHMCS')) {
  12. die('This file cannot be accessed directly');
  13. }
  14. use WHMCS\Database\Capsule;
  15. /**
  16. * Requires this PHP api to make soap calls and parse responses
  17. * This is an extend version of:
  18. * @see https://github.com/alloylab/zimbra-admin-api-soap-php
  19. */
  20. require_once('api/Zm/Auth.php');
  21. require_once('api/Zm/Account.php');
  22. require_once('api/Zm/Domain.php');
  23. require_once('api/Zm/Server.php');
  24. /**
  25. * Helper function to find values of a named key in a multidimensional arrays or objects
  26. *
  27. * @param array $haystack mixed data
  28. * @param string $needle key to search for values
  29. * @return array of values
  30. */
  31. function recursiveFindAll($haystack, $needle)
  32. {
  33. $values = array();
  34. $iterator = new RecursiveArrayIterator((array)$haystack);
  35. $recursive = new RecursiveIteratorIterator(
  36. $iterator,
  37. RecursiveIteratorIterator::SELF_FIRST
  38. );
  39. foreach ($recursive as $key => $value) {
  40. if ($key === $needle) {
  41. array_push($values, $value);
  42. }
  43. }
  44. return $values;
  45. }
  46. function zimbraSingleUpdateUsage ($api, $service) {
  47. $accountQuota = $api->getQuota($service['username']);
  48. if(is_a($accountQuota, 'Exception')) {
  49. logModuleCall(
  50. 'zimbrasingle',
  51. __FUNCTION__,
  52. $service,
  53. 'Error : could not find quota for ' . $service['username'],
  54. $accountQuota->getMessage()
  55. );
  56. }
  57. $mboxObj = $api->getMailbox($service['username']);
  58. if(is_a($mboxObj, 'Exception')) {
  59. logModuleCall(
  60. 'zimbrasingle',
  61. __FUNCTION__,
  62. $service,
  63. 'Error: could not fetch mailbox info for ' . $service['username'],
  64. $mboxObj->getMessage()
  65. );
  66. }
  67. $mboxVars = get_object_vars($mboxObj);
  68. $mboxSize = $mboxVars['S'];
  69. try {
  70. Capsule::table('tblhosting')
  71. ->where('id', '=', $service['id'])
  72. ->update(
  73. array(
  74. 'diskusage' => round($mboxSize / 1048576,2),
  75. 'disklimit' => round($accountQuota / 1048576,2),
  76. 'lastupdate' => Capsule::raw('now()')
  77. )
  78. );
  79. } catch (\Exception $e) {
  80. logModuleCall(
  81. 'zimbrasingle',
  82. __FUNCTION__,
  83. $service,
  84. 'Error: could update usage information for ' . $service['username'],
  85. $e->getMessage()
  86. );
  87. }
  88. }
  89. /**
  90. * Define module related meta data.
  91. *
  92. * Values returned here are used to determine module related abilities and
  93. * settings.
  94. *
  95. * @see https://developers.whmcs.com/provisioning-modules/meta-data-params/
  96. *
  97. * @return array
  98. */
  99. function zimbraSingle_MetaData() {
  100. return array(
  101. 'DisplayName' => 'Zimbra Single Mailbox Provisioning',
  102. 'APIVersion' => '1.2',
  103. 'DefaultNonSSLPort' => '7071',
  104. 'DefaultSSLPort' => '7071',
  105. 'RequiresServer' => true,
  106. 'ServiceSingleSignOnLabel' => 'Login to Zimbra',
  107. 'AdminSingleSignOnLabel' => 'Login to Zimbra Admin'
  108. );
  109. }
  110. /**
  111. * Test connection to a Zimbra server with the given server parameters.
  112. *
  113. * Allows an admin user to verify that an API connection can be
  114. * successfully made with the given configuration parameters for a
  115. * server.
  116. *
  117. * When defined in a module, a Test Connection button will appear
  118. * alongside the Server Type dropdown when adding or editing an
  119. * existing server.
  120. *
  121. * @param array $params common module parameters
  122. *
  123. * @see https://developers.whmcs.com/provisioning-modules/module-parameters/
  124. *
  125. * @return array
  126. */
  127. function zimbraSingle_TestConnection($params) {
  128. $auth = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  129. $login = $auth->login();
  130. if(is_a($login, 'Exception')) {
  131. logModuleCall(
  132. 'zimbrasingle',
  133. __FUNCTION__,
  134. $params,
  135. 'Connection failed, cannot login to ' . $params['serverhostname'],
  136. $login->getMessage()
  137. );
  138. return array(
  139. 'success' => false,
  140. 'error' => 'Connection failed, cannot login to ' . $params['serverhostname'],
  141. );
  142. }
  143. return array(
  144. 'success' => true,
  145. 'error' => '',
  146. );
  147. }
  148. /**
  149. * Client area output logic handling.
  150. *
  151. * This function is used to define module specific client area output. It should
  152. * return an array consisting of a template file and optional additional
  153. * template variables to make available to that template.
  154. *
  155. * The template file you return can be one of two types:
  156. *
  157. * * tabOverviewModuleOutputTemplate - The output of the template provided here
  158. * will be displayed as part of the default product/service client area
  159. * product overview page.
  160. *
  161. * * tabOverviewReplacementTemplate - Alternatively using this option allows you
  162. * to entirely take control of the product/service overview page within the
  163. * client area.
  164. *
  165. * Whichever option you choose, extra template variables are defined in the same
  166. * way. This demonstrates the use of the full replacement.
  167. *
  168. * Please Note: Using tabOverviewReplacementTemplate means you should display
  169. * the standard information such as pricing and billing details in your custom
  170. * template or they will not be visible to the end user.
  171. *
  172. * @param array $params common module parameters
  173. *
  174. * @see https://developers.whmcs.com/provisioning-modules/module-parameters/
  175. *
  176. * @return array
  177. */
  178. function zimbraSingle_ClientArea($params) {
  179. $clientInfo = array();
  180. $api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  181. $login = $api->login();
  182. if(is_a($login, 'Exception')) {
  183. logModuleCall(
  184. 'zimbrasingle',
  185. __FUNCTION__,
  186. $params,
  187. 'Error: cannot login to ' . $accessData['zimbraServer'],
  188. $login->getMessage()
  189. );
  190. return false;
  191. }
  192. $apiAccountManager = new Zm_Account($api);
  193. $accountInfo = $apiAccountManager->getAccountInfo($params['username']);
  194. if(is_a($accountInfo, 'Exception')) {
  195. logModuleCall(
  196. 'zimbrasingle',
  197. __FUNCTION__,
  198. $params,
  199. 'Error: could not gather informations for ' . $params['username'],
  200. $accountInfo->getMessage()
  201. );
  202. return false;
  203. }
  204. $webmailUrl = recursiveFindAll($accountInfo, 'PUBLICMAILURL');
  205. $clientInfo['webmailurl'] = $webmailUrl[0]['DATA'];
  206. return array(
  207. 'templatefile' => 'clientarea',
  208. 'vars' => $clientInfo,
  209. );
  210. }
  211. /**
  212. * Usage Update
  213. *
  214. * Important: Runs daily per server not per product
  215. * Run Manually: /admin/reports.php?report=disk_usage_summary&action=updatestats
  216. * @param array $params common module parameters
  217. *
  218. * @see https://developers.whmcs.com/provisioning-modules/usage-update/
  219. */
  220. function zimbraSingle_UsageUpdate($params) {
  221. $api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  222. $login = $api->login();
  223. if(is_a($login, 'Exception')) {
  224. logModuleCall(
  225. 'zimbrasingle',
  226. __FUNCTION__,
  227. $params,
  228. 'Error: cannot login to ' . $params['serverhostname'],
  229. $login->getMessage()
  230. );
  231. return false;
  232. }
  233. $apiAccountManager = new Zm_Account($api);
  234. $productsObj = Capsule::table('tblhosting')
  235. ->select('*')
  236. ->where('server', '=', $params['serverid'])
  237. ->where('domainstatus', '=', 'Active')
  238. ->get();
  239. foreach((array)$productsObj as $productObj) {
  240. $product = get_object_vars($productObj[0]);
  241. zimbraSingleUpdateUsage($apiAccountManager, $product);
  242. }
  243. }
  244. /**
  245. * Change the password for a Zimbra account.
  246. *
  247. * Called when a password change is requested. This can occur either due to a
  248. * client requesting it via the client area or an admin requesting it from the
  249. * admin side.
  250. *
  251. * This option is only available to client end users when the product is in an
  252. * active status.
  253. *
  254. * @param array $params common module parameters
  255. *
  256. * @see https://developers.whmcs.com/provisioning-modules/module-parameters/
  257. *
  258. * @return string 'success' or an error message
  259. */
  260. function zimbraSingle_ChangePassword($params) {
  261. $api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  262. $login = $api->login();
  263. if(is_a($login, 'Exception')) {
  264. logModuleCall(
  265. 'zimbrasingle',
  266. __FUNCTION__,
  267. $params,
  268. 'Error: cannot login to ' . $params['serverhostname'],
  269. $login->getMessage()
  270. );
  271. return false;
  272. }
  273. $apiAccountManager = new Zm_Account($api);
  274. $response = $apiAccountManager->setAccountPassword($params['username'], $params['password']);
  275. if(is_a($response, 'Exception')) {
  276. logModuleCall(
  277. 'zimbrasingle',
  278. __FUNCTION__,
  279. $params,
  280. 'Error: password could not be set for ' . $params['username'],
  281. $response->getMessage()
  282. );
  283. return false;
  284. }
  285. return 'success';
  286. }
  287. /**
  288. * Provision a new instance of a Zimbra account.
  289. *
  290. * Attempt to provision a new Zimbra mail account. This is
  291. * called any time provisioning is requested inside of WHMCS. Depending upon the
  292. * configuration, this can be any of:
  293. * * When a new order is placed
  294. * * When an invoice for a new order is paid
  295. * * Upon manual request by an admin user
  296. *
  297. * @param array $params common module parameters
  298. *
  299. * @see https://developers.whmcs.com/provisioning-modules/module-parameters/
  300. *
  301. * @return string 'success' or an error message
  302. */
  303. function zimbraSingle_CreateAccount($params) {
  304. $api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  305. $login = $api->login();
  306. if(is_a($login, 'Exception')) {
  307. logModuleCall(
  308. 'zimbrasingle',
  309. __FUNCTION__,
  310. $params,
  311. 'Error: cannot login to ' . $params['serverhostname'],
  312. $login->getMessage()
  313. );
  314. return $login->getMessage();
  315. }
  316. $params['username'] = $params['customfields']['username'] . '@' . $params['customfields']['maildomain'];
  317. $apiAccountManager = new Zm_Account($api);
  318. $accountExists = $apiAccountManager->accountExists($params['username']);
  319. if(is_a($accountExists, 'Exception')) {
  320. logModuleCall(
  321. 'zimbrasingle',
  322. __FUNCTION__,
  323. $params,
  324. 'Error: could not verify ' . $params['username'],
  325. $accountExists->getMessage()
  326. );
  327. return 'Error: could not verify '. $params['username'];
  328. }
  329. if($accountExists === true) {
  330. return 'Error: account already exists ' . $params['username'];
  331. }
  332. $attrs = array();
  333. $attrs['gn'] = $params['customfields']['givenname'];
  334. $attrs['sn'] = $params['customfields']['sn'];
  335. $attrs['displayName'] = $attrs['gn'] . ' ' . $attrs['sn'];
  336. $passDecrypt = localAPI('DecryptPassword', array('password2' => $params['customfields']['password']));
  337. if ($passDecrypt['result'] == 'success') {
  338. $params['password'] = $passDecrypt['password'];
  339. } else {
  340. logModuleCall(
  341. 'zimbrasingle',
  342. __FUNCTION__,
  343. $params,
  344. 'Error: could not decrypt password',
  345. $passDecrypt['message']
  346. );
  347. return 'Error: could not decrypt password';
  348. }
  349. $cosID = $apiAccountManager->getCosId($params['configoption1']);
  350. if(is_a($cosID, 'Exception')) {
  351. logModuleCall(
  352. 'zimbrasingle',
  353. __FUNCTION__,
  354. $params,
  355. 'Error: could not find serviceclass ' . $params['configoption1'],
  356. $cosID->getMessage()
  357. );
  358. return 'Error: could not find serviceclass ' . $params['configoption1'];
  359. }
  360. $attrs['zimbraCOSId'] = $cosID;
  361. $zimbraID = $apiAccountManager->createAccount($params['username'], $params['password'], $attrs);
  362. if(is_a($zimbraID, 'Exception')) {
  363. logModuleCall(
  364. 'zimbrasingle',
  365. __FUNCTION__,
  366. $params,
  367. 'Error: could not create account ' . $params['username'],
  368. $zimbraID->getMessage()
  369. );
  370. return 'Error: could not create account ' . $params['username'];
  371. }
  372. try {
  373. Capsule::table('tblhosting')
  374. ->where('id', '=', $params['serviceid'])
  375. ->update(
  376. array(
  377. 'username' => $params['username'],
  378. 'password' => $params['customfields']['password'],
  379. )
  380. );
  381. } catch (\Exception $e) {
  382. logModuleCall(
  383. 'zimbrasingle',
  384. __FUNCTION__,
  385. $params,
  386. 'Error: could save username & password in database',
  387. $e->getMessage()
  388. );
  389. return 'Error: could save username & password in database';
  390. }
  391. return 'success';
  392. }
  393. /**
  394. * Set a Zimbra account to status locked.
  395. *
  396. * Called when a suspension is requested. This is invoked automatically by WHMCS
  397. * when a product becomes overdue on payment or can be called manually by admin
  398. * user.
  399. *
  400. * @param array $params common module parameters
  401. *
  402. * @see https://developers.whmcs.com/provisioning-modules/module-parameters/
  403. *
  404. * @return string 'success' or an error message
  405. */
  406. function zimbraSingle_SuspendAccount($params) {
  407. $api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  408. $login = $api->login();
  409. if(is_a($login, 'Exception')) {
  410. logModuleCall(
  411. 'zimbrasingle',
  412. __FUNCTION__,
  413. $params,
  414. 'Error: cannot login to ' . $params['serverhostname'],
  415. $login->getMessage()
  416. );
  417. return $login->getMessage();
  418. }
  419. $apiAccountManager = new Zm_Account($api);
  420. $response = $apiAccountManager->setAccountStatus($params['username'], 'locked');
  421. if(is_a($response, 'Exception')) {
  422. logModuleCall(
  423. 'zimbrasingle',
  424. __FUNCTION__,
  425. $params,
  426. 'Error: could not lock account ' . $params['username'],
  427. $response->getMessage()
  428. );
  429. return false;
  430. }
  431. return 'success';
  432. }
  433. /**
  434. * Set a Zimbra account to status active.
  435. *
  436. * Called when an un-suspension is requested. This is invoked
  437. * automatically upon payment of an overdue invoice for a product, or
  438. * can be called manually by admin user.
  439. *
  440. * @param array $params common module parameters
  441. *
  442. * @see https://developers.whmcs.com/provisioning-modules/module-parameters/
  443. *
  444. * @return string 'success' or an error message
  445. */
  446. function zimbraSingle_UnsuspendAccount($params) {
  447. $api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  448. $login = $api->login();
  449. if(is_a($login, 'Exception')) {
  450. logModuleCall(
  451. 'zimbrasingle',
  452. __FUNCTION__,
  453. $params,
  454. 'Error: cannot login to ' . $params['serverhostname'],
  455. $login->getMessage()
  456. );
  457. return $login->getMessage();
  458. }
  459. $apiAccountManager = new Zm_Account($api);
  460. $response = $apiAccountManager->setAccountStatus($params['username'], 'active');
  461. if(is_a($response, 'Exception')) {
  462. logModuleCall(
  463. 'zimbrasingle',
  464. __FUNCTION__,
  465. $params,
  466. 'Error: could not unlock account ' . $params['username'],
  467. $response->getMessage()
  468. );
  469. return 'Error: could not unlock account ' . $params['username'];
  470. }
  471. return 'success';
  472. }
  473. /**
  474. * Removes a Zimbra account.
  475. *
  476. * Called when a termination is requested. This can be invoked automatically for
  477. * overdue products if enabled, or requested manually by an admin user.
  478. *
  479. * @param array $params common module parameters
  480. *
  481. * @see https://developers.whmcs.com/provisioning-modules/module-parameters/
  482. *
  483. * @return string 'success' or an error message
  484. */
  485. function zimbraSingle_TerminateAccount($params) {
  486. $api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  487. $login = $api->login();
  488. if(is_a($login, 'Exception')) {
  489. logModuleCall(
  490. 'zimbrasingle',
  491. __FUNCTION__,
  492. $params,
  493. 'Error: cannot login to ' . $params['serverhostname'],
  494. $login->getMessage()
  495. );
  496. return $login->getMessage();
  497. }
  498. $apiAccountManager = new Zm_Account($api);
  499. $accountStatus = $apiAccountManager->getAccountStatus($params['username']);
  500. if(is_a($accountStatus, 'Exception')) {
  501. logModuleCall(
  502. 'zimbrasingle',
  503. __FUNCTION__,
  504. $params,
  505. 'Error: could not verify account '. $params['username'],
  506. $accountStatus->getMessage()
  507. );
  508. return 'Error : account ' . $params['username'] . ' Name could not verified';
  509. }
  510. if ($accountStatus != 'locked') {
  511. return 'Account '. $params['username'] . ' is active, suspend account first!';
  512. }
  513. $response = $apiAccountManager->deleteAccount($params['username']);
  514. if(is_a($response, 'Exception')) {
  515. logModuleCall(
  516. 'zimbrasingle',
  517. __FUNCTION__,
  518. $params,
  519. 'Error: could not remove account '. $params['username'],
  520. $response->getMessage()
  521. );
  522. return 'Error: could not remove account '. $params['username'];
  523. }
  524. return 'success';
  525. }
  526. /**
  527. * Set a new class of service for a Zimbra account.
  528. *
  529. * Called to apply a change of the class of service. It
  530. * is called to provision upgrade or downgrade orders, as well as being
  531. * able to be invoked manually by an admin user.
  532. *
  533. * This same function is called for upgrades and downgrades of both
  534. * products and configurable options.
  535. *
  536. * @param array $params common module parameters
  537. *
  538. * @see https://developers.whmcs.com/provisioning-modules/module-parameters/
  539. *
  540. * @return string 'success' or an error message
  541. */
  542. function zimbraSingle_ChangePackage($params) {
  543. $api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
  544. $login = $api->login();
  545. if(is_a($login, 'Exception')) {
  546. logModuleCall(
  547. 'zimbrasingle',
  548. __FUNCTION__,
  549. $params,
  550. 'Error: cannot login to ' . $params['serverhostname'],
  551. $login->getMessage()
  552. );
  553. return $login->getMessage();
  554. }
  555. $apiAccountManager = new Zm_Account($api);
  556. $response = $apiAccountManager->setAccountCos($params['username'], $params['configoption1']);
  557. if(is_a($response, 'Exception')) {
  558. logModuleCall(
  559. 'zimbrasingle',
  560. __FUNCTION__,
  561. $params,
  562. 'Error: could not set class of service for '. $params['username'],
  563. $response->getMessage()
  564. );
  565. return 'Error: could not set class of service for '. $params['username'];
  566. }
  567. zimbraSingleUpdateUsage($apiAccountManager, $params);
  568. return 'success';
  569. }
  570. /**
  571. * Define Zimbra product configuration options.
  572. *
  573. * Gather classes of service and available mail domains from the Zinbra server.
  574. * Calls a function to create all necessary customfields for the order form using the selected values.
  575. *
  576. * @see https://developers.whmcs.com/provisioning-modules/config-options/
  577. *
  578. * @return array
  579. */
  580. function zimbraSingle_ConfigOptions($params) {
  581. $whmcs = App::self();
  582. $serverGroupID = $whmcs->get_req_var('servergroup');
  583. $serverIDObj = Capsule::table('tblservergroupsrel')
  584. ->select('serverid')
  585. ->where('groupid', '=', $serverGroupID)
  586. ->get();
  587. $serverIDArray = recursiveFindAll($serverIDObj,'serverid');
  588. $server = Capsule::table('tblservers')
  589. ->select('ipaddress', 'username', 'password')
  590. ->where('id', $serverIDArray)
  591. ->where('active', '=', 1)
  592. ->get();
  593. $accessData['zimbraServer'] = $server[0]->ipaddress;
  594. $accessData['adminUser'] = $server[0]->username;
  595. $adminPassCrypt = $server[0]->password;
  596. $adminPassDecrypt = localAPI('DecryptPassword', array('password2' => $adminPassCrypt));
  597. if ($adminPassDecrypt['result'] == 'success') {
  598. $accessData['adminPass'] = $adminPassDecrypt['password'];
  599. } else {
  600. logModuleCall(
  601. 'zimbrasingle',
  602. __FUNCTION__,
  603. $adminPassCrypt,
  604. 'Error: cloud not decrypt admin password' ,
  605. $adminPassDecrypt['message']
  606. );
  607. return false;
  608. }
  609. $api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], 'admin');
  610. $login = $api->login();
  611. if(is_a($login, 'Exception')) {
  612. logModuleCall(
  613. 'zimbrasingle',
  614. __FUNCTION__,
  615. $params,
  616. 'Error: cannot login to ' . $accessData['zimbraServer'],
  617. $login->getMessage()
  618. );
  619. return false;
  620. }
  621. $apiAccountManager = new Zm_Account($api);
  622. $cosIDs = $apiAccountManager->getAllCos();
  623. if(is_a($cosIDs, 'Exception')) {
  624. logModuleCall(
  625. 'zimbrasingle',
  626. __FUNCTION__,
  627. $params,
  628. 'Error: could not fetch classes of service',
  629. $cosIDs->getMessage()
  630. );
  631. return false;
  632. }
  633. $cosNames = recursiveFindAll($cosIDs, 'NAME');
  634. $configOptions = array();
  635. $configOptions['cos'] = array(
  636. 'FriendlyName' => 'Class of Service',
  637. 'Type' => 'dropdown',
  638. 'Options' => implode(',', $cosNames),
  639. 'Description' => 'Select COS',
  640. );
  641. return $configOptions;
  642. }