Change the meaning of holdsToken(): now the token(s) specified must be
EXACTLY held. I think this is ok because all callers currently pass a single token at a time, but I have not verified this for every project. Please verify this for your project! Added holdsAnyToken() which has the old behavior of returning true if any bit is on. I think we should change all the projects' various isSupportPlus() methods to be just called isSupport() and those will return holdsAnyToken(SUPPORT | ADMIN | etc); If you need to check if a user has a single SUPPORT token but is not an admin, you can do that by hand. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4617 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -74,11 +74,22 @@ public class TokenRing extends SimpleStreamableObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this token ring contains the specified token.
|
||||
* Returns true if this token ring contains the specified token or tokens,
|
||||
* exactly.
|
||||
* For example, if you pass in the OR of two or more tokens,
|
||||
* then the ring must contain all of those tokens.
|
||||
*/
|
||||
public function holdsToken (token :int) :Boolean
|
||||
{
|
||||
return (_tokens & token) != 0;
|
||||
return (_token & token) == token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this token ring contains any one of the specified tokens.
|
||||
*/
|
||||
public function holdsAnyToken (tokens :int) :Boolean
|
||||
{
|
||||
return (_tokens & tokens) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,11 +49,22 @@ public class TokenRing extends SimpleStreamableObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this token ring contains the specified token.
|
||||
* Returns true if this token ring contains the specified token or tokens,
|
||||
* exactly.
|
||||
* For example, if you pass in the OR of two or more tokens,
|
||||
* then the ring must contain all of those tokens.
|
||||
*/
|
||||
public boolean holdsToken (int token)
|
||||
{
|
||||
return (_tokens & token) != 0;
|
||||
return (_tokens & token) == token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this token ring contains any one of the specified tokens.
|
||||
*/
|
||||
public boolean holdsAnyToken (int tokens)
|
||||
{
|
||||
return (_tokens & tokens) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user