|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.Prominic.jFTPd.FTPSecuritySource
com.Prominic.jFTPd.FTPUserListSecuritySource
public class FTPUserListSecuritySource
This class implements a security source based on the users.dat file. It was initially used to force users to stay in their home directory (they are not allowed to access directories outside the home directories) but all the canXXXXXXX methods return true because a java policy is in place to limit their access and a single method in FTPConnection handles the check. This class is now helpfull for only reading the users.dat file.
Field Summary | |
---|---|
static int |
BASIC_FORMAT
users.dat format for very old jFTPd releases (backwards compatibility). |
private int |
currentFormat
|
private static boolean |
DEBUG
|
private java.lang.String |
defaultGroup
|
private java.lang.String |
defaultMask
|
private java.lang.String |
defaultOwner
|
private java.lang.String |
defaultReadAccess
|
protected static java.lang.String |
FIELD_DELIMITER
|
static int |
OWNERGROUP_FORMAT
users.dat format for current jFTPd release. |
(package private) long |
updateInterval
|
(package private) java.lang.Thread |
updaterThread
|
protected java.lang.String |
userFilename
|
protected java.util.Hashtable |
userTable
|
Fields inherited from class com.Prominic.jFTPd.FTPSecuritySource |
---|
ANONYMOUS_USERNAME |
Constructor Summary | |
---|---|
FTPUserListSecuritySource(java.lang.String filename,
int format)
Creates a security source based on the users.dat file. |
Method Summary | |
---|---|
boolean |
canDelete(FTPUser user,
java.lang.String path)
Implement this if the given user can delete the specified path. |
boolean |
canDownload(FTPUser user,
java.lang.String path)
Implement this if the given user can download from the specified path. |
boolean |
canRename(FTPUser user,
java.lang.String frompath,
java.lang.String topath)
Implement this if the given user can rename the specified path. |
boolean |
canUpload(FTPUser user,
java.lang.String path)
Implement this if the given user can upload to the specified path. |
java.lang.String |
getDefaultGroup()
Returns the default group for all the jFTPd users (this is needed when a user doesn't have its group specified in the users.dat file). |
java.lang.String |
getDefaultMask()
Returns the default file mask for all the jFTPd users (this is needed when a user doesn't have its file mask specified in the users.dat file). |
java.lang.String |
getDefaultOwner()
Returns the default owner for the files of all the jFTPd users (this is needed when a user doesn't have its files owner specified in the users.dat file). |
java.lang.String |
getDefaultReadAccess()
Returns the default read access specified in the configuration file. |
boolean |
isAnonymousUsername(java.lang.String username)
Checks if the user is anonymous as well as if the ANONYMOUS_USERNAME is defined in the users.dat file. |
protected java.util.Hashtable |
readUsersFromStream(java.io.InputStream in)
Reads the users list from a stream (which is the users.dat file). |
void |
run()
Starts this thread. |
(package private) void |
setCurrentFormat(int newCurrentFormat)
Sets the users.dat format (basic or ownergroup). |
void |
setDefaultGroup(java.lang.String newDefaultGroup)
Sets the default group for files belonging to the current user. |
void |
setDefaultMask(java.lang.String newDefaultMask)
Sets the default file mask for files belonging to the current user. |
void |
setDefaultOwner(java.lang.String newDefaultOwner)
Sets the default owner for files belonging to the current user. |
void |
setDefaultReadAccess(java.lang.String newDefaultReadAccess)
Sets the default read access for files belonging to the current user. |
void |
startUpdating(long t)
Starts FTPUserListSecuritySource as a thread which will run at the given interval and reread the users.dat file. |
void |
stopUpdating()
Stops the updater thread. |
void |
updateUserList()
Reads the users.dat file from disk and builds up the internal user hashtable. |
FTPUser |
userWithUsernameAndPassword(java.lang.String username,
java.lang.String password)
Creates an FTPUser based on the username and password. |
Methods inherited from class com.Prominic.jFTPd.FTPSecuritySource |
---|
isValidEmail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
protected static final java.lang.String FIELD_DELIMITER
protected java.lang.String userFilename
protected java.util.Hashtable userTable
java.lang.Thread updaterThread
long updateInterval
public static int BASIC_FORMAT
public static int OWNERGROUP_FORMAT
private int currentFormat
private java.lang.String defaultOwner
private java.lang.String defaultReadAccess
private java.lang.String defaultGroup
private java.lang.String defaultMask
Constructor Detail |
---|
public FTPUserListSecuritySource(java.lang.String filename, int format) throws java.io.IOException
filename
- - path to users.dat file.format
- - whether the format is a basic one (for very old jFTPd releases) or an advanced one.
java.io.IOException
Method Detail |
---|
public boolean canDelete(FTPUser user, java.lang.String path)
FTPSecuritySource
canDelete
in class FTPSecuritySource
user
- - userpath
- - path to be deleted
public boolean canDownload(FTPUser user, java.lang.String path)
FTPSecuritySource
canDownload
in class FTPSecuritySource
user
- - userpath
- - path
public boolean canRename(FTPUser user, java.lang.String frompath, java.lang.String topath)
FTPSecuritySource
canRename
in class FTPSecuritySource
user
- - userfrompath
- - path to be renamedtopath
- - new path
public boolean canUpload(FTPUser user, java.lang.String path)
FTPSecuritySource
canUpload
in class FTPSecuritySource
user
- - userpath
- - path where upload should be done
public java.lang.String getDefaultGroup()
public java.lang.String getDefaultMask()
public java.lang.String getDefaultOwner()
public java.lang.String getDefaultReadAccess()
public boolean isAnonymousUsername(java.lang.String username)
isAnonymousUsername
in class FTPSecuritySource
username
- - username
protected java.util.Hashtable readUsersFromStream(java.io.InputStream in) throws java.io.IOException
in
- - stream with users list
java.io.IOException
public void run()
run
in interface java.lang.Runnable
void setCurrentFormat(int newCurrentFormat)
newCurrentFormat
- int - new format.public void setDefaultGroup(java.lang.String newDefaultGroup)
newDefaultGroup
- java.lang.Stringpublic void setDefaultMask(java.lang.String newDefaultMask)
newDefaultOwner
- java.lang.Stringpublic void setDefaultOwner(java.lang.String newDefaultOwner)
newDefaultOwner
- java.lang.Stringpublic void setDefaultReadAccess(java.lang.String newDefaultReadAccess)
newDefaultReadAccess
- java.lang.Stringpublic void startUpdating(long t)
t
- - interval.public void stopUpdating()
public void updateUserList()
public FTPUser userWithUsernameAndPassword(java.lang.String username, java.lang.String password)
FTPSecuritySource
userWithUsernameAndPassword
in class FTPSecuritySource
username
- - usernamepassword
- - password.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |