CrushFTP provides a plugin interface where you can develop your own third party plugins.

.

There are a few hooks into CrushFTP that the plugins get. Plugins are run synchronously, so if you are going to do something that will take a while, multi thread it off. While I won't likely change how these hooks are called, I may be willing to add additional hooks if your situation demonstrates it would be beneficial.

Hook#1 When the user logs in there is a hook to make up a user from the plugin before CrushFTP tries to verify the user in its internal system. This is how the SQL & LDAP plugins work. The action is "login".

Hook#2 Once the login has been verified, there is an action of "afterLogin" called for any manipulations that need to be done to the user before anything else happens. This is where the HomeDirectory plugin modifies the directory access and generates the appropriate directory. This hook includes the special item "uVFSObject" which is the CrushFTP class crushftp.server.VFS. See the HomeDirectory for how to use this.

Hook#3 When any action is done, an access check is performed. There is a hook provided here where the plugin will be called with an action of "access".

Hook#4 When any listing is produced, an action of "list" will be called passing in the listing object. (FTP,HTTP,WebDAV)

Hook#5 For FTP only: when a command is issued, an action of "beforeCommand" as well as "afterCommand" is called. This can be used to filter commands out, or to do specific actions. If you respond to the command, be sure to clear out the command so CrushFTP doesn't also try and respond and put the FTP client out of sync.

To access a download, disconnect, upload type situation, use the event interface of a user and specify your plugin to be called in those types of events.

What can I do? Virtually all info about a user is passed to the plugin when its called. If you edit a string item directly in the object that is called, nothing will happen. However, pulling out any of the "Properties" objects and changing values there will cause immediate results as that is how everything internally is referenced.

To learn the structure of things, I recommend printing it out to system out or logging it in some way. Then look through it to find what you are interested in.

.

When a plugin is packaged up to be deployed into CrushFTP, there must be a minimum of two classes. Start, and GUI. These two classes must be in the base package that is the same name and case as the plugin. For example, CrushSQL is named CrushSQL.jar. Start and GUI are at: /CrushSQL/Start.java and /CrushSQL/GUI.java. You are free to have any other classes you want as well, just those two must exist and must have the required methods in them.

Examples:

WebApplication Source

HomeDirectory Source

FilterCommand Source

CrushSQL Source

DiskUsage

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-11) was last changed on 09-Oct-2016 18:14 by Ben Spink
G’day (anonymous guest)
JSPWiki v2.8.2