changeset 363:45d4399f6c15

merge
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 08 Aug 2018 18:14:31 +0200
parents 2c58906649be (current diff) f5087cebc740 (diff)
children c63200982ce7
files
diffstat 6 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Dockerfile	Wed Aug 08 18:14:16 2018 +0200
+++ b/Dockerfile	Wed Aug 08 18:14:31 2018 +0200
@@ -15,6 +15,7 @@
 COPY cmd ./cmd/
 COPY config ./config/
 COPY controllers ./controllers/
+COPY misc ./misc/
 COPY Makefile ./
 COPY example_conf.toml ./
 
--- a/controllers/externalwfs.go	Wed Aug 08 18:14:16 2018 +0200
+++ b/controllers/externalwfs.go	Wed Aug 08 18:14:31 2018 +0200
@@ -17,9 +17,10 @@
 	"gemma.intevation.de/gemma/config"
 )
 
-type RoundTripFunc func(*http.Request) (*http.Response, error)
+// roundTripFunc is a helper type to make externalWFSDirector a http.RoundTripper.
+type roundTripFunc func(*http.Request) (*http.Response, error)
 
-func (rtf RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {
+func (rtf roundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {
 	return rtf(req)
 }
 
--- a/controllers/routes.go	Wed Aug 08 18:14:16 2018 +0200
+++ b/controllers/routes.go	Wed Aug 08 18:14:31 2018 +0200
@@ -54,7 +54,7 @@
 	// Proxy for external WFSs.
 	externalWFSProxy := &httputil.ReverseProxy{
 		Director:       externalWFSDirector,
-		Transport:      RoundTripFunc(externalWFSTransport),
+		Transport:      roundTripFunc(externalWFSTransport),
 		ModifyResponse: externalWFSModifyResponse,
 	}
 
--- a/schema/gemma.sql	Wed Aug 08 18:14:16 2018 +0200
+++ b/schema/gemma.sql	Wed Aug 08 18:14:31 2018 +0200
@@ -40,7 +40,8 @@
 CREATE SCHEMA internal
     -- Profile data are only accessible via the view users.list_users.
     CREATE TABLE user_profiles (
-        username varchar PRIMARY KEY,
+        username varchar PRIMARY KEY CHECK(octet_length(username) <= 63),
+        -- keep username length compatible with role identifier
         map_extent box2d NOT NULL,
         email_address varchar NOT NULL
     )
--- a/schema/manage_users_tests.sql	Wed Aug 08 18:14:16 2018 +0200
+++ b/schema/manage_users_tests.sql	Wed Aug 08 18:14:31 2018 +0200
@@ -68,6 +68,15 @@
     23505, NULL,
     'No duplicate user name is allowed');
 
+SELECT throws_ok($$
+    INSERT INTO users.list_users VALUES (
+        'waterway_user',
+        'Test Nutzer AT, Test User RO, Täst Nützer ÄT, Täst Üser RÖ',
+        'secret1$', 'AT', NULL, 'test4')
+    $$,
+    23514, NULL,
+    'User name length is restricted to 63 bytes');
+
 -- Test password policy
 SELECT throws_ok($$
     INSERT INTO users.list_users VALUES (
--- a/schema/run_tests.sh	Wed Aug 08 18:14:16 2018 +0200
+++ b/schema/run_tests.sh	Wed Aug 08 18:14:31 2018 +0200
@@ -16,7 +16,7 @@
     -c 'SET client_min_messages TO WARNING' \
     -c "DROP ROLE IF EXISTS $TEST_ROLES" \
     -f tap_tests_data.sql \
-    -c 'SELECT plan(43)' \
+    -c 'SELECT plan(44)' \
     -f auth_tests.sql \
     -f manage_users_tests.sql \
     -c 'SELECT * FROM finish()'