Name

Bric::Util::FTP::Server - Virtual FTP Server

Synopsis

use Bric::Util::FTP::Server;
Bric::Util::FTP::Server->run;

Description

This module provides an FTP interface to Bricolage templates. The directory tree is the category tree created in Bricolage. The first directory level selects the output channel. The files are the template files in the output channels and categories. When a user downloads a template file they recieve the most recent checked-in version of the template. When a file is uploaded it is automatically checked-in and deployed.

For installation and configuration instructions see Bric::Admin.

Limitations

Only GET, PUT and DELETE are implemented for templates. No modification of categories is supported.

The system doesn't deal with the possibility of having more than one active template for a given filename. This probably won't be fixed here - rather, Bricolage will soon prevent this situation.

Interface

This module inherits from Net::FTPServer and doesn't override any public methods. See Net::FTPServer for details.

Private

Private Instance Methods

pre_configuration_hook()

This is called by Net:FTPServer before configuration begins. It's used in this class to add our name and version to the version string displayed by the server.

authenticaton_hook($user, $pass, $user_is_anon)

When a user logs in authentication_hook() is called to check their username and password. This method calls Bric::Biz::Person::User->lookup() using the given username and then checks the password. Returns -1 on login failure or 0 on success. As a side-effect this method stashes the Bric::Biz::Person::User object into $self->{user_obj}.

root_directory_hook()

Net::FTPServer calls this method to get a DirHandle for the root directory. This method just calls Bric::Util::FTP::DirHandle->new().

system_error_hook()

This method is called when an error is signaled elsewhere in the server. It looks for a key called "error" in $self and returns that if it's available. This allows for an OO version of the ever-popular $! mechanism. (Or, at least, that's the idea. As far as I can tell it never really gets called!)

post_bind_hook()

This method is called after the control port is bound but before starting the accept infinite loop block. It's used in this class to become the Bricolage system user (but only if the FTP server was started by the root user).

process_limits_hook()

Overrides FTP::Server's implementation to ensure no limits are set. Better to just let the OS set them.

Author

Sam Tregar <stregar@about-inc.com>

See Also

Net::FTPServer

Bric::Util::FTP::DirHandle

Bric::Util::FTP::FileHandle