diff options
-rw-r--r-- | juick-api/src/main/java/com/juick/api/controllers/Messages.java | 2 | ||||
-rw-r--r-- | juick-api/src/main/java/com/juick/api/controllers/Post.java | 2 | ||||
-rw-r--r-- | juick-core/src/main/java/com/juick/User.java | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/security/entities/AnonymousUser.java (renamed from juick-server/src/main/java/com/juick/server/security/entities/AnonymUser.java) | 10 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/util/UserUtils.java | 4 |
6 files changed, 11 insertions, 11 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java index 2ccdcf9a..d50620ff 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java @@ -59,7 +59,7 @@ public class Messages { public ResponseEntity<List<com.juick.Message>> getHome( @RequestParam(defaultValue = "0") int before_mid) { User visitor = UserUtils.getCurrentUser(); - if (!visitor.isAnonym()) { + if (!visitor.isAnonymous()) { int vuid = visitor.getUid(); List<Integer> mids = messagesService.getMyFeed(vuid, before_mid); diff --git a/juick-api/src/main/java/com/juick/api/controllers/Post.java b/juick-api/src/main/java/com/juick/api/controllers/Post.java index 606b5e82..853a60ff 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Post.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Post.java @@ -59,7 +59,7 @@ public class Post { @RequestParam(required = false) MultipartFile attach) throws IOException { User visitor = UserUtils.getCurrentUser(); - if (visitor.isAnonym()) + if (visitor.isAnonymous()) throw new HttpForbiddenException(); if (body == null || body.length() < 1 || body.length() > 4096) { diff --git a/juick-core/src/main/java/com/juick/User.java b/juick-core/src/main/java/com/juick/User.java index 84f2b396..b44ea9e2 100644 --- a/juick-core/src/main/java/com/juick/User.java +++ b/juick-core/src/main/java/com/juick/User.java @@ -187,7 +187,7 @@ public class User { @XmlTransient @JsonIgnore - public boolean isAnonym() { + public boolean isAnonymous() { return false; } } diff --git a/juick-server/src/main/java/com/juick/server/security/entities/AnonymUser.java b/juick-server/src/main/java/com/juick/server/security/entities/AnonymousUser.java index 2cc692a2..5ee9527f 100644 --- a/juick-server/src/main/java/com/juick/server/security/entities/AnonymUser.java +++ b/juick-server/src/main/java/com/juick/server/security/entities/AnonymousUser.java @@ -5,10 +5,10 @@ import com.juick.User; /** * Created by aalexeev on 12/11/16. */ -public final class AnonymUser extends User { - public static final AnonymUser INSTANCE = new AnonymUser(); +public final class AnonymousUser extends User { + public static final AnonymousUser INSTANCE = new AnonymousUser(); - private AnonymUser() { + private AnonymousUser() { super.setUid(getUid()); super.setName(getName()); super.setAvatar(getAvatar()); @@ -23,7 +23,7 @@ public final class AnonymUser extends User { @Override public boolean equals(Object obj) { - return obj == this || obj instanceof AnonymUser; + return obj == this || obj instanceof AnonymousUser; } @Override @@ -82,7 +82,7 @@ public final class AnonymUser extends User { } @Override - public boolean isAnonym() { + public boolean isAnonymous() { return true; } diff --git a/juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java b/juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java index 596c95d1..f49be1e2 100644 --- a/juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java +++ b/juick-server/src/main/java/com/juick/server/security/entities/JuickUser.java @@ -19,7 +19,7 @@ public class JuickUser implements UserDetails { public static final List<GrantedAuthority> USER_AUTHORITY = Collections.singletonList(ROLE_USER); public static final List<GrantedAuthority> ANONYM_AUTHORITY = Collections.singletonList(ROLE_ANONYM); - public static final JuickUser ANONYM_USER = new JuickUser(AnonymUser.INSTANCE, ANONYM_AUTHORITY); + public static final JuickUser ANONYM_USER = new JuickUser(AnonymousUser.INSTANCE, ANONYM_AUTHORITY); private final com.juick.User user; private final Collection<? extends GrantedAuthority> authorities; diff --git a/juick-server/src/main/java/com/juick/util/UserUtils.java b/juick-server/src/main/java/com/juick/util/UserUtils.java index 8be415c9..3d78b5b5 100644 --- a/juick-server/src/main/java/com/juick/util/UserUtils.java +++ b/juick-server/src/main/java/com/juick/util/UserUtils.java @@ -1,7 +1,7 @@ package com.juick.util; import com.juick.User; -import com.juick.server.security.entities.AnonymUser; +import com.juick.server.security.entities.AnonymousUser; import com.juick.server.security.entities.JuickUser; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; @@ -44,6 +44,6 @@ public class UserUtils { if (principal instanceof User) return (User) principal; - return AnonymUser.INSTANCE; + return AnonymousUser.INSTANCE; } } |