/** */ protected function _init() { try { $this->storage = Shout_Driver::factory('storage'); $this->extensions = Shout_Driver::factory('extensions'); $this->devices = Shout_Driver::factory('devices'); $this->dialplan = Shout_Driver::factory('dialplan'); $conf = $GLOBALS['conf']; $this->vfs = Horde_Vfs::factory($conf['ivr']['driver'], $conf['ivr']['params']); $accounts = $this->storage->getAccounts(); } catch (Shout_Exception $e) { $GLOBALS['notification']->push($e); $accounts = false; return false; } $account = Horde_Util::getFormData('account'); if (empty($account)) { $account = $GLOBALS['session']->get('shout', 'curaccount_code'); } if (!empty($account) && !in_array($account, array_keys($accounts))) { // Requested account not available $GLOBALS['notification']->push(_("You do not have permission to access that account."), 'horde.error'); $account = false; } if (empty($account)) { if (count($accounts)) { // Default to the user's first account $account = reset(array_keys($accounts)); } else { // No account requested and/or no accounts available anyway $GLOBALS['notification']->push("Please select a account to continue.", 'horde.info'); $account = false; } } $session->set('shout', 'curaccount_code', $accounts[$account]['code']); $session->set('shout', 'curaccount_name', $accounts[$account]['name']); }
/** * Deletes an extension from the LDAP tree * * @param string $account Account to delete the user from * @param string $extension Extension of the user to be deleted * * @return boolean True on success, PEAR::Error object on error */ public function deleteExtension($account, $extension) { // Check permissions parent::deleteExtension($account, $extension); $dn = $this->_getExtensionDn($account, $extension); $res = @ldap_delete($this->_LDAP, $dn); if ($res === false) { $msg = sprintf('LDAP Error (%s): %s', ldap_errno($this->_LDAP), ldap_error($this->_LDAP)); Horde::log($msg, 'ERR'); throw new Horde_Exception(_("Error while deleting from the directory. Details have been logged for the administrator.")); } return true; }
/** * Save a user to the LDAP tree * * @param string $account Account to which the user should be added * * @param string $extension Extension to be saved * * @param array $userdetails Phone numbers, PIN, options, etc to be saved * * @return TRUE on success, PEAR::Error object on error */ public function saveExtension($account, $extension, $userdetails) { parent::saveExtension($account, $extension, $details); throw new Shout_Exception("Not implemented."); }