webidor/src/main/java/cz/xelfi/quoridor/webidor/User.java
branchstatistics-and-elo
changeset 178 4b78d4f028b3
parent 171 524c7f359c4e
     1.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/User.java	Wed Dec 23 07:59:16 2009 +0100
     1.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/User.java	Thu Jan 07 22:34:17 2010 +0100
     1.3 @@ -90,6 +90,23 @@
     1.4          return permissions.contains(permission);
     1.5      }
     1.6  
     1.7 +    public static boolean canSee(GameId gId, String userId) {
     1.8 +        if (!gId.isFinished()) {
     1.9 +            return true;
    1.10 +        }
    1.11 +        if (userId.equals(gId.getWhite())) {
    1.12 +            return true;
    1.13 +        }
    1.14 +        if (userId.equals(gId.getBlack())) {
    1.15 +            return true;
    1.16 +        }
    1.17 +        return false;
    1.18 +    }
    1.19 +
    1.20 +    public boolean canSee(GameId gId){
    1.21 +        return canSee(gId, id);
    1.22 +    }
    1.23 +
    1.24      public String getId() {
    1.25          return id;
    1.26      }