Open Bug 471572 Opened 16 years ago Updated 2 years ago

lockPref("mail.smtpserver.smtp1.*", ...) locks UI controls when it should not

Categories

(Thunderbird :: Preferences, defect)

defect

Tracking

(Not tracked)

People

(Reporter: Parasyte, Unassigned)

References

(Blocks 1 open bug)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008121622 Ubuntu/8.10 (intrepid) Firefox/3.0.5
Build Identifier: Thunderbird/2.0.0.18

We use Thunderbird in a corporate environment with the Mission Control Desktop to remotely administrate the Thunderbird setup. We would like to lock certain prefs to prevent them from being changed by the user. For example, locking the IMAP and SMTP server settings so users cannot [un]intentionally break their mail client.

That said, we also want the users to be able to add their own IMAP/POP3/SMTP servers for personal email, if they would like. Our current configuration allows this by using defaultPref() on prefs that must not be locked for this kind of se4tup to work;

defaultPref("mail.smtp.defaultserver", "smtp1");
defaultPref("mail.smtpservers", "smtp1");

This makes Thunderbird setup our SMTP server on first run, but allows adding additional SMTP servers. (So far, all of this works as expected.)

However, if you were to lock any of the following prefs:

mail.smtpserver.smtp1.description
mail.smtpserver.smtp1.username
mail.smtpserver.smtp1.hostname
mail.smtpserver.smtp1.port
mail.smtpserver.smtp1.auth_method
mail.smtpserver.smtp1.try_ssl

Then you would be unable to add any additional SMTP servers in the UI, because the controls associated with these prefs will be disabled/read-only.

The controls should only be disabled/read-only when clicking the "Edit" button when associated SMTP settings are actually locked; NEVER when clicking the "Add" button.


On a related note, the checkbox for ".auth_method" is never disabled/read-only, though it should be.

Workaround: Use pref() instead of lockPref() on mail.smtpserver.smtp*.* prefs; the user can change these at runtime, but they will reset to your settings when Thunderbird is restarted.

Reproducible: Always
Version: unspecified → 2.0
Jason I'm pretty sure Thunderbird 3.0b2 behaves the same could you check please ?
Component: Account Manager → Preferences
QA Contact: account-manager → preferences
I just checked with 3.0b3pre (yesterday's nightly build):

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b5pre) Gecko/20090427 Shredder/3.0b3pre

Yes, it exhibits this bug as well. Changing version to trunk.
Version: 2.0 → Trunk
confirming 3.04
Status: UNCONFIRMED → NEW
Ever confirmed: true
hmm, this is odd none of my smtp settings are locked when using offical Linux version.
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4
Timo, do you think this is something a lot of enterprises would like to have?
Not sure for "lot of" but I think "many" would benefit from it. Roaming laptop users that need to send mails using something else than corporate smtp server for example might need to be able to set additional servers in their list. Mobile users in general get more and more common every day, so we need to think what they need as well as desktops. Of course authenticating corporate smtp server would be solution, but that's not the case for everyone (many simply don't allow access to their smtp server from outside).

In short: yes.
Creation of SMTP servers are using the same .xul and .js files that the edition of them. The only difference is that when we want to add a new one, we pass null to the function.

The problem could be on function disableIfLocked in file mailnews/base/prefs/content/smtpEditOverlay.js

This function is checking locked preferences for default SMTP server only:

function disableIfLocked(prefstrArray)
{
 let finalPrefString = "mail.smtpserver." +
    MailServices.smtp.defaultServer.key + ".";
 let smtpPrefBranch = Services.prefs.getBranch(finalPrefString);

  for (let prefstring in prefstrArray)
    if (smtpPrefBranch.prefIsLocked(prefstring))
      prefstrArray[prefstring].disabled = true;
}

For new servers, as we don't have a serverKey, some default setting (mail.smtpserver.default.*) should be looked for locked preferences, not default SMTP server.

When we are editing a server, however, we must look for preferences on that specific (existing) server.

Also look bug 755885.
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.