diff options
20 files changed, 102 insertions, 111 deletions
diff --git a/appinfo/app.php b/appinfo/app.php deleted file mode 100644 index 6151a35..0000000 --- a/appinfo/app.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -/** - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * - * Nextcloud - Two-factor Gateway - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ -include_once __DIR__ . '/../vendor/autoload.php'; diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index adbdce0..c2c88c7 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -23,12 +23,24 @@ declare(strict_types=1); namespace OCA\TwoFactorGateway\AppInfo; +use OCA\TwoFactorGateway\Capabilities; use OCP\AppFramework\App; +use OCP\AppFramework\Bootstrap\IBootContext; +use OCP\AppFramework\Bootstrap\IBootstrap; +use OCP\AppFramework\Bootstrap\IRegistrationContext; -class Application extends App { - public const APP_NAME = 'twofactor_gateway'; +include_once __DIR__ . '/../../vendor/autoload.php'; + +class Application extends App implements IBootstrap { + public const APP_ID = 'twofactor_gateway'; public function __construct(array $urlParams = []) { - parent::__construct(self::APP_NAME, $urlParams); + parent::__construct(self::APP_ID, $urlParams); + } + + public function register(IRegistrationContext $context): void { + } + + public function boot(IBootContext $context): void { } } diff --git a/lib/Provider/AProvider.php b/lib/Provider/AProvider.php index 4d989f5..f2a7f41 100644 --- a/lib/Provider/AProvider.php +++ b/lib/Provider/AProvider.php @@ -149,10 +149,10 @@ abstract class AProvider implements IProvider, IProvidesIcons, IProvidesPersonal } public function getLightIcon(): String { - return image_path(Application::APP_NAME, 'app.svg'); + return image_path(Application::APP_ID, 'app.svg'); } public function getDarkIcon(): String { - return image_path(Application::APP_NAME, 'app-dark.svg'); + return image_path(Application::APP_ID, 'app-dark.svg'); } } diff --git a/lib/Service/Gateway/SMS/GatewayConfig.php b/lib/Service/Gateway/SMS/GatewayConfig.php index 83c5371..84a7ca9 100644 --- a/lib/Service/Gateway/SMS/GatewayConfig.php +++ b/lib/Service/Gateway/SMS/GatewayConfig.php @@ -45,7 +45,7 @@ class GatewayConfig implements IGatewayConfig { } public function getProvider(): IProvider { - $providerName = $this->config->getAppValue(Application::APP_NAME, 'sms_provider_name'); + $providerName = $this->config->getAppValue(Application::APP_ID, 'sms_provider_name'); if ($providerName === '') { throw new ConfigurationException(); } @@ -54,7 +54,7 @@ class GatewayConfig implements IGatewayConfig { } public function setProvider(string $provider) { - $this->config->setAppValue(Application::APP_NAME, 'sms_provider_name', $provider); + $this->config->setAppValue(Application::APP_ID, 'sms_provider_name', $provider); } public function isComplete(): bool { diff --git a/lib/Service/Gateway/SMS/Provider/ClickSendConfig.php b/lib/Service/Gateway/SMS/Provider/ClickSendConfig.php index 14523f8..95cf31d 100644 --- a/lib/Service/Gateway/SMS/Provider/ClickSendConfig.php +++ b/lib/Service/Gateway/SMS/Provider/ClickSendConfig.php @@ -42,7 +42,7 @@ class ClickSendConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -54,7 +54,7 @@ class ClickSendConfig implements IProviderConfig { } public function setUser(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'clicksend_user', $user); + $this->config->setAppValue(Application::APP_ID, 'clicksend_user', $user); } public function getApiKey(): string { @@ -62,17 +62,17 @@ class ClickSendConfig implements IProviderConfig { } public function setApiKey(string $password) { - $this->config->setAppValue(Application::APP_NAME, 'clicksend_apikey', $password); + $this->config->setAppValue(Application::APP_ID, 'clicksend_apikey', $password); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/ClickatellCentralConfig.php b/lib/Service/Gateway/SMS/Provider/ClickatellCentralConfig.php index c1cdd59..6310feb 100644 --- a/lib/Service/Gateway/SMS/Provider/ClickatellCentralConfig.php +++ b/lib/Service/Gateway/SMS/Provider/ClickatellCentralConfig.php @@ -44,7 +44,7 @@ class ClickatellCentralConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -56,7 +56,7 @@ class ClickatellCentralConfig implements IProviderConfig { } public function setApi(string $api) { - $this->config->setAppValue(Application::APP_NAME, 'clickatell_central_api', $api); + $this->config->setAppValue(Application::APP_ID, 'clickatell_central_api', $api); } public function getUser(): string { @@ -64,7 +64,7 @@ class ClickatellCentralConfig implements IProviderConfig { } public function setUser(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'clickatell_central_user', $user); + $this->config->setAppValue(Application::APP_ID, 'clickatell_central_user', $user); } public function getPassword(): string { @@ -72,17 +72,17 @@ class ClickatellCentralConfig implements IProviderConfig { } public function setPassword(string $password) { - $this->config->setAppValue(Application::APP_NAME, 'clickatell_central_password', $password); + $this->config->setAppValue(Application::APP_ID, 'clickatell_central_password', $password); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/ClockworkSMSConfig.php b/lib/Service/Gateway/SMS/Provider/ClockworkSMSConfig.php index 955aa24..7eb46fe 100644 --- a/lib/Service/Gateway/SMS/Provider/ClockworkSMSConfig.php +++ b/lib/Service/Gateway/SMS/Provider/ClockworkSMSConfig.php @@ -41,7 +41,7 @@ class ClockworkSMSConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -53,17 +53,17 @@ class ClockworkSMSConfig implements IProviderConfig { } public function setApiToken(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'clockworksms_apitoken', $user); + $this->config->setAppValue(Application::APP_ID, 'clockworksms_apitoken', $user); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/EcallSMSConfig.php b/lib/Service/Gateway/SMS/Provider/EcallSMSConfig.php index e11d28b..c289501 100644 --- a/lib/Service/Gateway/SMS/Provider/EcallSMSConfig.php +++ b/lib/Service/Gateway/SMS/Provider/EcallSMSConfig.php @@ -43,7 +43,7 @@ class EcallSMSConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -55,7 +55,7 @@ class EcallSMSConfig implements IProviderConfig { } public function setUser(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'ecallsms_username', $user); + $this->config->setAppValue(Application::APP_ID, 'ecallsms_username', $user); } public function getPassword(): string { @@ -63,7 +63,7 @@ class EcallSMSConfig implements IProviderConfig { } public function setPassword(string $password) { - $this->config->setAppValue(Application::APP_NAME, 'ecallsms_password', $password); + $this->config->setAppValue(Application::APP_ID, 'ecallsms_password', $password); } public function getSenderId(): string { @@ -71,17 +71,17 @@ class EcallSMSConfig implements IProviderConfig { } public function setSenderId(string $senderid) { - $this->config->setAppValue(Application::APP_NAME, 'ecallsms_senderid', $senderid); + $this->config->setAppValue(Application::APP_ID, 'ecallsms_senderid', $senderid); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/HuaweiE3531Config.php b/lib/Service/Gateway/SMS/Provider/HuaweiE3531Config.php index efafa88..7020667 100644 --- a/lib/Service/Gateway/SMS/Provider/HuaweiE3531Config.php +++ b/lib/Service/Gateway/SMS/Provider/HuaweiE3531Config.php @@ -41,7 +41,7 @@ class HuaweiE3531Config implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -53,17 +53,17 @@ class HuaweiE3531Config implements IProviderConfig { } public function setUrl(string $url) { - $this->config->setAppValue(Application::APP_NAME, 'huawei_e3531_api', $url); + $this->config->setAppValue(Application::APP_ID, 'huawei_e3531_api', $url); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/OvhConfig.php b/lib/Service/Gateway/SMS/Provider/OvhConfig.php index 0e4793d..80b6538 100644 --- a/lib/Service/Gateway/SMS/Provider/OvhConfig.php +++ b/lib/Service/Gateway/SMS/Provider/OvhConfig.php @@ -46,7 +46,7 @@ class OvhConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -78,37 +78,37 @@ class OvhConfig implements IProviderConfig { } public function setApplicationKey(string $appKey) { - $this->config->setAppValue(Application::APP_NAME, 'ovh_application_key', $appKey); + $this->config->setAppValue(Application::APP_ID, 'ovh_application_key', $appKey); } public function setApplicationSecret(string $appSecret) { - $this->config->setAppValue(Application::APP_NAME, 'ovh_application_secret', $appSecret); + $this->config->setAppValue(Application::APP_ID, 'ovh_application_secret', $appSecret); } public function setConsumerKey(string $consumerKey) { - $this->config->setAppValue(Application::APP_NAME, 'ovh_consumer_key', $consumerKey); + $this->config->setAppValue(Application::APP_ID, 'ovh_consumer_key', $consumerKey); } public function setEndpoint(string $endpoint) { - $this->config->setAppValue(Application::APP_NAME, 'ovh_endpoint', $endpoint); + $this->config->setAppValue(Application::APP_ID, 'ovh_endpoint', $endpoint); } public function setAccount($account) { - $this->config->setAppValue(Application::APP_NAME, 'ovh_account', $account); + $this->config->setAppValue(Application::APP_ID, 'ovh_account', $account); } public function setSender($sender) { - $this->config->setAppValue(Application::APP_NAME, 'ovh_sender', $sender); + $this->config->setAppValue(Application::APP_ID, 'ovh_sender', $sender); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/PlaySMSConfig.php b/lib/Service/Gateway/SMS/Provider/PlaySMSConfig.php index 5f0f2ec..35d6c69 100644 --- a/lib/Service/Gateway/SMS/Provider/PlaySMSConfig.php +++ b/lib/Service/Gateway/SMS/Provider/PlaySMSConfig.php @@ -43,7 +43,7 @@ class PlaySMSConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -55,7 +55,7 @@ class PlaySMSConfig implements IProviderConfig { } public function setUrl(string $url) { - $this->config->setAppValue(Application::APP_NAME, 'playsms_url', $url); + $this->config->setAppValue(Application::APP_ID, 'playsms_url', $url); } public function getUser(): string { @@ -63,7 +63,7 @@ class PlaySMSConfig implements IProviderConfig { } public function setUser(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'playsms_user', $user); + $this->config->setAppValue(Application::APP_ID, 'playsms_user', $user); } public function getPassword(): string { @@ -71,17 +71,17 @@ class PlaySMSConfig implements IProviderConfig { } public function setPassword(string $password) { - $this->config->setAppValue(Application::APP_NAME, 'playsms_password', $password); + $this->config->setAppValue(Application::APP_ID, 'playsms_password', $password); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/PuzzelSMSConfig.php b/lib/Service/Gateway/SMS/Provider/PuzzelSMSConfig.php index 09d6b30..2133a6f 100644 --- a/lib/Service/Gateway/SMS/Provider/PuzzelSMSConfig.php +++ b/lib/Service/Gateway/SMS/Provider/PuzzelSMSConfig.php @@ -44,7 +44,7 @@ class PuzzelSMSConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -56,7 +56,7 @@ class PuzzelSMSConfig implements IProviderConfig { } public function setUrl(string $url) { - $this->config->setAppValue(Application::APP_NAME, 'puzzel_url', $url); + $this->config->setAppValue(Application::APP_ID, 'puzzel_url', $url); } public function getUser(): string { @@ -64,7 +64,7 @@ class PuzzelSMSConfig implements IProviderConfig { } public function setUser(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'puzzel_user', $user); + $this->config->setAppValue(Application::APP_ID, 'puzzel_user', $user); } public function getPassword(): string { @@ -72,7 +72,7 @@ class PuzzelSMSConfig implements IProviderConfig { } public function setPassword(string $password) { - $this->config->setAppValue(Application::APP_NAME, 'puzzel_password', $password); + $this->config->setAppValue(Application::APP_ID, 'puzzel_password', $password); } public function getServiceId() { @@ -80,17 +80,17 @@ class PuzzelSMSConfig implements IProviderConfig { } public function setServiceId(string $serviceid) { - $this->config->setAppValue(Application::APP_NAME, 'puzzel_serviceid', $serviceid); + $this->config->setAppValue(Application::APP_ID, 'puzzel_serviceid', $serviceid); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/Sms77IoConfig.php b/lib/Service/Gateway/SMS/Provider/Sms77IoConfig.php index eebc71c..7d4549c 100644 --- a/lib/Service/Gateway/SMS/Provider/Sms77IoConfig.php +++ b/lib/Service/Gateway/SMS/Provider/Sms77IoConfig.php @@ -41,7 +41,7 @@ class Sms77IoConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -53,17 +53,17 @@ class Sms77IoConfig implements IProviderConfig { } public function setApiKey(string $apiKey) { - $this->config->setAppValue(Application::APP_NAME, 'sms77io_api_key', $apiKey); + $this->config->setAppValue(Application::APP_ID, 'sms77io_api_key', $apiKey); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/SpryngSMSConfig.php b/lib/Service/Gateway/SMS/Provider/SpryngSMSConfig.php index 4670573..ade02bf 100644 --- a/lib/Service/Gateway/SMS/Provider/SpryngSMSConfig.php +++ b/lib/Service/Gateway/SMS/Provider/SpryngSMSConfig.php @@ -41,7 +41,7 @@ class SpryngSMSConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if ($val === null) { throw new ConfigurationException(); } @@ -53,17 +53,17 @@ class SpryngSMSConfig implements IProviderConfig { } public function setApiToken(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'spryng_apitoken', $user); + $this->config->setAppValue(Application::APP_ID, 'spryng_apitoken', $user); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/VoipMsConfig.php b/lib/Service/Gateway/SMS/Provider/VoipMsConfig.php index 7b3cdca..c54029f 100644 --- a/lib/Service/Gateway/SMS/Provider/VoipMsConfig.php +++ b/lib/Service/Gateway/SMS/Provider/VoipMsConfig.php @@ -43,7 +43,7 @@ class VoipMsConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -55,7 +55,7 @@ class VoipMsConfig implements IProviderConfig { } public function setUser(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'voipms_api_username', $user); + $this->config->setAppValue(Application::APP_ID, 'voipms_api_username', $user); } public function getPassword(): string { @@ -63,7 +63,7 @@ class VoipMsConfig implements IProviderConfig { } public function setPassword(string $password) { - $this->config->setAppValue(Application::APP_NAME, 'voipms_api_password', $password); + $this->config->setAppValue(Application::APP_ID, 'voipms_api_password', $password); } public function getDid(): string { @@ -71,17 +71,17 @@ class VoipMsConfig implements IProviderConfig { } public function setDid(string $did) { - $this->config->setAppValue(Application::APP_NAME, 'voipms_did', $did); + $this->config->setAppValue(Application::APP_ID, 'voipms_did', $did); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/VoipbusterConfig.php b/lib/Service/Gateway/SMS/Provider/VoipbusterConfig.php index 27d8127..a731cab 100644 --- a/lib/Service/Gateway/SMS/Provider/VoipbusterConfig.php +++ b/lib/Service/Gateway/SMS/Provider/VoipbusterConfig.php @@ -43,7 +43,7 @@ class VoipbusterConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -55,7 +55,7 @@ class VoipbusterConfig implements IProviderConfig { } public function setUser(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'voipbuster_api_username', $user); + $this->config->setAppValue(Application::APP_ID, 'voipbuster_api_username', $user); } public function getPassword(): string { @@ -63,7 +63,7 @@ class VoipbusterConfig implements IProviderConfig { } public function setPassword(string $password) { - $this->config->setAppValue(Application::APP_NAME, 'voipbuster_api_password', $password); + $this->config->setAppValue(Application::APP_ID, 'voipbuster_api_password', $password); } public function getDid(): string { @@ -71,17 +71,17 @@ class VoipbusterConfig implements IProviderConfig { } public function setDid(string $did) { - $this->config->setAppValue(Application::APP_NAME, 'voipbuster_did', $did); + $this->config->setAppValue(Application::APP_ID, 'voipbuster_did', $did); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/SMS/Provider/WebSmsConfig.php b/lib/Service/Gateway/SMS/Provider/WebSmsConfig.php index facfdea..8a41faf 100644 --- a/lib/Service/Gateway/SMS/Provider/WebSmsConfig.php +++ b/lib/Service/Gateway/SMS/Provider/WebSmsConfig.php @@ -42,7 +42,7 @@ class WebSmsConfig implements IProviderConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key, null); + $val = $this->config->getAppValue(Application::APP_ID, $key, null); if (is_null($val)) { throw new ConfigurationException(); } @@ -54,7 +54,7 @@ class WebSmsConfig implements IProviderConfig { } public function setUser(string $user) { - $this->config->setAppValue(Application::APP_NAME, 'websms_de_user', $user); + $this->config->setAppValue(Application::APP_ID, 'websms_de_user', $user); } public function getPassword(): string { @@ -62,17 +62,17 @@ class WebSmsConfig implements IProviderConfig { } public function setPassword(string $password) { - $this->config->setAppValue(Application::APP_NAME, 'websms_de_password', $password); + $this->config->setAppValue(Application::APP_ID, 'websms_de_password', $password); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/Signal/GatewayConfig.php b/lib/Service/Gateway/Signal/GatewayConfig.php index d35d958..48d3e5c 100644 --- a/lib/Service/Gateway/Signal/GatewayConfig.php +++ b/lib/Service/Gateway/Signal/GatewayConfig.php @@ -41,7 +41,7 @@ class GatewayConfig implements IGatewayConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key); + $val = $this->config->getAppValue(Application::APP_ID, $key); if ($val === '') { throw new ConfigurationException(); } @@ -53,17 +53,17 @@ class GatewayConfig implements IGatewayConfig { } public function setUrl(string $url) { - $this->config->setAppValue(Application::APP_NAME, 'signal_url', $url); + $this->config->setAppValue(Application::APP_ID, 'signal_url', $url); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/Gateway/Telegram/GatewayConfig.php b/lib/Service/Gateway/Telegram/GatewayConfig.php index 3aff370..45e6e26 100644 --- a/lib/Service/Gateway/Telegram/GatewayConfig.php +++ b/lib/Service/Gateway/Telegram/GatewayConfig.php @@ -43,7 +43,7 @@ class GatewayConfig implements IGatewayConfig { } private function getOrFail(string $key): string { - $val = $this->config->getAppValue(Application::APP_NAME, $key); + $val = $this->config->getAppValue(Application::APP_ID, $key); if ($val === '') { throw new ConfigurationException(); } @@ -55,17 +55,17 @@ class GatewayConfig implements IGatewayConfig { } public function setBotToken(string $token) { - $this->config->setAppValue(Application::APP_NAME, 'telegram_bot_token', $token); + $this->config->setAppValue(Application::APP_ID, 'telegram_bot_token', $token); } public function isComplete(): bool { - $set = $this->config->getAppKeys(Application::APP_NAME); + $set = $this->config->getAppKeys(Application::APP_ID); return count(array_intersect($set, self::expected)) === count(self::expected); } public function remove() { foreach (self::expected as $key) { - $this->config->deleteAppValue(Application::APP_NAME, $key); + $this->config->deleteAppValue(Application::APP_ID, $key); } } } diff --git a/lib/Service/StateStorage.php b/lib/Service/StateStorage.php index cbaf7ed..6517bb1 100644 --- a/lib/Service/StateStorage.php +++ b/lib/Service/StateStorage.php @@ -46,17 +46,17 @@ class StateStorage { private function getUserValue(IUser $user, string $gatewayName, string $key, $default = '') { $gatewayKey = $this->buildConfigKey($gatewayName, $key); - return $this->config->getUserValue($user->getUID(), Application::APP_NAME, $gatewayKey, $default); + return $this->config->getUserValue($user->getUID(), Application::APP_ID, $gatewayKey, $default); } private function setUserValue(IUser $user, string $gatewayName, string $key, $value) { $gatewayKey = $this->buildConfigKey($gatewayName, $key); - $this->config->setUserValue($user->getUID(), Application::APP_NAME, $gatewayKey, $value); + $this->config->setUserValue($user->getUID(), Application::APP_ID, $gatewayKey, $value); } private function deleteUserValue(IUser $user, string $gatewayName, string $key) { $gatewayKey = $this->buildConfigKey($gatewayName, $key); - $this->config->deleteUserValue($user->getUID(), Application::APP_NAME, $gatewayKey); + $this->config->deleteUserValue($user->getUID(), Application::APP_ID, $gatewayKey); } public function get(IUser $user, string $gatewayName): State { |