Back in the good old days of the Netscape 4.5 suite
(remember that?), the Netscape engineers had built a configuration engine into
the suite, which allowed an automatic configuration of preferences in the Mail
and Communicator components. If I recall correctly, this was called the Client
Customization Kit (CCK) and the engine still exists in Mozilla’s Firefox and
Thunderbird products. Configuration is done via calls to JavaScript
functions such as:
userPref
() sets a user preference.lockPref
() also sets a user preference, but the programs don’t allow a user to change it – therefore the lock.unlockPref
() unlocks the preference, effectively removing a previously locked preference.`
It is good to see that current Firefox builds have the autoconfig built into them again, and we are putting that to use to distribute (and lock down) settings in Firefox, adding a twist to allow per-user customization. In order to do that, we are passing the username from the user’s environment to the autoconfig URL, which can use that username to further customize the returned configuration script. The following snippet (which doesn’t contain error- handling) shows how:
var env_user = getenv("USERNAME");
lockPref("autoadmin.global_config_url",
"http://example.com/conf.php/u=" + env_user);
(It is interesting to note that a question mark (?) doesn’t work in the URI –
that is why we’re using a PATH_INFO to retrieve the username.) The conf.php
script is as complex as you want it to be. A short example:
<?php
$uid = '';
# Extract username into $uid
$path = $_SERVER['PATH_INFO'];
if (preg_match( '|^/u=(.*)|', $path, $m))
$uid = $m[1];
$home = "http://home.example.com/$uid";
?>
lockPref("browser.startup.homepage", "<? echo $home; ?>");
If you don’t feel like reading documentation, there is a CCK add-on that might work for you, but I recommend reading first. If you need inspiration, this site has lots of tips and tricks (some of which may be outdated) on the subject.