From 5f3cfe57e4a70cb56f8984e962a5217465da4b92 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 22 Oct 2017 15:39:17 +0300 Subject: api: /users without params now return current authenticated user --- juick-api/src/main/java/com/juick/api/controllers/Users.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'juick-api/src/main/java/com') diff --git a/juick-api/src/main/java/com/juick/api/controllers/Users.java b/juick-api/src/main/java/com/juick/api/controllers/Users.java index 4881d841..dc8ebc84 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Users.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Users.java @@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*; import javax.inject.Inject; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -65,6 +66,9 @@ public class Users { if (!users.isEmpty()) return users; + if (!UserUtils.getCurrentUser().isAnonymous()) { + return Collections.singletonList(UserUtils.getCurrentUser()); + } throw new HttpNotFoundException(); } -- cgit v1.2.3