com.Prominic.jFTPd
Class FTPAnonSecuritySource

java.lang.Object
  extended by com.Prominic.jFTPd.FTPSecuritySource
      extended by com.Prominic.jFTPd.FTPAnonSecuritySource

public class FTPAnonSecuritySource
extends FTPSecuritySource

Implements anonymous access security check. Anonymouse user can:
- have access to certain directories
- read or read/write access
- upload access.

Author:
VIulian

Field Summary
protected  boolean canDelete
           
protected  boolean canDownload
           
protected  boolean canUpload
           
protected  boolean validateEmail
           
protected  java.util.Hashtable virtualDirs
           
 
Fields inherited from class com.Prominic.jFTPd.FTPSecuritySource
ANONYMOUS_USERNAME
 
Constructor Summary
FTPAnonSecuritySource(java.util.Hashtable dirs)
          Createn a security source for an read only anonymous access given the specified directories.
FTPAnonSecuritySource(java.util.Hashtable dirs, boolean down, boolean up, boolean del)
          Creates a security source, letting you control various aspects of the anonymous access.
FTPAnonSecuritySource(java.util.Hashtable dirs, boolean down, boolean up, boolean del, boolean val)
          Creates a security source, letting you control various aspects of the anonymous access.
 
Method Summary
 boolean canDelete(FTPUser user, java.lang.String path)
          Returns true if the user can delete files from the given path.
 boolean canDownload(FTPUser user, java.lang.String path)
          Returns true if the user can download files from the given path.
 boolean canRename(FTPUser user, java.lang.String frompath, java.lang.String topath)
          Returns true if the user can rename files from the given path to the given path.
 boolean canUpload(FTPUser user, java.lang.String path)
          Implement this if the given user can upload to the specified path.
 FTPUser userWithUsernameAndPassword(java.lang.String username, java.lang.String password)
          Returns an FTPUser object for the given username and password.
 
Methods inherited from class com.Prominic.jFTPd.FTPSecuritySource
isAnonymousUsername, isValidEmail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canUpload

protected boolean canUpload

canDownload

protected boolean canDownload

canDelete

protected boolean canDelete

validateEmail

protected boolean validateEmail

virtualDirs

protected java.util.Hashtable virtualDirs
Constructor Detail

FTPAnonSecuritySource

public FTPAnonSecuritySource(java.util.Hashtable dirs)
Createn a security source for an read only anonymous access given the specified directories. No email validation will be done.

Parameters:
dirs - - home directories.

FTPAnonSecuritySource

public FTPAnonSecuritySource(java.util.Hashtable dirs,
                             boolean down,
                             boolean up,
                             boolean del)
Creates a security source, letting you control various aspects of the anonymous access. No email validation will be done.

Parameters:
dirs - - home directories
down - - set true if the user can download (read access).
up - - set true if the user can upload (write access).
del - - set true if the user can delete files

FTPAnonSecuritySource

public FTPAnonSecuritySource(java.util.Hashtable dirs,
                             boolean down,
                             boolean up,
                             boolean del,
                             boolean val)
Creates a security source, letting you control various aspects of the anonymous access. No email validation will be done.

Parameters:
dirs - - home directories
down - - set true if the user can download (read access).
up - - set true if the user can upload (write access).
del - - set true if the user can delete files
val - - set true if email validation should be done.
Method Detail

canDelete

public boolean canDelete(FTPUser user,
                         java.lang.String path)
Returns true if the user can delete files from the given path.

Specified by:
canDelete in class FTPSecuritySource
Parameters:
user - - user
path - - path to be deleted
Returns:
- true if user can delete the specified path.

canDownload

public boolean canDownload(FTPUser user,
                           java.lang.String path)
Returns true if the user can download files from the given path.

Specified by:
canDownload in class FTPSecuritySource
Parameters:
user - - user
path - - path
Returns:
- true if user can download from the specified path.

canRename

public boolean canRename(FTPUser user,
                         java.lang.String frompath,
                         java.lang.String topath)
Returns true if the user can rename files from the given path to the given path.

Specified by:
canRename in class FTPSecuritySource
Parameters:
user - - user
frompath - - path to be renamed
topath - - new path
Returns:
- true if user can rename the specified path.

canUpload

public boolean canUpload(FTPUser user,
                         java.lang.String path)
Description copied from class: FTPSecuritySource
Implement this if the given user can upload to the specified path.

Specified by:
canUpload in class FTPSecuritySource
Parameters:
user - - user
path - - path where upload should be done
Returns:
- true if user can upload there.

userWithUsernameAndPassword

public FTPUser userWithUsernameAndPassword(java.lang.String username,
                                           java.lang.String password)
Returns an FTPUser object for the given username and password. If the username is anonymous, then the object will be null.

Specified by:
userWithUsernameAndPassword in class FTPSecuritySource
Parameters:
username - - username
password - - password.
Returns:
FTPUser - object representing the username and password or null if anonymous.