Simple Groupware WebDAV Server

The WebDAV server was removed in 0.800. Clients for Dropbox and Google Drive offer much better performance, including offline usage.

The Simple Groupware WebDAV server is designed to work mainly with Windows XP's builtin WebDAV client (called "Mini-Redirector"). The Mini-Redirector allows to mount a WebDAV server directly to a drive letter in the Windows system. That means all applications can directly work with it just like a local hard disk.
For example, users can double-click a file in the Windows Explorer and the default application assigned for this file type opens and displays the file. In the background, this file gets automatically downloaded from the Simple Groupware WebDAV server.
If a user saves the file in the application, the file gets automatically uploaded and a new version is created on the Simple Groupware server.

Screenshots


Simple Groupware WebDAV file Server
WebDAV file server
Simple Groupware WebDAV file versioning
WebDAV file versioning


WebDAV installation on the server (running Simple Groupware)


Using Simple Groupware as a WebDAV server requires the module mod_rewrite to be loaded in the Apache webserver.
In case you're not sure if the module is already loaded in your configuration, open your browser with Simple Groupware. Then log in as super administrator and click "Phpinfo" in the administration page. In the section "apache2handler", you'll find a parameter called "Loaded Modules" which should contain "mod_rewrite". If it is not there then you need to do the following at the command line (Debian/Ubuntu):

sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
sudo /etc/init.d/apache2 restart

This will provide the necessary hard link to activate mod_rewrite. Go back and check with PhpInfo that the module is now loaded.

Then copy the file "<sgs-dir>/src/tools/webdav/webdav.htaccess" to the webserver's document root folder and rename it to ".htaccess". The document root is the folder representing the location "http://<your-server>/". Next edit the ".htaccess" file and replace "/sgs/bin/" with the right relative path in your system. For example, if your Simple Groupware URL is "http://<your-server>/sg/bin/index.php", then replace "/sgs/bin/" with "/sg/bin/". Finally open your browser with "http(s)://<your-server>/sgdav/test". If everything is working correctly, the page displays "ok". If not, you might check the location of .htaccess and take a look at Apache's error logfile.

Note: If your Apache server is not processing .htaccess files by default, you might need to add "AllowOverride All" inside the <Directory>-tag describing the document root in "httpd.conf". For Debian/Ubuntu, please edit "/etc/apache2/sites-available/default" and restart Apache, for example:

<Directory /var/www/>
  Options FollowSymLinks
  AllowOverride All
  Order allow,deny
  allow from all
</Directory>

Note: In most systems, the document root folder is named "htdocs" or "/var/www". Also the document root folder is what you get if you open your browser with "http(s)://<your-server>/".

Note: The Simple Groupware WebDAV server only works with the Apache webserver and the "mod_rewrite" module. Microsoft's Internet Information Server (IIS) can't be used because it does not include mod_rewrite.

Note: If you open your browser with "http(s)://<your-server>/sgdav/", you'll get a 404 (file not found) error. Please remember that a browser is not a WebDAV client. A browser uses the GET method to list a directory, a WebDAV client uses PROPFIND and initiates the connection normally with a OPTIONS command.

Note: When using Windows Explorer (Mini-Redirector) as WebDAV client, the anonymous login is used by default. So you need to disable anonymous logins in Simple Groupware. Therefore log in as super administrator, click "Change Setup Settings", un-check "Enable anonymous access" and click "Save".


WebDAV installation on the client (Windows XP)


By default, the Mini-Redirector uses Digest authentication which is not compatible with Simple Groupware. But you can change this to Basic authentication in the client's registry. The file "winxp_webdav.reg" is included in the Simple Groupware package under "\src\tools\webdav\". It should be executed with administrator privileges and requires a restart afterwards. It changes the following setting in the Windows registry (click here for more information):

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters]
"UseBasicAuth"=dword:00000001


Also, the Mini-Redirector included in Windows XP only supports port 80. If your server is only available on SSL, you can use a tool called "stunnel" to provide the missing SSL client. Windows binaries can be downloaded here. Then run "stunnel <config-file>" on the client. The config file should contain:

client=yes
verify=0
[psuedo-https]
accept = 80
connect = <your-sgs-server>:443
TIMEOUTclose = 0

Replace <your-sgs-server> with the IP or the DNS name of your Simple Groupware Server. Using this configuration, stunnel maps the port "<your-sgs-server>:443" to "localhost:80" and handles all the SSL stuff. That also implies that port 80 is not used by another program on the client. After running stunnel, you can mount the driver letter with "http://localhost/sgdav/".


WebDAV installation on the client (Windows Vista)


By default, the Mini-Redirector uses Digest authentication which is not compatible with Simple Groupware. But you can change this to Basic authentication in the client's registry. The file "vista_webdav.reg" is included in the Simple Groupware package under "\src\tools\webdav\". It should be executed with administrator privileges and requires a restart afterwards. It changes the following setting in the Windows registry (click here for more information):

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters]
"BasicAuthLevel"=dword:00000002

The Mini-Redirector included in Windows Vista fully supports SSL and the port can be different from 80.

To test your settings from the registry, you can open 1 (!!) connection to the Simple Groupware website (password cmscms):

net use z: http://www.simple-groupware.de/sgdav/ /user:cms *


WebDAV installation on the client (Windows 7)


On Windows 7, all requests to WebDAV receive a 3 second delay in the Windows explorer. This makes WebDAV in Windows7 Explorer extremely slow. To fix this, you'll need to change IE's proxy settings:

Open IE -> Go to Tools menu -> Internet Options -> Connections -> LAN settings -> Un-check Automatically detect settings -> Click Ok -> Click Ok

