diff --git a/lib/Adapter/Users/NextcloudUserAdapter.php b/lib/Adapter/Users/NextcloudUserAdapter.php index 5cadcfe..5f17b97 100644 --- a/lib/Adapter/Users/NextcloudUserAdapter.php +++ b/lib/Adapter/Users/NextcloudUserAdapter.php @@ -2,6 +2,7 @@ namespace OCA\SCIMServiceProvider\Adapter\Users; +use OCA\SCIMServiceProvider\AppInfo\Application; use OCP\IConfig; use OCP\IUser; use OCP\IUserManager; @@ -63,7 +64,7 @@ class NextcloudUserAdapter extends AbstractAdapter $coreUser->setDisplayName($ncUser->getDisplayName()); $coreUser->setActive($ncUser->isEnabled()); - $ncUserExternalId = $this->config->getUserValue($ncUser->getUID(), 'SCIMServiceProvider', 'ExternalId', ''); + $ncUserExternalId = $this->config->getUserValue($ncUser->getUID(), Application::APP_ID, 'externalId', ''); $coreUser->setExternalId($ncUserExternalId); if ($ncUser->getEMailAddress() !== null && !empty($ncUser->getEMailAddress())) { @@ -106,7 +107,7 @@ class NextcloudUserAdapter extends AbstractAdapter } if ($coreUser->getExternalId() !== null && !empty($coreUser->getExternalId())) { - $this->config->setUserValue($ncUser->getUID(), 'SCIMServiceProvider', 'ExternalId', $coreUser->getExternalId()); + $this->config->setUserValue($ncUser->getUID(), Application::APP_ID, 'externalId', $coreUser->getExternalId()); } if ($coreUser->getEmails() !== null && !empty($coreUser->getEmails())) { diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index e176dd8..4220a8c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -36,7 +36,7 @@ use Psr\Container\ContainerInterface; */ class Application extends App implements IBootstrap { - public const APP_ID = 'SCIMServiceProvider'; + public const APP_ID = 'scimserviceprovider'; public function __construct(array $urlParams = []) { diff --git a/lib/Service/GroupService.php b/lib/Service/GroupService.php index 77f4391..3840d3a 100644 --- a/lib/Service/GroupService.php +++ b/lib/Service/GroupService.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace OCA\SCIMServiceProvider\Service; use Exception; +use OCA\SCIMServiceProvider\AppInfo\Application; use OCA\SCIMServiceProvider\Responses\SCIMErrorResponse; use OCA\SCIMServiceProvider\Responses\SCIMJSONResponse; use OCA\SCIMServiceProvider\Responses\SCIMListResponse; @@ -102,7 +103,7 @@ class GroupService return new SCIMErrorResponse(['message' => 'Creating group failed'], 400); } } catch (Exception $e) { - $this->logger->warning('Failed createGroup attempt with SCIMException exception.', ['app' => 'SCIMServiceProvider']); + $this->logger->warning('Failed createGroup attempt with SCIMException exception.', ['app' => Application::APP_ID]); throw $e; } } diff --git a/lib/Service/SCIMUser.php b/lib/Service/SCIMUser.php index 487017b..8801247 100644 --- a/lib/Service/SCIMUser.php +++ b/lib/Service/SCIMUser.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace OCA\SCIMServiceProvider\Service; +use OCA\SCIMServiceProvider\AppInfo\Application; use OCP\IConfig; use OCP\IUserManager; @@ -35,7 +36,7 @@ class SCIMUser { } $enabled = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'enabled', 'true') === 'true'; - $externalId = $this->config->getUserValue($targetUserObject->getUID(), 'SCIMServiceProvider', 'ExternalId', ''); + $externalId = $this->config->getUserValue($targetUserObject->getUID(), Application::APP_ID, 'externalId', ''); $email = $targetUserObject->getSystemEMailAddress(); @@ -78,7 +79,7 @@ class SCIMUser { * @throws Exception */ public function setExternalId(string $userId, string $externalId) { - $this->config->setUserValue($userId, 'SCIMServiceProvider', 'ExternalId', $externalId); + $this->config->setUserValue($userId, Application::APP_ID, 'externalId', $externalId); } } diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 9973ea7..74291c1 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace OCA\SCIMServiceProvider\Service; use Exception; +use OCA\SCIMServiceProvider\AppInfo\Application; use OCA\SCIMServiceProvider\Responses\SCIMErrorResponse; use OCA\SCIMServiceProvider\Responses\SCIMJSONResponse; use OCA\SCIMServiceProvider\Responses\SCIMListResponse; @@ -94,7 +95,7 @@ class UserService return new SCIMErrorResponse(['message' => 'Creating user failed'], 400); } } catch (Exception $e) { - $this->logger->warning('Failed createUser attempt with SCIMException exeption.', ['app' => 'SCIMServiceProvider']); + $this->logger->warning('Failed createUser attempt with SCIMException exeption.', ['app' => Application::APP_ID]); throw $e; } }