1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-13 01:36:18 +00:00

#85: Login as guest

This commit is contained in:
jendib
2016-05-29 16:37:26 +02:00
parent ead01ce1d0
commit d7865cfaf0
7 changed files with 125 additions and 38 deletions

View File

@@ -59,4 +59,9 @@ public class AnonymousPrincipal implements IPrincipal {
public Set<String> getGroupIdSet() {
return Sets.newHashSet();
}
@Override
public boolean isGuest() {
return false;
}
}

View File

@@ -18,6 +18,13 @@ public interface IPrincipal extends Principal {
*/
boolean isAnonymous();
/**
* Checks if the principal is a guest.
*
* @return True if the principal is a guest
*/
boolean isGuest();
/**
* Returns the ID of the connected user, or null if the user is anonymous
*

View File

@@ -2,6 +2,7 @@ package com.sismics.security;
import java.util.Set;
import com.sismics.docs.core.constant.Constants;
import org.joda.time.DateTimeZone;
/**
@@ -108,4 +109,9 @@ public class UserPrincipal implements IPrincipal {
public void setGroupIdSet(Set<String> groupIdSet) {
this.groupIdSet = groupIdSet;
}
@Override
public boolean isGuest() {
return Constants.GUEST_USER_ID.equals(id);
}
}