From 60a09634c77b40f53933b7894a16a01d06d69623 Mon Sep 17 00:00:00 2001 From: Alexandr Hacicheant Date: Tue, 6 Sep 2022 20:49:19 +0300 Subject: [PATCH] Replaced type of SSO field to `interface{}` instead of `string|bool` because it could be bool (if SSO is disabled) or string (if sso is enabled). (#26) --- Makefile | 2 +- internal/pritunl/user.go | 2 +- tools/mongo.js | 14 +------------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 82676b5..63e8829 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ test: ./tools/wait-for-it.sh localhost:27017 -- echo "mongodb is up" # enables an api access for the pritunl user, updates an api token and secret - @docker exec -i tf_pritunl_acc_test mongo --quiet < ./tools/mongo.js + @docker exec -i tf_pritunl_acc_test mongo pritunl < ./tools/mongo.js TF_ACC=1 \ PRITUNL_URL="https://localhost/" \ diff --git a/internal/pritunl/user.go b/internal/pritunl/user.go index 1b90a9e..bbfa713 100644 --- a/internal/pritunl/user.go +++ b/internal/pritunl/user.go @@ -18,7 +18,7 @@ type User struct { ClientToClient bool `json:"client_to_client,omitempty"` MacAddresses []string `json:"mac_addresses,omitempty"` YubicoID string `json:"yubico_id,omitempty"` - SSO bool `json:"sso,omitempty"` + SSO interface{} `json:"sso,omitempty"` BypassSecondary bool `json:"bypass_secondary,omitempty"` Groups []string `json:"groups,omitempty"` Audit bool `json:"audit,omitempty"` diff --git a/tools/mongo.js b/tools/mongo.js index 9c9f183..a818c10 100644 --- a/tools/mongo.js +++ b/tools/mongo.js @@ -1,13 +1 @@ -use pritunl; -db.administrators.updateOne( - { - "username": "pritunl" - }, - { - $set: { - auth_api: true, - token: "tfacctest_token", - secret: "tfacctest_secret" - } - } -) \ No newline at end of file +db.administrators.updateOne({"username": "pritunl"}, {$set: {auth_api: true, token: "tfacctest_token", secret: "tfacctest_secret"}}); \ No newline at end of file