diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-28 07:19:24 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-28 07:19:24 -0700 |
commit | 3c48c66cf55705274ff482cf3deefee11196ddfe (patch) | |
tree | 10787a92e489fcb31e482eaff9cfae6ca3f97d9b /src/main | |
parent | 08d634d984c1388c3919d7c6645506b202307dac (diff) | |
download | trackermap-server-3c48c66cf55705274ff482cf3deefee11196ddfe.tar.gz trackermap-server-3c48c66cf55705274ff482cf3deefee11196ddfe.tar.bz2 trackermap-server-3c48c66cf55705274ff482cf3deefee11196ddfe.zip |
Fix user registration
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/api/resource/UserResource.java | 4 |
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(); |