aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-28 07:19:24 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-28 07:19:24 -0700
commit3c48c66cf55705274ff482cf3deefee11196ddfe (patch)
tree10787a92e489fcb31e482eaff9cfae6ca3f97d9b /src/main/java/org/traccar
parent08d634d984c1388c3919d7c6645506b202307dac (diff)
downloadtrackermap-server-3c48c66cf55705274ff482cf3deefee11196ddfe.tar.gz
trackermap-server-3c48c66cf55705274ff482cf3deefee11196ddfe.tar.bz2
trackermap-server-3c48c66cf55705274ff482cf3deefee11196ddfe.zip
Fix user registration
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/api/resource/UserResource.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/api/resource/UserResource.java b/src/main/java/org/traccar/api/resource/UserResource.java
index 20fce9e32..1bb399437 100644
--- a/src/main/java/org/traccar/api/resource/UserResource.java
+++ b/src/main/java/org/traccar/api/resource/UserResource.java
@@ -72,8 +72,8 @@ public class UserResource extends BaseObjectResource<User> {
@PermitAll
@POST
public Response add(User entity) throws StorageException {
- User currentUser = permissionsService.getUser(getUserId());
- if (permissionsService.notAdmin(getUserId())) {
+ User currentUser = getUserId() > 0 ? permissionsService.getUser(getUserId()) : null;
+ if (currentUser == null || !currentUser.getAdministrator()) {
permissionsService.checkUserUpdate(getUserId(), new User(), entity);
if (currentUser != null && currentUser.getUserLimit() != 0) {
int userLimit = currentUser.getUserLimit();