org.apache.wicket.examples.authorization
Class User

java.lang.Object
  extended by org.apache.wicket.examples.authorization.User
All Implemented Interfaces:
java.io.Serializable, IClusterable

public class User
extends java.lang.Object
implements IClusterable

Simple user object.

Author:
Eelco Hillenius
See Also:
Serialized Form

Constructor Summary
User(java.lang.String uid, java.lang.String roles)
          Construct.
 
Method Summary
 java.lang.String getUid()
          Gets the uid.
 boolean hasAnyRole(Roles roles)
          Whether this user has any of the given roles.
 boolean hasRole(java.lang.String role)
          Whether this user has the given role.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User(java.lang.String uid,
            java.lang.String roles)
Construct.

Parameters:
uid - the unique user id
roles - a comma seperated list of roles (e.g. USER,ADMIN)
Method Detail

hasRole

public boolean hasRole(java.lang.String role)
Whether this user has the given role.

Parameters:
role -
Returns:
whether this user has the given role

hasAnyRole

public boolean hasAnyRole(Roles roles)
Whether this user has any of the given roles.

Parameters:
roles - set of roles
Returns:
whether this user has any of the given roles

getUid

public java.lang.String getUid()
Gets the uid.

Returns:
the uid

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.