By default, the Mini-Redirector uses Digest authentication which is not compatible with Simple Groupware. But you can change this to Basic authentication in the client's registry. The file "win7_webdav.reg" is included in the Simple Groupware package under "\src\tools\webdav\" and also turns off locking. It should be executed with administrator privileges and requires a restart afterwards. It changes the following settings in the Windows registry (click here for more information):

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters]
"BasicAuthLevel"=dword:00000002

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters] "SupportLocking"=dword:00000000

The Mini-Redirector included in Windows 7 fully supports SSL and the port can be different from 80.

To test your settings from the registry, you can open a connection to the Simple Groupware website (password cmscms):

net use z: http://www.simple-groupware.de/sgdav/ /user:cms *


Mount the WebDAV server to a drive letter (Windows XP / Vista)


First make sure the "WebClient" service is started:
Use "Start->Run->services.msc" and start the service "WebClient" if necessary

Then mount the folder structure to a drive letter:

Open Windows Explorer, click Tools->Map Network Drive
Choose a drive letter and define the "folder name" with: http://<your-sgs-server>/sgdav/
Click "Different user name" and enter your credentials
Then click "Finish".

Alternative: Mount with the commandline

net start webclient (if not started automatically)
net use s: http://<your-sgs-server>/sgdav/ /user:<username> *


WebDAV installation on the client (Linux)


Install the package davfs2 (at least version 1.2.1+). Example for Debian:

apt-get install davfs2/testing

In newer versions you might also need to disable the locking function: Therefore set "use_locks 0" in "/etc/davfs2/davfs2.conf".


Mount the WebDAV server to the directory tree (Linux)


Mount with the commandline:

mount -t davfs http://<your-sgs-server>/sgdav/ /mnt


If you disconnect your computer from the network, it is recommended to unmount the WebDAV connection before leaving:

unmount /mnt


Files and directories


The WebDAV folder structure is exactly the same as in the web interface of Simple Groupware. For better performance, mountpoints are not included.
There is only one difference: Windows sorts folders alphabetically. That means the order of the folders can differ from the order defined in Simple Groupware. All permissions assigned to folders and datasets take effect in WebDAV as well.

In Simple Groupware, files are appended to datasets. Every dataset can have several fields with the type "files". Also each field can have several files in one dataset. In order to identify a file, it is necessary to know the id of the dataset, the directory of the dataset, the name of the field in the dataset and the position of the file in the field. The complete filename syntax looks like this:

(Short) syntax:
<dataset-id>_<position>_filename.ext

Long syntax (for dataset fields not equal "filedata"):
<dataset-id>_<dataset-field>_<position>_filename.ext

Creating files can be done by saving a file with "filename.ext" in a WebDAV folder. Simple Groupware automatically creates a new dataset with "<dataset-id>_0_filename.ext", which is linked to "filename.ext". That means you won't see "filename.ext" in the folder, but you can continue to work with the file after saving it.

All files uploaded to Simple Groupware can be changed over WebDAV. Creating new files over WebDAV require the target folder to have the "Files" module assigned to it. New folders created over WebDAV always get the "files" module assigned.

Note: In WebDAV, folders are identified by the name and the path. In Simple Groupware, folders are identified by a unique number. There can be problems in the WebDAV client if you have two folders with the same name and the same path in Simple Groupware.

Note: Directly saving or copying a file to a WebDAV folder is limited to 20 MB per file. Saving new versions to existing files follows the limit defined in the corresponding sgsML module.


Directory indexes


Each folder with at least one dataset contains a directory index. The first index file is named "_index.html" and contains the HTML export of the current folder. The second index is named "_index.xls" and contains the Excel export of the current folder. The HTML index can be opened with your favorite browser and the Excel index can be opened with MS Excel or OpenOffice Calc.


Lock / Unlock files


Under Windows, files can be locked by double-clicking the "Lock_..._#.vbs" file. Under Linux/Unix you can execute the "Lock_..._#.sh" file. For example if you want to lock the file "101_filedata_0_Presenation.ppt", the corresponding lock script will be "Lock_101_filedata_0.vbs". If the .vbs file is not available, the file is already locked by another user.
The process to lock or unlock a file is triggered when you download the contents of the "(un)Lock_..._#.vbs" file. So it is no problem if you're using a different WebDAV client that does not execute files, downloading them is enough.
All locking operations performed with WebDAV are directly visible in the web interface. And all locking operations done in the web interface are directly visible in the WebDAV folder.


Versioning


When a file is saved on the client, the new version of the file gets automatically uploaded to the server. The old version of the file will be archived in the same dataset containing the suffix "_rev#" in the filename.

Warning: There is no limit for the number of versions created for one file. Therefore it is recommended to delete unneeded versions from time to time manually.


Users and passwords


Every user in Simple Groupware has automatically access to WebDAV. When mounting a WebDAV folder to a drive letter, just use the username and password defined in the Simple Groupware user administration (see /Workspace/Organization/Users). The super administrator account also works with WebDAV.

Note: WebDAV does only work if "Disable basic authentication" is not activated in setup settings.


Other issues


Like normal CIFS servers, you can also use the UNC path style with "\\server\share", but that will produce a flood of senseless requests on the webserver. So pay attention to map the location always to a drive letter. Connecting with My Network Places causes the same problem.

If you open the properties of a WebDAV folder in Windows Explorer, counting folders and files will be slower than expected. For example, 100 subfolders require 100 page requests on the Simple Groupware server. In order to protect the server, a delay of 2 seconds is used for requests coming in too fast.

Microsoft Office programs (Word, Excel, Powerpoint, Visio, etc.) always use their own WebDAV client. Therefore, when opening a file from windows explorer, Word always asks again for your username and password.


Implementation status


In the current version you can list directory contents, create and rename directories, (un)lock files and create or change file contents. Deleting directories or files is not yet implemented. But these tasks can be easily done in the web interface.