“websharesrv” is the WebShare File Server, a native program running on the machine which can also host the HELIOS EtherShare/PCShare file servers, and is controlled by the HELIOS Service Controller (see HELIOS Base manual). It spawns a separate process for each user login.
The WebShare File Server offers various and versatile user and document management features, including e-mail notification on user login, additional customization in WebShare action scripts, etc.
“HELIOSDIR/var/conf/webshare.passwd” is the user configuration file of the WebShare File Server. Some specifications made on the “My User Preferences” administration page (5.6 “My User Preferences”) are stored in this file:
heliosuser::::zs=1,nocp=1::: martin::::zs=1,nocp=0::: ws1:md5_dd1c91f5d657b421c339592f:demo::zs=1,nocp=1::: ws2:clr_cleartextpassword:demo::zs=1,nocp=1:::
Each line in “webshare.passwd” starts with the user name followed by several fields which are separated by colons. The first (user name) and third (user ID) field must be set, the other fields may remain blank.
Virtual User or Host User
(Password in clear text or MD5 hash code of UTF-8 clear text password)
A string starting with md5_ is a crypted password for virtual users. A string starting with clr_ is a clear text password for virtual users. For virtual users this field should include a password entry. For host users this field may be empty if there is no additional WebShare password set and the HELIOS host password is used. We recommend to set a different password, though.
An empty field identifies a host user. For virtual users this field contains the name of the host user the virtual user is mapped to.
(Expiry date)
This field contains the user expiry date/time in
the format:
dd-MMM-yyyy-kk-mm
For example: 28-Feb-2004-14-21
The Expiry date is entered in the Expires
field on the “User Administration” page
according to the syntax specified by the preference
DateFormat (7.5 “Preferences”).
(Comma-separated flags)
"zs" (zipstream)
"nocp" (cannot change password)
"pt" (privileged transfer)
"br" (branding)=<branding name>
"po" (preview only for URL Share Access)
If zipstream is enabled, this field shows “zs=1”, otherwise “zs=0”. If there is no entry, zipstream is enabled.
(Client encoding for uploads/downloads)
Name of the client encoding for uploads/ downloads, e.g. “MacRoman”. Empty when the “OS Default” has been specified.
(E-mail address of user)
This has to be a fully specified e-mail address,
for example:
username@mycompany.com
(Comment)
Make sure that the comment does not contain special characters like a colon (“:”). These will be replaced with “_” in order to keep “webshare.passwd” compatible.
User settings are stored in the “HELIOSDIR/var/run/WebShare_User_Settings/<user name>.settings” file (* = PrintPreview required):
* Application.session.annotationParameters Default.preferredView * Default.iccProfiles.printer * Default.iccProfiles.monitor * Default.iccProfiles.simulation * Default.screen.width * Default.screen.width.unit * Default.screen.pixel FileBrowser.session.showFileComments FileBrowser.session.galleryIconSize FileBrowser.session.searchResultView FileBrowser.session.searchResultGalleryIconSize FileBrowser.session.showGalleryDetails * PrintPreview.zoom.originalSize WSPrintDialog.settings.paperHeightSetting WSPrintDialog.settings.marginWidthSetting WSPrintDialog.settings.paperWidthSetting WSPrintDialog.settings.resolutionValueString WSPrintDialog.settings.bindingMargin WSPrintDialog.settings.scaleImages WSPrintDialog.settings.paperFormatString WSPrintDialog.settings.unitName * WSPrintDialog_ProofMode.settings.paperFormatString * WSPrintDialog_ProofMode.settings.marginWidthSetting * WSPrintDialog_ProofMode.settings.resolutionValueString * WSPrintDialog_ProofMode.settings.controlGraphicPosition * WSPrintDialog_ProofMode.settings.unitName * WSPrintDialog_ProofMode.settings.bindingMargin * WSPrintDialog_ProofMode.settings.paperHeightSetting * WSPrintDialog_ProofMode.settings.scaleImages * WSPrintDialog_ProofMode.settings.paperWidthSetting * WSPrintDialog_ProofMode.settings.controlGraphicString * WSPrintDialog_ProofMode.settings.printProofImageTitle
The “WSProperties” object allows getting and setting user settings (see 7.2 “WebShare user settings file”) or custom properties via JavaScript from the “additional.js” JavaScript file (see 4.6.9 “Customize brandings via JavaScript”). Custom properties will also be saved in the user settings file and provide a persistant way to save properties. If default user settings are saved (see Save Default User Settings in 5.6 “My User Preferences”) any custom properties will not be saved. “WSProperties” is implemented as a singleton and cannot be initiated. Note that the getProperty and setProperty methods may cause a read/write operation on the WebShare file server. If these methods should be executed asynchronously, set a callback function object with setCallback.
Retrieve a property value for the given key. If the property is null
, false
,
true
or undefined
it will be converted to a corresponding JavaScript
object, otherwise a string is returned. If the property does not yet exist this method returns
null
.
key:
The name of the property to retrieve.
Set a property value as a string for the given key. This method returns the new value of the property as it was retrieved via the getProperty method.
key:
The name of the property to set.
value:
The value the property specified with key should be set to.
Set a function object that will be called whenever the readyState attribute of the XmlHttpRequest object changes. If a callback function is set by this method the request will be performed asynchronously. The server response will be sent as an object notated in JavaScript Object Notation (JSON) format and contains the propertyValue object which will contain the value of the retrieved or set property. Use the JavaScript eval or JSON.parse function for parsing the JSON response inside the callback method.
func:
A reference to a function object or an anonymous function which takes a
XmlHttpRequest object as its argument.
The “zipstream” and “unzipstream” programs, which are used for download and upload compression (and extraction), are located in the “HELIOSDIR/bin” directory.
All other utilities described in this section are Perl scripts which are stored in “HELIOSDIR/etc/webshare”. For those scripts, the “dt” command will automatically be used to ensure that all changes are applied to data and resource parts of files and folders. This ensures that HELIOS volume specific requirements are met.
These Perl scripts can be customized. However, this should never be
done in the original script file. Instead, copy the script
into the “HELIOSDIR/var/webshare” directory.
WebShare automatically looks first in “var/webshare”
for all scripts and uses “etc/webshare” only as a fallback
if the script is not available in “var/webshare”.
This utility creates a Zip archive to which files and folders can be added in a compressed form. The advantages over the Zip program are that there are no temporary files created during compression, and file downloads can commence immediately without waiting for the Zip archive to be created. Special file attributes like creation date, Mac type and creator and resource fork are encoded into MacBinary, which is preserved in the compressed Zip archive. UTF-8 is always the encoding used for file/folder name representation in the file system. The encoding used for file/folder name representation in the Zip archive can be specified to match the client computer system, e.g. MacRoman, PC850, ISO8859-1, UTF-8, etc.
zipstream [options] file zipstream -h (for help info)
The following options are supported:
Write the Zip archive to the file instead of writing to “stdout”.
Input files are read from this directory.
Zip compression level. Valid levels are from 1
(best speed)
to 9
(best compression). The default level is 6
.
Encoding used for file names in Zip archive. The default
encoding is UTF8
. Use uniconv -l
to list all available encodings
(see HELIOS Base manual).
“zipstream” is called with this option by the WebShare File
Server when an encoding is selected via the Download Encoding
pop-up menu on the “User Administration” or “My User
Preferences” page.
The server volume encoding for “zipstream” is always assumed to be UTF-8. Non UTF-8 volumes are not supported by “zipstream”.
Print estimated Zip archive size to “stdout” (8 byte integer, network byte order).
Print estimated Zip archive size to “stdout” (4 byte integer, network byte order).
Write output in blocks of n kBytes. The default is 32 kB.
No Zip streaming format.
“zipstream” is called with this option by the WebShare File
Server when the checkbox Zip Streaming Format
is not
checked.
Encode the data and resource fork of a Mac file to MacBinary.
Include file comments in MacBinary (works only together
with the -m
option).
Preserve “.rsrc” directories. By default, “.rsrc” directories
are skipped when creating the Zip archive. This option has
no effect if -m
is set.
Add report file “DownloadLog.txt” to Zip archive containing
file access errors and, if -v
is also set, verbose information.
Display verbose information on “stderr” or, if -e
is also set,
write verbose information to “DownloadLog.txt” in the Zip archive.
Resolve symbolic links, add files into Zip archive.
Generate Mac OS X 10.3 (or newer) Finder compatible Zip archives, so that no additional archiving software is needed.
Specifiy path to download accounting log file.
Specify offset bytes in temporary upload file. This option supports single archives only for resuming uploads.
Use the given file name for the Zip directory entry.
Specifies the UTC (Universal Time Coordinated) time difference in seconds which is taken into account when generating dates within the Zip archive.
Create an Zip archive named “archive.zip” and add “file1”, “file2”, “dir1”, and “dir2” to the archive:
$ zipstream -f archive.zip file1 file2 dir1 dir2
The “unzipstream” utility expands Zip files and decodes MacBinary files.
By default it reads a Zip or MacBinary file from “stdin”.
The -f
option can be used to specify a Zip or MacBinary
input file. Output files are stored under the names defined
in the Zip or MacBinary file. If the input file is not a Zip or
MacBinary file, it will be written to “stdout” or to the file
specified by the -o
option.
unzipstream [options] file unzipstream -h (for help info)
The following options are supported:
Read the Zip archive instead of reading from “stdin”.
Output file name. This is only used if the input file is not a Zip or MacBinary file.
Output files are written to this directory.
Encoding used for file names in Zip archive. The default
encoding is UTF8
.
Use uniconv -l
to list all available encodings.
The server volume encoding where Zip files are unpacked is always assumed to be UTF-8. Non UTF-8 volumes are not supported by “unzipstream”.
Preserve “.rsrc” directories. By default, files in “.rsrc” directories are not extracted from the Zip archive.
To prevent inconsistencies between information stored in the desktop databases of a HELIOS volume and the files/folders on this volume, do not upload or extract a Zip archive with “.rsrc” directories directly into an active HELIOS volume. Make sure to use the HELIOS “dt” tools (see HELIOS Base manual).
Name of a notification script that will be called after a file is extracted. The script is called with the following parameters:
backupOriginal
replaceOriginal
directory
temporary file name
original file name
file type (“Image” or “NoImage”)
Specify the MIME type of the input file.
If -m
is given, “unzipstream” does not check the header of
the input file to determine the file type. Currently, the only
known MIME type is “application/x-macbinary”.
List files instead of extracting them.
Unhide “dot files” by replacing the leading dot with an underscore.
.DS_Store is represented as _DS_Store.
Specify the path of the upload accounting log file.
Skip <offset>
bytes in the
target file before extracting.
This option should only be used in combination with the -t
option and single file archives to resume an interrupted upload.
Specify the content length for uploads. The estimated upload length is verified to detect aborted uploads.
Specify the temporary upload file name. This is only
used in combination with the -n
option.
If the file to extract already exists, backup the existing file. This option is only used with the “wsuploadmv” notification script. By default, “wsuploadmv” creates a different file (e.g. “file dup.txt”) if the file already exists.
If the file to extract already exists, replace it. This option is only used with the “wsuploadmv” notification script. By default, “wsuploadmv” creates a different file (e.g. “file dup.txt”) if the file already exists.
Specify a modification time for the extracted file. This option should be used with single file archives only.
Specify the delta in seconds relative to UTC (Coordinated Universal Time).
Display verbose information on “stderr”.
Please note that if a Zip file on its part contains Zip files in the archive, these will not be further expanded.
List the Zip archive, assuming Windows (PC850) encoding:
$ unzipstream -l -c PC850 -f archive.zip
Extract the Zip archive which was created by DropZip, assuming Mac (MacRoman) encoding:
$ unzipstream -c MacRoman -f archive.zip
Extract all files in “abc.zip” to the directory “/data/zips”:
$ unzipstream -f abc.zip -C /data/zips
This file is a Perl library module which is included by all WebShare Perl scripts. It contains, for example, information on other installed HELIOS products, etc.
A description of the environment variables may be helpful when customizing WebShare action scripts or utility programs:
Environment variable | Description |
---|---|
WSUserEncoding | E.g. “OS Default”; Download encoding |
WSAccept-Language | E.g. “en”; Currently used GUI language for WebShare |
WSWindowsEncoding | E.g. “PC850”; Default Windows encoding |
WSStreamingZip | E.g. “Yes”; Use Zip Streaming format |
WSMacintoshEncoding | E.g. “MacRoman”; Default Mac OS encoding |
WSUserId | E.g. “105”; Effective user ID of current session |
WSGroupId | E.g. “30”; Effective group ID of current session |
WSUser | Name of logged-in user |
WSUserEMail | E-mail address of logged-in user |
WSSessionSeq | E.g. “843-64”; websharesrv process ID (843) and number of logins (64) |
WSClientAddress | IP address of logged-in client |
WSPREVIEWDIR | WebShare cache directory path |
WSUserAgent | E.g. “Mozilla/5.0 (Mac; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113”; Browser information |
HELIOSDIR | E.g. “/usr/local/helios”; HELIOS directory path |
The following environment variables are only available if the script is called from within a
sharepoint via the Actions >
menu:
Environment variable | Description |
---|---|
WSSharepoint | E.g. “Sample Images” |
WSSharepath | E.g. “/template-images%0/” |
wscopy.pl destdir srcdir files...
This program is called by the WebShare File Server every
time Copy
or Paste
function (in the Edit >
toolbar menu) is selected. “destdir” specifies the destination directory,
which the specified files and folders from the “srcdir” are
copied to.
wsmove.pl destdir srcdir files...
This program is called by the WebShare File Server every
time the Move
function (in the Edit >
toolbar menu) is selected.
“destdir” specifies the destination directory to which the
specified files and folders from the “srcdir” are moved to.
wsdownload.pl zipstream-options offset srcdir files...
This program is called by the WebShare File Server every
time the Download
function is selected. “wsdownload.pl”
uses the WebShare “zipstream” utility to stream an on-the-fly
generated Zip archive without temporary files to “stdout”. With the
“zipstream-options” argument additional options are passed on to a
“zipstream” program call. The “offset” argument defines the number
of bytes to be skipped for resuming single archive downloads. The
“srcdir” specifies the current directory of the user’s web session.
The “files” argument consists of the files and folders that have
been selected for download by the user. Settings like Zip format,
file name encoding, MacBinary support, client platform (Mac or
Windows), etc. are automatically determined by the “wsdownload.pl”
script.
wsdup.pl dir files...
This program is called by the WebShare File Server every
time the Duplicate
function (in the File >
toolbar menu) is selected.
wsmkdir.pl dir newdir
This program is called by the WebShare File Server every
time the Create Dir
function (in the File >
toolbar menu) is selected.
wsmv.pl dir source dest
This program is called by the WebShare File Server every
time the Rename
function (in the File >
toolbar menu) is selected.
wspreview.pl srcfile srcfiletype dstfiletype previewfile resOptions page antialiasPDF
This program is called by the WebShare File Server every time an image or document preview that is not yet available in the cache area, is requested from the client.
Parameters:
The complete path name to the image or document the user selected for preview.
The file type of the document from which a preview is to be generated.
The file type of the preview image; usually JPEG or PNG, see “Generated previews” for details.
The path name of the preview filename. The filename specifies the preview name to be saved in the preview cache area.
This parameter specifies the preview options
for the ImageServer “layout” command.
Different parameters are split by a “|” character. For example,
-oxpix=256|-orotate=90|-oflipvertical
The page number starting with 1 used for multiple-page documents.
“True” or “False” to specify antialiasing for PDF input files.
This script does not require any user authentication.
wsforgotpw.pl opts...
This program is called by the WebShare File Server every
time the Forgot Password?
link on the login page is clicked, and
the form page is submitted.
The following table lists the Perl script field variables in the
left column, and on the right the corresponding HTML field
entries in the file “ForgotPassword.wod” (see
6.3.2 “Customizing “*.wod” files”). Please note that the
Perl script variable names are given and cannot be
renamed! If fields are not needed, leave them empty:
wsforgotpw.pl | ForgotPassword.wod |
---|---|
$username | editUser.username |
editUser.email | |
$organization | editUser.organization |
$comment | editUser.comment |
$field5 … $field10 | editUser.field5 … 10 |
This script does not require any user authentication.
wsregnewuser.pl opts...
This program is called by the WebShare File Server every
time the Register as a New User
link on the login
page is clicked, and
the form page is submitted. The following table lists the Perl script
field variables in the left column, and on the right the corresponding
HTML field entries in the file “RegisterNewUser.wod”
(see 6.3.2 “Customizing “*.wod” files”). Please note that
the Perl script variable names are given and cannot be
renamed! If fields are not needed, leave them empty:
wsregnewuser.pl | RegisterNewUser.wod |
---|---|
$username | editUser.username |
$password | editUser.password |
$verifyPassword | editUser.verifyPassword |
editUser.email | |
$comment | editUser.comment |
$organization | editUser.organization |
$field7 … $field20 | editUser.field7 … 20 |
wsrm.pl dir files...
This program is called by the WebShare File Server every
time the Delete
function (in the File >
toolbar menu) is selected.
wsperm.pl dir user group userMode groupMode otherMode recursive files
This program is called by the WebShare File Server every
time the Permissions
function (in the File >
toolbar menu) is selected.
wsupload.pl dstdir filesize backupOriginal replaceOriginal fileOffset tmpFilename filename mimetype
This program is called by the WebShare File Server every
time the Upload
function (in the Transfer >
toolbar menu) is selected. “wsupload” receives the upload stream from
“stdin” and unpacks the uploading stream in the directory
specified by the “dstdir” parameter. The “unzipstream”
utility is used as a backend to unpack the data stream
on-the-fly. As soon as a file within a Zip stream is detected, the
file is saved with a temporary name with the process ID as
suffix. For each file in the Zip stream the “wsuploadmv”
script is called to rename the file with the process ID suffix
to its final name. All this is done on-the-fly while
“unzipstream” continues to receive data with additional files
within the Zip stream. “wsupload” automatically detects if the
upload is done from a Windows or Mac client, and will set
up a proper character encoding according to the user and
system default settings.
wsuploadmv.pl backupOriginal replaceOriginal dir source dest backupOriginal and replaceOriginal can be set to '1' or '0'
This program renames uploaded files from their temporary name to their final name. “wsuploadmv” is a good place to add more processing tasks, e.g. a virus scanning software to verify uploaded files.
This service displays WebShare File Server user and status information.
After calling localhost
with the appropriate port on the
command line, you may enter the additional commands
users
, status
or help
to display possible options:
$ socket localhost 2016 Welcome to the HELIOS WebShare File Server service port help help - print a list of available commands quit - close connection status - show status information users - show user information rmcache - remove all cache files users # PID User UID Address CRC Login 1 inactive tom 101 192.168.1.2 24c9ce Mon 10:38 1 active joe 108 192.168.1.8 3bffc9d6 Thu 11:23 Summary: 1 active users (1 inactive users) status WebShare File Server, Version 2.0.1 Up since: Fri Nov 13 10:25:30 2009 Max users: 2 Max users allowed: 100
For security reasons the “socket” service port only
accepts incoming connections on the WebShare File
Server, using the localhost
address.
It is possible to include scripts in the WebShare workflow which automate tasks, etc. WebShare comes with some custom scripts (“wslogin.pl”, “wsaddshare.pl”, “wslogout.pl”, “wsemail.pl”, and “wspreviewaccess.pl”) that have to be customized by the user in order to take effect, and various sample action scripts (see 7.4.3 “Sample action scripts”). The custom scripts are stored in “HELIOSDIR/etc/webshare/samples”. In addition, the WebShare utility scripts in “HELIOSDIR/etc/webshare”, described in 7.3 “WebShare utility programs”, may also be customized.
The standard output size of custom scripts is limited to 64 kB. However, the error output is limited to 2 kB.
Custom scripts become active after copied into the “var/webshare” directory.
This script is called after a successful WebShare login with the parameters:
User name
Apparent user IP address (If the user is e.g. “behind” a proxy server, the proxy IP address is presumed as user IP address)
Complete browser identification string (User Agent)
A string containing the user ID
An options string containing the user type (Virtual User or Host User) as first entry; and separated by a comma the entry “IsAdmin”, if the user has Administrator rights
The script can be customized to perform any desired action upon a user login. A script return value of 0 would allow the user to log in to WebShare, whereas a value different from 0 would deny the login, while issuing an error message via “stderr”.
Every time a WebShare Administrator adds or modifies a sharepoint, the “wsaddshare.pl” script is called. Its parameters are:
Sharepoint name
Sharepoint path
Sharepoint e-mail address
An options string with the boolean preferences of the sharepoint (Publish, AllowDownload, etc.) containing the sharepoint preference keys in a comma-separated list
A string containing all users who are allowed to see the sharepoint
A list of all groups whose user members are allowed to see the sharepoint
By customizing this script, a System Administrator can prevent WebShare Administrators from creating a sharepoint whose path points beyond the administrative (allowed) area. A return value of 0 would allow creating a sharepoint or applying changes in a sharepoint, whereas a value different from 0 would deny these actions, while issuing a message to the System Administrator via “stderr”.
#!var/run/runperl -w #@(#)HeliosVersion 2.0.1 Copyright 2003-2009 HELIOS Software Garbsen # WebShare sample script to perform any actions or checks whenever # a new Sharepoint is defined or Sharepoint setting are modified. # The script must either # - exit with status 0 to allow saving the Sharepoint, or # - write an error text to STDERR and exit with status != 0 if # saving the Sharepoint is not allowed. # # NOTE: To use the sample script, copy this file into the # HELIOSDIR/var/webshare directory, edit it according to your needs, # and make sure that it is executable. sub BEGIN { use vars qw($HELIOSDIR); $HELIOSDIR = $ENV{"HELIOSDIR"} or die "HELIOSDIR not set in environment\n"; unshift (@INC, ".", "$HELIOSDIR/etc/webshare", "$HELIOSDIR/etc/perl"); } use strict; use wscommon; use HELIOS::Utils; if ($#ARGV + 1 != 6) { print STDERR "Usage: $prog sharename sharepath sharemail" . "shareoptions usermembers groupmembers\n"; exit 1; } my $sharename = shift; # Sharepoint Name my $sharepath = shift; # Sharepoint Path my $sharemail = shift; # E-Mail on Access my $shareoptions = shift; # Options, comma-separated my $usermembers = shift; # User Members, comma-separated my $groupmembers = shift; # Group Members, comma-separated # exit 0 without any stderr messages will allow to add the share exit 0; # Example: Allow only sharepoint paths starting with "/webshare/" # or "/samples/": my @allowedPaths = ("/webshare/", "/samples/", "/c:/webshare"); foreach my $path (@allowedPaths) { exit 0 if ($sharepath =~ /^$path/); } print STDERR "Adding sharepoint directory $sharepath not allowed!\n"; exit 1;
As soon as the user has logged out, this script is called with the following parameters:
User name
HTTP client TCP/IP address
Complete browser identification string (User Agent)
This script may be customized, e.g. to clean up directories or to accomplish similar tasks. In contrast to wslogin.pl and wsaddshare.pl, the return value of this script is not interpreted.
This action script is called every time a user sends an e-mail via WebShare. The script is called with the parameters:
User name
Recipient (field To:
)
Carbon copy recipient (field Cc:
)
Blind carbon copy recipient (field Bcc:
)
Subject
Mail text
The Script must exit with status 0
to allow the user sending
e-mail or status 1
to deny sending an email.
If a script named “wspreviewaccess.pl” is copied to “HELIOSDIR/var/webshare” it is called every time an image preview is requested.
The script has two arguments:
1. <Pathname>
to the image
2. <Pathname>
to the cache preview file
This allows precise auditing for third-party scripts which may use this information to get informed about the preview activities.
All WebShare scripts are developed in Perl including the sample scripts. WebShare scripts can be developed in any language, e.g.: shell, PHP, Perl, Java, C/C++, etc. HELIOS prefers Perl because it is very powerful and compatible across different server platforms. This chapter provides guidelines on how to debug Perl scripts to be used as utility and action scripts within WebShare. Make sure to implement and debug your script so that it works in general before you begin debugging it in the WebShare environment.
Environment requirements:
All scripts are assumed to be called with the current directory
HELIOSDIR, which is “/usr/local/helios” by default. To be
compatible on all platforms without depending on the Perl
installation path all WebShare Perl scripts include a
#!var/run/runperl
in the first line.
“runperl” is a symbolic link to the local Perl interpreter.
The “runperl” link is automatically created during the WebShare
installation. All WebShare default scripts are included in
“etc/webshare”. Customized scripts should be stored in
“var/webshare” to avoid overwriting your scripts during
a new installation. Another benefit is that the entire “var”
folder contains all customization and settings, which allows
easy migration to a different server platform without
applying all changes again.
Printing debugging information:
As many scripts produce their output to “stdout” or “stderr”,
printing script variables will produce mixed output which
leads to malfunctions. All HELIOS scripts support debug
output into a file by specifying the “DEBUGTTY” environment variable.
A simple debugging session:
# cd /usr/local/helios # export DEBUGTTY=/dev/tty # var/webshare/actions/<yourscriptname>
The above commands allow to test drive the script and to check the results.
A debugging session within a running WebShare File Server:
# cd /usr/local/helios # bin/srvutil stop websharesrv # to stop the webshare file server # export DEBUGTTY=/dev/tty # sbin/websharesrv
The manual start of the WebShare File Server allows that all output will be printed into the terminal output (using the current “tty”).
As mentioned in 7.4.1 “Custom scripts”, WebShare comes with various sample action scripts:
wsannotations.pl
wscheckpdf.pl
wscmdargs.pl
wsdialog.pl
wsdu.pl
wsimageinfo.pl
wsll.pl
wspdfinfo.pl
wssendmsg.pl
wsspotlightmeta.pl
wsxpvcollect.pl
wsxpvinfo.pl
Located in “var/settings/WebShare/Actions/Samples”, the scripts must be copied to “var/settings/WebShare/Actions” in order
to become available in the Actions >
pop-up menu in the
toolbar of the sharepoint window (see section Actions > in 5.3 “Work in a sharepoint”).
In addition, the file access permissions of
each action script determines if it is even visible to individual
users. See 9.1.7 “Action scripts”.
This action script returns a table of all annotations for the current sharepoint, and offers a search functionality for annotations.
(PDF HandShake required) Action script to preflight a PDF document, using callas software’s “pdfToolbox”.
This action script prints out the script arguments and the environment variables.
This two-step action script first generates a form with customized HTML fields (text fields, buttons, etc.), which are then processed.
Action script to show disk usage of files by use of the du
command.
(ImageServer required) Action script to extract information about an image.
This action script lists, by use of the ls -l
command (on
Windows dir
), the content of the current directory:
#!var/run/runperl -w #@(#)HeliosVersion 2.0.1 Copyright 2003-2009 HELIOS Software Garbsen #Title=ls -l # WebShare sample action script to list the content of a directory. # # NOTE: To use the sample action, copy this file into the # HELIOSDIR/var/settings/WebShare/Actions directory, edit it # according to your needs, and make sure that it is executable. sub BEGIN { use vars qw($HELIOSDIR); $HELIOSDIR = $ENV{"HELIOSDIR"} or die "HELIOSDIR not set in environment\n"; unshift (@INC, ".", "$HELIOSDIR/etc/webshare", "$HELIOSDIR/etc/perl"); } use strict; use wscommon; use HELIOS::Utils; if ($#ARGV + 1 < 2) { print STDERR "Usage: $prog dir\n"; exit 1; } my $dir = shift; # given directory my $nfield = shift; # unused content of the input field $dir = HELIOSPathToSystemPath($dir); if ($^O eq 'MSWin32') { system("dir", $dir); } else { system("ls", "-l", $dir); } exit 0;
(PDF HandShake required) Action script to extract information about a PDF document.
Action script to send messages from WebShare to all users that are connected via “afpsrv”, “pcshare” or “heladmsrv”.
Action script which returns a table of Spotlight metadata for all selected files.
(ImageServer required) Action script to collect the referred data (QuarkXPress or InDesign document and images) from the XPV document. It creates also a report about the used fonts.
(ImageServer required) Action script to extract information about an XPV document.
If the name of the script file starts with “hide-” (e.g.
“hide-scriptname.pl”) the script will not be listed in
the Action >
menu of the toolbar. This is
useful for actions that will be called by JavaScript
(see 7.4.4 “Calling action scripts via JavaScript”) but should not be visible for the user.
It is possible to call any custom action script via JavaScript from the “additional.js” JavaScript file (see 4.6.9 “Customize brandings via JavaScript”). This allows customization of workflows or adding new features and options. To call a custom action script via JavaScript make use of the WSJavaScriptCommand object. Custom actions can be called from the WebShare “Home” page, the file browser page, the preview page, the proof window, the “Administration” page, and the “My User Preferences” component.
To call custom action scripts from JavaScript use the WSJavaScriptCommand object. It contains the following public methods:
Add files to the action script as if they were selected in the directory listing.
files:
An array of HTML element objects or a single HTML element object like
HTMLTableRowElement, a HTMLTableCellElement, or similar.
The key/value pairs of the given object will be passed to the action script as “POST” variables. If any name field content has been set via the setNamefieldContent method this method will throw a WSJavaScriptCommandException.
parameters:
An object holding key/value pairs.
Sends the request. If no command name has been set via the setCommand method this method will throw a WSJavaScriptCommandException.
Returns: true
if the request has been sent, false
if no request
can be sent from the current component.
The function object func
will be called whenever the readyState attribute of
the XmlHttpRequest object changes. The XmlHttpRequest object will be passed as a parameter
to the function.
func:
A reference to a function object or an anonymous function which takes a
XmlHttpRequest object as its argument.
Set the name of the script to invoke.
name:
The name of the action script to invoke, e.g. “wsannotations.pl”.
Set the content of the name field of an action. If any “POST” parameters have been set via the addParameters method this method will throw a WSJavaScriptCommandException.
content:
The content of the name field of an action script.
Sets the name of the current WebShare sharepoint. In the “FileBrowser”, “Preview”, and “Proof” components, the sharepoint name cannot be overidden and this method will throw a WSJavaScriptCommandException if invoked. It should be used to set a sharepoint in components that do not have a sharepoint context like the “Administration” component. You may want to call this method within a try/catch block.
name:
The name of a WebShare sharepoint.
This section lists all the preference keys that are pertinent to the WebShare File Server. Find a description of how to set, view, change or delete preferences, with the HELIOS “prefdump”, “prefvalue”, and “prefrestore” utility programs in “HELIOS utility programs” in the HELIOS Base manual.
Make sure that preference keys DO NOT start or end with a slash (“/”) character, and note that they are case-sensitive! Also, if any preference key or preference value includes spaces, that key or value must be enclosed in quotes.
Key: Programs/websharesrv/<preference>
Specifies the time delay in seconds between failed login requests. This helps increase the security against unauthorized logins, e.g. by password robots, which try to match the password by issuing a large number of passwords per second.
Determines whether the Forgot Password?
link becomes
visible in the login window. The setting of this preference
reflects the state of the Enable Forgot Password Option
checkbox on the “Server Preferences” page (Fig. 4.3).
Determines whether the Register as a New User
link
becomes visible in the login window. The setting of this
preference reflects the state of the Enable Register User Option
checkbox on the “Server Preferences” page (Fig. 4.3).
Determines whether the Mail
function (in the Edit >
toolbar
menu) is available. The settings of this preference reflects
the setting of the Enable E-Mail message for Users
checkbox
on the “Server Preferences” page (Fig. 4.3).
With this preference set to TRUE
, only encrypted user logins
are permitted. For this purpose, JavaScript must be active in
the web browser. The setting of this preference reflects the
state of the Enforce RSA Crypted Passwords
checkbox in the
“Server Preferences” page (Fig. 4.3).
With this preference set to TRUE
, WebShare allows direct
URL access from remote clients.
If an annotation is added to a file in the preview or proof window, it is named “<file name>.annotation” and saved adjacent to the original file. This preference allows specifying prefixes for the annotation file, e.g. a dot (“.”), which would hide the file in the WebShare file browser. Also directories can be specified; if “anno/” is specified, the annotation file is saved to the directory “anno” which is created adjacent to the original file.
Allows deactivating the time adjustments. The default is
FALSE
which means time zones are automatically adjusted.
If set to TRUE
, this parameter lets “websharesrv” append a
record to the system messages if, due to the IP access list,
access to one or more users has been denied.
This preference specifies the maximum resolution for
image previews in the gallery view. If the value of the preference
is set to 0
, the gallery view mode is not available (the
corresponding button in the File > Set View > Gallery
menu is
grayed out or hidden, depending on the Show Disabled Buttons
setting of the used branding, see Toolbar in 4.6.1 “Create and configure brandings”).
If the specified value is less than 32
the WebShare
Web Server assumes 32
as the maximum size.
Specifies the maximum number of TCP data bytes that are
passed from the clients to “websharesrv” over the network
during a transaction. The number of bytes may need to be
limited if the buffer size in the UNIX server is too small.
TcpRecvSize
can be varied to optimize the data transfer rate.
Specifies the maximum number of TCP data bytes that are
passed from “websharesrv” to the clients over the network
during a transaction. The number of bytes may need to be
limited if the buffer size in the UNIX server is too small.
TcpSendSize
can be varied to optimize the data transfer rate.
Changed values in TcpRecvSize
and TcpSendSize
will automatically be assigned to the WebShare Web Server
as well, for the next login.
Specifies the cache size value of the WebShare File Server for preview files. It corresponds to the Cache Size in MB value in the WebShare “Server Preferences” menu.
The default value for CacheSize
is 30 (MB), due to the
usually limited disk space in “HELIOSDIR/var”. If you
change the CacheDir
preference to another path, it is
recommended to set CacheSize
to a value of at least
300 (MB).
Specifies whether users are allowed to log on to the
WebShare File Server with their host login name. The
setting reflects that of the Enable WebShare for Host Users
checkbox in the Webshare “Server Preferences” menu.
Specifies whether users are allowed to log on to the
WebShare File Server with their (virtual) WebShare login
name. The setting reflects that of the Enable WebShare for Virtual Users
checkbox in the Webshare “Server Preferences” menu.
Specifies an e-mail address to which a notification is sent as
soon as a client with Admin rights logs on to the WebShare
File Server. It corresponds to the E-Mail Notification on
Admin Login
entry in the Webshare “Server Preferences”
menu.
Make sure that the complete receiver account is specified, e.g. webshare@mycompany.com
Specifies an e-mail address to which a notification is sent as
soon as a user logs on to the WebShare File Server. It corresponds
to the E-Mail Notification on User Login
entry in
the Webshare “Server Preferences” menu.
Make sure that the complete receiver account is specified, e.g. webshare@mycompany.com
If set to TRUE, this preference enables the sharepoint preferences
AllRead and AllReadWrite. In that case, the additional
options Always Allow Reading
and Always Allow Read/Write
(see 7.5.2 “Sharepoint preference keys”) will be shown in
the “Sharepoint Administration” page.
It may considerably reduce host security to set the
AllowAllReadWrite
flag to TRUE because if required,
host access rights are bypassed, with all user processes
changing to “root” processes!
Specifies the format with which the date is displayed in the
directory listing of the “Sharepoint” menu. It corresponds
to the Directory Listing Date Format
entry in the
Webshare “Server Preferences” menu. Also, this preference
specifies the required syntax for the Expires
field in the
“User Administration” page. See Date format in
4.1 “Server Preferences”.
Specifies those profiles from the “ICC-Profiles” volume
that should be available in the ICC Proof Simulation
pop-up
menu in the WebShare proof window.
If this preference is set to TRUE
, WebShare users are allowed to upload and administer
their own monitor and printer ICC profiles on the “My User Preferences” administration page.
It corresponds to the Allow ICC Profiles per User
entry in the WebShare “Server Preferences” menu.
Specifies whether e-mail notification is used at all.
If set to TRUE
, this preference sends an e-mail, as soon as a
WebShare action script is executed, to the address that is
specified in the E-Mail on Access
field on the “Sharepoint
Administration” page. See EmailAccess.
Specifies the default encoding method when downloading
files on Windows clients. The setting reflects that of the
Default Windows Encoding
pop-up menu on the “WebShare
Server Preferences” menu.
Specifies the default encoding method when downloading
files on Mac clients. The setting reflects that of the Default
Mac OS Encoding
pop-up menu in the WebShare “Server
Preferences” menu.
If set to TRUE
, hidden files (“dot files” and files which have
been marked as hidden in an EtherShare volume) are
displayed in a sharepoint directory listing.
Specifies file names which should always be hidden in a directory listing.
Specifies the (comma-separated) pixel/resolution values which are available in the “Sharepoint” preview pop-up menu. The “zoom icon” resolution values are defined in the “Branding Editor > Branding > Preview Resolutions 1-4” preference, and are not affected by this preference.
By default, the following resolutions are available:
36 dpi,72 dpi,96 dpi,144 dpi,128 pixel,256 pixel,512 pixel,768 pixel,1024 pixel
Allows specifying suffixes for custom file types that are to
be previewed in WebShare and which must be processed
first (according to the rules given in the “wspreview.pl”
script). For example, doc,xls,ppt
(no blanks!) can be specified
for Microsoft Office documents which, if required, are
processed by Tool Server with the “OfficeReader” script.
If this preference is set, the specified users have only URL based WebShare web access. See also the AllowLinkShares preference.
If this preference is set, the specified users have only URL based WebShare image fetching access. This allows setting up a special user (real or virtual) for remote URL image-only access. If somebody tries to steal the URL specified user name and password for a manual WebShare login, this will be denied. See also the AllowLinkShares preference.
Specifying the same user name(s) with both preferences URLWebOnlyUsers and URLImageOnlyUsers will cause that the access for the specified user(s) is denied at all – be it via URL Share Access or manual login. So make sure to use different user names with both preferences!
Specifies the WebShare File Server port number. Additional TCP ports (up to a total of five) will automatically be allocated as needed by the WebShare File Server.
The value of the TcpPort
preference needs to be identical
with the WebShare Web Server preference
WSHostPort (6.5 “Preferences”).
If there should be the need to change a value, then
make sure that both preference keys are assigned the
same value!
Specifies the “telnet” service port number of the WebShare File Server.
Specifies the maximum number of workstations (clients)
that are permitted to work on the WebShare File Server
simultaneously. This value should normally be the same as
the total number of workstations that are connected to the
WebShare File Server, and should be less than or equal to
the number of sessions
allowed by your software license.
The default value for sessions is the number of sessions
allowed by your software license.
Specifies the lowest number allowed for user IDs. All host
users which have a lower user ID than that specified by
minuid
, and all virtual users running as a host user with a
user ID lower than that specified by minuid
, are not permitted
to log in. The default behavior is that all IDs are allowed.
Specifies the highest number allowed for user IDs. All host
users which have a higher user ID than that specified by
maxuid
, and all virtual users running as a host
user with a user ID higher than that specified by
maxuid
, are not permited to log in.
The default behavior is that all IDs are allowed.
Specifies the file containing the access list with the IP addresses which are permitted to log on to “websharesrv”. See HELIOS Base manual.
Specifies the directory which contains the preview files on
the WebShare File Server. It corresponds to the Cache Directory
entry in the “WebShare Server Preferences” menu.
This directory must already exist and have rwx (read-write-execute) permissions for all.
If set to FALSE
, antialiasing for PDF previews is deactivated.
Key: Programs/websharesrv/Shares/<sharename>/<preference>
Specifies the sharepoint path. It corresponds to the Sharepoint Path
entry in “Sharepoint Administration”.
Specifies whether a sharepoint is published in the “Home”
menu. The setting reflects that of the Publish
checkbox in
the “Sharepoint Administration” page.
Specifies an e-mail address for notification mails on user
access and action to the selected sharepoint. It corresponds
to the E-Mail on Access
entry on the “Sharepoint
Administration” page. Make sure that the complete receiver
account is specified, e.g. webshare@mycompany.com.
Specifies whether notification mails, as stated in the EmailAccess
preference, are issued after the users’ logout, which
is the default behavior or after each file download, deletion
or upload action that has been done by a user.
Specifies a comment on the selected sharepoint. It corresponds to
the Comments
entry on the “Sharepoint Administration” page.
With this preference set to TRUE
, annotations can
be added to a document. The setting reflects that of the Allow Annotations
checkbox on the “Sharepoint Administration” page.
Specifies whether previews of images in the sharepoint are
allowed. The setting reflects that of the Allow Preview
checkbox on the “Sharepoint Administration” page.
Specifies whether downloading files from the sharepoint is
allowed. The setting reflects that of the Allow Download
checkbox on the “Sharepoint Administration” page.
Specifies whether uploading files to the sharepoint is
allowed. The setting reflects that of the Allow Upload
checkbox on the “Sharepoint Administration” page.
Specifies whether renaming files and directories in the
sharepoint is allowed. The setting reflects that of the
Allow Rename
checkbox on the “Sharepoint Administration”
page. Setting this preference allows changing permissions, too.
Specifies whether copying files to the sharepoint and
creating directories is allowed. The setting reflects that of the
Allow Copy
checkbox on the “Sharepoint Administration”
page.
Specifies whether deleting files in the sharepoint is
allowed. The setting reflects that of the Allow Delete
checkbox on the “Sharepoint Administration” page.
Specifies whether file read access in the sharepoint is
enabled for all users, irrespective of the server file access
settings. Read access includes file download and preview.
The setting reflects that of the Always Allow Reading
checkbox on the “Sharepoint Administration” page. This preference
must first be enabled by the WebShare administration
preference key AllowAllReadWrite.
Specifies whether file read/write access in the sharepoint is
enabled for all users, irrespective of the server file access
settings. Read/write access includes file download, upload
and preview. The setting reflects that of the
Always Allow Read/Write
checkbox in the
“Sharepoint Administration” page. This preference must
first be enabled by the WebShare administration preference
key AllowAllReadWrite.
If set to TRUE
, only layouts of the images in
the sharepoint can be downloaded. The setting reflects
that of the Download Layouts only
checkbox in
the “Sharepoint Administration” page. For this preference
to be enabled, the WebShare File Server preference AllowDownload
must be set to TRUE
.
Specifies one or more user names for which the sharepoint
is available. If no names are specified, the sharepoint is
available for all users. It corresponds to entries in
Allowed Users
on the “Sharepoint Administration” page.
Specifies one or more group names for whose members the
sharepoint is available. If no names are specified, the
sharepoint is available for all groups. It corresponds to entries in
Allowed Groups
on the “Sharepoint Administration” page.
For WebShare, the sharepoint (volume) key is the name of the sharepoint, for example “WebShare Public”, whereas for EtherShare and PCShare the volume key is the directory path, for example “/demovol”.
To set up a sharepoint “Mycompany Public”, similar to the “WebShare Public” by using “prefvalue”, the following prefvalue sequences must be called:
# prefvalue -k "Programs/websharesrv/Shares/Mycompany Public/ Path" -t str "/mycompany/public/WebShare" # prefvalue -k "Programs/websharesrv/Shares/Mycompany Public/ AllowDownload" -t bool TRUE # prefvalue -k "Programs/websharesrv/Shares/Mycompany Public/ AllowPreview" -t bool TRUE
By default, the Publish flag is set, therefore it need not be specified.