diff options
author | 2018-05-10 15:04:57 +0300 | |
---|---|---|
committer | 2018-05-10 15:04:57 +0300 | |
commit | b642c55f053583533e23b1fc7fc5ac318fcbd7f0 (patch) | |
tree | 3255d68fe48ee38aeba6de4359c631f9b9ddf70f /juick-server/src/main/java/com/juick/server/api/Users.java | |
parent | 78bc4cd5b9383320e989183942ba9ca11252a917 (diff) |
using User::isAnonymous where possible
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api/Users.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/Users.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Users.java b/juick-server/src/main/java/com/juick/server/api/Users.java index 8b273354..3e546eac 100644 --- a/juick-server/src/main/java/com/juick/server/api/Users.java +++ b/juick-server/src/main/java/com/juick/server/api/Users.java @@ -69,13 +69,12 @@ public class Users { public List<User> doGetUserRead( @RequestParam String uname) { User visitor = UserUtils.getCurrentUser(); - int vuid = visitor.getUid(); - if (vuid == 0) { + if (visitor.isAnonymous()) { throw new HttpForbiddenException(); } int uid = 0; if (uname == null) { - uid = vuid; + uid = visitor.getUid(); } else { if (WebUtils.isUserName(uname)) { com.juick.User u = userService.getUserByName(uname); @@ -101,13 +100,12 @@ public class Users { public List<User> doGetUserReaders( @RequestParam String uname) { User visitor = UserUtils.getCurrentUser(); - int vuid = visitor.getUid(); - if (vuid == 0) { + if (visitor.isAnonymous()) { throw new HttpForbiddenException(); } int uid = 0; if (uname == null) { - uid = vuid; + uid = visitor.getUid(); } else { if (WebUtils.isUserName(uname)) { com.juick.User u = userService.getUserByName(uname); |