Hi Christian,

Christian Andersson wrote:

I need to be able to "lock" certain options on Openoffice so that the user cannot change these values (he should be able to change other values though...)


You can do that with the existing configuration system, but there currently is no API to control the locking.


after searching a while through the developer guide and several more places, i was thinking that I might be able to do this through the slots-usage where I probably can lock down the particulare settings in the OOo gui so that the user cannot change the values from within openoffice, while this will work with 98% of all the users that is going to run openoffice (students in a school) the remaining 2 percent will probably figure out that they can edit the settings by hand by editing the configuration files (I cannot lock these down for editing in the filesystem, since they should be able to change some settings but not all)


You need a decent OS/file system, so that you can prevent your users from changing files in the OOo program installation (or another directory).


after reading some more I was thinking that I might be able to do this by using a configuration backend that ties into OOo and makes sure that the settings are what they should be when the user starts OOo (so even if he manually changes the file, the "locked" properties will remain with the values I have set.


Even now OOo merges data from multiple locations. These locations all use the same file-based backend. Of course the files holding the user preferences need to be placed in a user-writable location. But the files holding default values can (and should) be placed in a location that is not writable by the user. By default this is under the OOo installation directory. With a standard multi-user installation this will be non-writable for ordinary users both on un*x systems and on Windows 2000/XP (with NTFS and appropriately restricted user accounts).


Now default entries can be marked as locked by adding the XML attribute 'oor:finalized="true"' to the entry. This will have two effects: (a) The OOo configuration API will not permit changing such a value and (b) an existing value for this setting in the user preferences will be ignored.

Currently you need to add these attributes manually using a text or XML editor. For StarOffice there exists a Configuration Manager, which can do this, but it needs an LDAP directory. As mentioned the API does not currently support this. The files containing the defaults are in $install/share/registry. But you can even add your locking (and your version of the mandatory or default values) by installing a configuration file as shared UNO package (see developer's guide).

anyway, looking over the developers guide, and using google, I cannot find any good information on how to code this configuration backend (using java) so I was wonderign if anyone in here have done anything similiar and might be able to help me!


You should not need to do this. And using a Java configuration backend has not been tested. I am pretty sure that in OOo 1.1.x this won't work (as UNO-Java reads some settings from the configuration there). In OOo 2.0 this ought to be possible.


If you cannot prevent the student hackers from tampering with the installation files, you probably have a problem anyhow.

Unfortunately one problem remains: Not all of the OOo components check for locked settings. Thus in many cases the Tools-Options dialog does not disable controls for locked settings. In some cases the values you modify there are even used by the controlled component. The internal failure to save the changes to the configuration system is silently ignored. As a result users can change these settings temporarily - their changes will be gone when the office is restarted. We are trying to fix this, but we didn't fix as many cases of this as we would like even for OOo 2.0. If you find occurances of this that are important to you, please file an issue. Knowing that actual users are impacted helps us prioritize the fixes.

If you need more information check the documentation of the configuration system at http://util.openoffice.org or ask again on the lists.

Ciao, Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to