Holger's
Java API

com.antelmann.db
Class UserFilter

java.lang.Object
  extended by com.antelmann.db.UserFilter
All Implemented Interfaces:
Filter<User>

public class UserFilter
extends Object
implements Filter<User>

a simple user filter that conveniently allows to define acceptance based on rights

Since:
26.07.2013, 11:37:06
Author:
holger

Field Summary
 
Fields inherited from interface com.antelmann.util.Filter
EXCLUDE_ALL_FILTER, INCLUDE_ALL_FILTER
 
Constructor Summary
UserFilter()
           
UserFilter(boolean onlyEnabled, Object... requiredRights)
           
 
Method Summary
 boolean accept(User user)
          returns true only if the given entry is accepted by this filter
 UserFilter add(Object... optionalRequiredRights)
           
 UserFilter addDisjunctRights(Object... rights)
          for a user to pass this filter, only one of the given rights must be accessible
 boolean addOptionalRights(Object... rights)
          all of the given rights must be accessible by the user to pass this filter.
 void checkAccess(User user)
          convenience method that throws an exception if this filter doesn't accept the given user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserFilter

public UserFilter()

UserFilter

public UserFilter(boolean onlyEnabled,
                  Object... requiredRights)
Method Detail

addDisjunctRights

public UserFilter addDisjunctRights(Object... rights)
for a user to pass this filter, only one of the given rights must be accessible

See Also:
addOptionalRights(Object...)

add

public UserFilter add(Object... optionalRequiredRights)
See Also:
addOptionalRights(Object...)

addOptionalRights

public boolean addOptionalRights(Object... rights)
all of the given rights must be accessible by the user to pass this filter. If you call this method multiple times, the conditions are combined as 'or', so these required rights are disjunct to configured other rights of this instance.


checkAccess

public void checkAccess(User user)
                 throws SecurityException
convenience method that throws an exception if this filter doesn't accept the given user

Throws:
SecurityException - if this filter doesn't accept the given user

accept

public boolean accept(User user)
Description copied from interface: Filter
returns true only if the given entry is accepted by this filter

Specified by:
accept in interface Filter<User>


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads