From 5c15ad4518f70e4523405fa67635c4dff1a73e43 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Fri, 1 Mar 2024 09:30:07 +0100 Subject: feat: add user role database table and role-based permissions --- src/main/resources/db/migration/mariadb/V0_3_0__UserRoles.sql | 7 +++++++ .../resources/db/migration/postgresql/V0_3_0__UserRoles.sql | 8 ++++++++ src/main/resources/templates/index.html | 10 +++++----- 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/db/migration/mariadb/V0_3_0__UserRoles.sql create mode 100644 src/main/resources/db/migration/postgresql/V0_3_0__UserRoles.sql (limited to 'src/main/resources') diff --git a/src/main/resources/db/migration/mariadb/V0_3_0__UserRoles.sql b/src/main/resources/db/migration/mariadb/V0_3_0__UserRoles.sql new file mode 100644 index 0000000..99399fd --- /dev/null +++ b/src/main/resources/db/migration/mariadb/V0_3_0__UserRoles.sql @@ -0,0 +1,7 @@ +CREATE TABLE IF NOT EXISTS user_role +( + id int auto_increment primary key, + username varchar(255) not null unique, + role varchar(255) not null, + created_at datetime default utc_timestamp() not null +); \ No newline at end of file diff --git a/src/main/resources/db/migration/postgresql/V0_3_0__UserRoles.sql b/src/main/resources/db/migration/postgresql/V0_3_0__UserRoles.sql new file mode 100644 index 0000000..7dbfc08 --- /dev/null +++ b/src/main/resources/db/migration/postgresql/V0_3_0__UserRoles.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS user_role +( + id serial, + username varchar(255) not null unique, + role varchar(255) not null, + created_at timestamp with time zone default now() not null, + PRIMARY KEY (id) +); \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 3951f66..be3123b 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -53,17 +53,17 @@ [[ ${request.type} ]] [[ ${request.uuid} ]] - [[ ${request.uuid} ]] - [[ ${request.uuid} ]] + [[ ${request.uuid} ]] + [[ ${request.uuid} ]] - + [[ ${request.patientId} ]] - + [[ ${request.patientId} ]] - *** + *** -- cgit v1.2.3 From feb9f2430c0f3e73ed94f029cb6f92e7ff1eae65 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Fri, 1 Mar 2024 13:51:06 +0100 Subject: feat: add config page for user role assignment --- src/main/resources/static/style.css | 26 ++++++++++++++- src/main/resources/templates/configs.html | 3 ++ .../resources/templates/configs/userroles.html | 39 ++++++++++++++++++++++ src/main/resources/templates/login.html | 1 + 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/templates/configs/userroles.html (limited to 'src/main/resources') diff --git a/src/main/resources/static/style.css b/src/main/resources/static/style.css index c7a0b38..0dd5820 100644 --- a/src/main/resources/static/style.css +++ b/src/main/resources/static/style.css @@ -202,6 +202,17 @@ form.samplecode-input input:focus-visible { background: none; } +.userrole-form form { + margin: 0; + padding: 0; + + border: none; + border-radius: 0; + background: none; + + text-align: inherit; +} + .login-form form *, .token-form form * { padding: 0.5em; @@ -210,7 +221,8 @@ form.samplecode-input input:focus-visible { } .login-form form hr, -.token-form form hr { +.token-form form hr, +.userrole-form form hr { padding: 0; width: 100%; } @@ -224,6 +236,14 @@ form.samplecode-input input:focus-visible { border: none; } +.userrole-form form select { + padding: 0.5em; + border: none; + border-radius: 3px; + line-height: 1.2rem; + font-size: 0.8rem; +} + .border { padding: 1.5em; border: 1px solid var(--table-border); @@ -527,6 +547,10 @@ input.inline:focus-visible { color: var(--bg-green); } +.notification.notice { + color: var(--bg-yellow); +} + .notification.error { color: var(--bg-red); } diff --git a/src/main/resources/templates/configs.html b/src/main/resources/templates/configs.html index ebef7ca..2103b0b 100644 --- a/src/main/resources/templates/configs.html +++ b/src/main/resources/templates/configs.html @@ -40,6 +40,9 @@
+
+
+
diff --git a/src/main/resources/templates/configs/userroles.html b/src/main/resources/templates/configs/userroles.html new file mode 100644 index 0000000..23cc5f2 --- /dev/null +++ b/src/main/resources/templates/configs/userroles.html @@ -0,0 +1,39 @@ +
+

Benutzerberechtigungen

+

Die Verwendung von rollenbasierten Benutzerberechtigungen ist nicht aktiviert.

+
+ +
+

Benutzerberechtigungen

+
+
Noch keine Benutzerberechtigungen vorhanden.
+ + + + + + + + + + + + + + + +
BenutzernameRolle
[[ ${userRole.username} ]] +
+
+ + +
+
+
+ +
+
+
\ No newline at end of file diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 4ef8ec9..75a3681 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -11,6 +11,7 @@

Anmelden

Anmeldung nicht erfolgreich
+
Sitzung abgelaufen oder von einem Administrator beendet.
Sie haben sich abgemeldet
-- cgit v1.2.3