Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-11) was last changed on 29-Dec-2020 05:25 by Ben Spink

This page was created on 29-Dec-2020 05:25 by Ben Spink

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 2 added 43 lines
.
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]
Version Date Modified Size Author Changes ... Change note
11 29-Dec-2020 05:25 2.923 kB Ben Spink to previous
10 29-Dec-2020 05:25 2.891 kB Ben Spink to previous | to last
9 29-Dec-2020 05:25 3.226 kB Ben Spink to previous | to last
8 29-Dec-2020 05:25 17.876 kB Ben Spink to previous | to last
7 29-Dec-2020 05:25 17.846 kB Ben Spink to previous | to last
6 29-Dec-2020 05:25 3.231 kB Ben Spink to previous | to last
5 29-Dec-2020 05:25 3.233 kB Ben Spink to previous | to last
4 29-Dec-2020 05:25 3.228 kB Ben Spink to previous | to last
3 29-Dec-2020 05:25 2.416 kB Ben Spink to previous | to last
2 29-Dec-2020 05:25 2.346 kB Ben Spink to previous | to last
1 29-Dec-2020 05:25 0.09 kB Ben Spink to last
« This page (revision-11) was last changed on 29-Dec-2020 05:25 by Ben Spink
G’day (anonymous guest)
CrushFTP10 | What's New
JSPWiki