From 098537e0670bee2755fe1931b83e02fa8f078b07 Mon Sep 17 00:00:00 2001 From: "michele.artini" Date: Fri, 16 Sep 2022 15:47:13 +0200 Subject: [PATCH] new fields in users management page --- .../eu/dnetlib/organizations/model/User.java | 45 +++++++- .../organizations/model/view/UserView.java | 44 +++++++ .../src/main/resources/sql/schema.sql | 29 ++++- .../resources/html/pages/admin/users.html | 109 ++++++++++-------- .../src/main/resources/templates/main.html | 4 + 5 files changed, 179 insertions(+), 52 deletions(-) diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/User.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/User.java index 8a6408bd..c09a39f7 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/User.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/User.java @@ -20,6 +20,18 @@ public class User implements Serializable { @Column(name = "email") private String email; + @Column(name = "fullname") + private String fullname; + + @Column(name = "organization") + private String organization; + + @Column(name = "reference_person") + private String referencePerson; + + @Column(name = "request_message") + private String requestMessage; + @Column(name = "valid") private boolean valid; @@ -34,6 +46,38 @@ public class User implements Serializable { this.email = email; } + public String getFullname() { + return fullname; + } + + public void setFullname(final String fullname) { + this.fullname = fullname; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(final String organization) { + this.organization = organization; + } + + public String getReferencePerson() { + return referencePerson; + } + + public void setReferencePerson(final String referencePerson) { + this.referencePerson = referencePerson; + } + + public String getRequestMessage() { + return requestMessage; + } + + public void setRequestMessage(final String requestMessage) { + this.requestMessage = requestMessage; + } + public boolean isValid() { return valid; } @@ -49,5 +93,4 @@ public class User implements Serializable { public void setRole(final String role) { this.role = role; } - } diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/view/UserView.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/view/UserView.java index e09b4da8..bfc3d6f0 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/view/UserView.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/view/UserView.java @@ -30,6 +30,18 @@ public class UserView implements Serializable { @Column(name = "email") private String email; + @Column(name = "fullname") + private String fullname; + + @Column(name = "organization") + private String organization; + + @Column(name = "reference_person") + private String referencePerson; + + @Column(name = "request_message") + private String requestMessage; + @Column(name = "valid") private boolean valid; @@ -93,4 +105,36 @@ public class UserView implements Serializable { public void setLastAccess(final OffsetDateTime lastAccess) { this.lastAccess = lastAccess; } + + public String getFullname() { + return fullname; + } + + public void setFullname(final String fullname) { + this.fullname = fullname; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(final String organization) { + this.organization = organization; + } + + public String getReferencePerson() { + return referencePerson; + } + + public void setReferencePerson(final String referencePerson) { + this.referencePerson = referencePerson; + } + + public String getRequestMessage() { + return requestMessage; + } + + public void setRequestMessage(final String requestMessage) { + this.requestMessage = requestMessage; + } } diff --git a/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql b/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql index 30959313..52a08310 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql +++ b/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql @@ -318,11 +318,15 @@ CREATE TABLE user_roles(role text PRIMARY KEY); INSERT INTO user_roles VALUES ('ADMIN'), ('NATIONAL_ADMIN'), ('USER'), ('PENDING'), ('NOT_AUTHORIZED'); CREATE TABLE users ( - email text PRIMARY KEY, - valid boolean DEFAULT true, - role text NOT NULL default 'USER' REFERENCES user_roles(role), - first_access timestamp with time zone DEFAULT now(), - last_access timestamp with time zone DEFAULT now() + email text PRIMARY KEY, + fullname text, + organization text, + reference_person text, + request_message text, + valid boolean DEFAULT true, + role text NOT NULL default 'USER' REFERENCES user_roles(role), + first_access timestamp with time zone DEFAULT now(), + last_access timestamp with time zone DEFAULT now() ); CREATE TABLE user_countries ( @@ -586,6 +590,10 @@ GROUP BY CREATE VIEW users_view AS SELECT u.email, + u.fullname, + u.organization, + u.reference_person, + u.request_message, u.valid, u.role, u.first_access, @@ -594,7 +602,16 @@ CREATE VIEW users_view AS SELECT FROM users u LEFT OUTER JOIN user_countries uc ON (u.email = uc.email) -GROUP BY u.email, u.valid, u.role, u.first_access, u.last_access +GROUP BY + u.email, + u.fullname, + u.organization, + u.reference_person, + u.request_message, + u.valid, + u.role, + u.first_access, + u.last_access ORDER BY u.email; CREATE VIEW suggestions_info_by_country_view AS SELECT diff --git a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/admin/users.html b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/admin/users.html index af693259..1a7ee049 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/admin/users.html +++ b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/admin/users.html @@ -5,7 +5,7 @@
- +
@@ -19,7 +19,11 @@ - +
User
{{u.email}} + {{u.email}} +
Fullname: {{u.fullname}}
+
Organization: {{u.organization}}
+
not configured @@ -60,54 +64,69 @@ -