new fields in users management page

This commit is contained in:
Michele Artini 2022-09-16 15:47:13 +02:00
parent 4c7f4ca4c7
commit 098537e067
5 changed files with 179 additions and 52 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -319,6 +319,10 @@ INSERT INTO user_roles VALUES ('ADMIN'), ('NATIONAL_ADMIN'), ('USER'), ('PENDING
CREATE TABLE users (
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(),
@ -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

View File

@ -5,7 +5,7 @@
<div class="col-sm-12 col-lg-10">
<input type="text" class="form-control form-control-sm mb-3" ng-model="userFilter.email" placeholder="Filter...">
<table class="table table-sm table-hover">
<table class="table table-sm table-hover table-striped">
<thead class="thead-light">
<tr class="d-flex">
<th class="col-3">User</th>
@ -19,7 +19,11 @@
</thead>
<tbody>
<tr ng-repeat="u in users | filter:userFilter" class="d-flex">
<th class="col-3" ng-class="{'text-secondary': !u.valid}">{{u.email}}</th>
<th class="col-3" ng-class="{'text-secondary': !u.valid}">
<i>{{u.email}}</i>
<small ng-if="u.fullname"><br />Fullname: {{u.fullname}}</small>
<small ng-if="u.organization"><br />Organization: {{u.organization}}</small>
</th>
<td class="col-1 text-center text-success">
<i class="fa fa-check-circle" ng-if="u.valid"></i>
<span class="text-warning" ng-if="u.role == 'PENDING'">not configured</span>
@ -60,37 +64,54 @@
<h5 class="modal-title">Edit user</h5>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body" style="min-height: 300px; max-height: 500px; overflow-y: auto;">
<form>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10"><a href="mailto:{{currentUser.email}}">{{currentUser.email}}</a></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Enabled</label>
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="checkbox" ng-model="currentUser.valid" />
</div>
</div>
</div>
<div class="form-group row" ng-if="superAdminMode && currentUser.valid">
<label class="col-sm-2 col-form-label">Role</label>
<div class="col-sm-10">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" value="USER" ng-model="currentUser.role">
<label class="form-check-label">USER</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" value="NATIONAL_ADMIN" ng-model="currentUser.role">
<label class="form-check-label">NATIONAL ADMIN</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" value="ADMIN" ng-model="currentUser.role">
<label class="form-check-label">SUPER ADMIN</label>
</div>
</div>
</div>
<div class="modal-body" style="min-height: 400px; max-height: 800px; overflow-y: auto;">
<table class="table table-noborder">
<tr class="d-flex">
<th class="col-3">Fullname</th>
<td class="col-9" ng-if="currentUser.fullname">{{currentUser.fullname}}</td>
<td class="col-9 text-muted" ng-if="!currentUser.fullname"><i>not specified</i></td>
</tr>
<tr class="d-flex">
<th class="col-3">Email</th>
<td class="col-9"><a href="mailto:{{currentUser.email}}">{{currentUser.email}}</a></td>
</tr>
<tr class="d-flex">
<th class="col-3">Organization</th>
<td class="col-9" ng-if="currentUser.organization">{{currentUser.organization}}</td>
<td class="col-9 text-muted" ng-if="!currentUser.organization"><i>not specified</i></td>
</tr>
<tr class="d-flex">
<th class="col-3">Registration Request</th>
<td class="col-9" ng-if="currentUser.referencePerson || currentUser.requestMessage">
<span ng-show="currentUser.referencePerson"><b>Reference person: </b>{{currentUser.referencePerson}}<br /></span>
<pre ng-show="currentUser.requestMessage">{{currentUser.requestMessage}}</pre>
</td>
<td class="col-9 text-muted" ng-if="!currentUser.referencePerson && !currentUser.requestMessage">
<i>not specified</i>
</td>
</tr>
<tr class="d-flex">
<th class="col-3">Enabled</th>
<td class="col-9">
<input type="checkbox" ng-model="currentUser.valid" />
</td>
</tr>
<tr class="d-flex" ng-if="superAdminMode && currentUser.valid">
<th class="col-3">Role</th>
<td class="col-3">
<input type="radio" value="USER" ng-model="currentUser.role" />
<label>USER</label>
</td>
<td class="col-3">
<input type="radio" value="NATIONAL_ADMIN" ng-model="currentUser.role" />
<label>NATIONAL ADMIN</label>
</td>
<td class="col-3">
<input type="radio" value="ADMIN" ng-model="currentUser.role" />
<label>SUPER ADMIN</label>
</td>
</tr>
</table>
<div class="card mb-3" ng-if="currentUser.valid && ((currentUser.role == 'USER') || (currentUser.role == 'NATIONAL_ADMIN'))">
<div class="card-header bg-primary text-white py-1">Countries</div>
@ -106,8 +127,6 @@
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

View File

@ -47,6 +47,10 @@ fieldset > legend { font-size : 1.2rem !important; }
text-align: left !important;
}
.table-noborder td, .table-noborder th {
border: none !important;
}
</style>