Allow access to a BrowserCMS site via WebDAV. The primary intent of this module currently is to allow bulk upload of files using an FTP client. Clients which support WebDAV in addition to FTP may be used to review and upload/download Files. This module is implemented as as Rack Middleware.
For more information on WebDAV see: en.wikipedia.org/wiki/WebDAV
Authorized users can list pages, sections and files that exist in the content library.
Authorized users can download files via WebDAV.
Authorized users can upload files via WebDAV.
Users must have 'Administer CMS' permissions in order to access resources via WebDAV.
Users can use their normal cms username and password.
In order to take advantage of this module, users will need a WebDAV client. Many FTP clients will support this, including:
This module has been tested with both of the above client. In addition, operating systems support accessing WebDAV servers via mounted drives. See: en.wikipedia.org/wiki/WebDAV for more discussion.
Due to the dependancy on rack 1.1.0 or later, this gem only works with a Rails 2.3.11 project, so you may need to upgrade older rails projects before using.
gem install bcms_webdav
Add the gem to your project.
# config/environment.rb config.gem 'dav4rack' config.gem 'bcms_webdav'
Add the following file to your project.
# config/initializers/bcms_webdav.rb Rails.configuration.middleware.use ::, :port=>3001
This configures the WebDAV server to listen on port 3001 for WeDAV requests in development. To access the WebDAV API, you will need to start another rails server instance like so:
In production, a subdomain should be used rather than a port. You will need to configure another subdomain on your webserver, much like the cms. subdomain is used for the admin interface. The default subdomain is 'webdav'. Here's an example apache config file, with a new subdomain configured:
<VirtualHost *:80> ServerName webdav.mysite.com DocumentRoot "/var/sites/mysite/public" RailsEnv production <directory "/var/sites/mysite/public"> Order allow,deny Allow from all </directory> </VirtualHost>
This means there should be a total of three domains in place for a site in production:
www - Main site accessed by the public
cms - Site access for administrators
webdav - Site access via WebDAV
You can change the subdomain that this module listens for requests on via:
# config/initializers/bcms_webdav.rb Rails.configuration.middleware.use ::, :port=>3001, :subdomain=>"dav"
This would change the subdomain from 'webdav' to 'dav'. This webserver config file would also need to be changed as well.
Subdomains in Development
Rather than run two server instances locally, you can take advantage of subdomains. Start by modifying your 'hosts' file to make 'webdav.localhost' map to your local development environment, like so:
Then configure the module so its no longer listening on port 3001, like so:
# config/initializers/bcms_webdav.rb Rails.configuration.middleware.use ::
Now you can make web requests to localhost:3000 and WebDAV requests to webdav.localhost:3000
This is an incomplete implementation of WebDAV, so many operations are not explicitly supported, such as:
Moving - Users cannot move files or pages.
Get/Put Pages/sections - Users can't download or upload pages or sections.
Edit/Create Pages/section - Users can't edit/rename or create new sections.
All files are uploaded as 'FileBlocks', regardless of whether they are images or not.
All content_types are set to 'application/octet-stream' regardless of their actual type.
This module almost certainly needs performance testing when dealing with larger sites. Certain FTP clients will make more requests for resources than others. (CrossFTP seems 'chattier' than Transmit for instance).