PasswordProtectedPreferences

From Wiki.ooo4kids.org

Jump to: navigation, search


Password preferences


All the changes added to the original OpenOffice.org source code provided in this page, are :


Important: If you use this information, don't forget everything you'll find here is under CC by-sa License, and you must mention your sources in what you write ...


Introduction

Below, you'll find a technical description of the New password protected preferences feature. It is question of OpenOffice.org source code (mainly C++). More precisely, you'll find there the new SfxPasswordDialog implementation, the new UI (green/red padlocks), the description of how read/write a password, a boolean, a value in the Common.cxu file (mostly UNO stuff), the description of the changes in the classes : OfaMiscTabPage (add buttons, and manage them), OfaTreeOptionsDialog (managing the changes in the prefs, depending the state of the feature, enabled/disabled).

The pre-requisites to read this article still have to be defined, but if the reader is not used with some notions, we invite him to have a look at the OpenOffice.org wiki to complete his knowledge, and read this article in the best conditions.


DRAFT, NEEDS MORE WORK

The idea is to protect the preferences using a password (default password is prof), to avoid the children changing something in the prefs, causing disorder.

Principles

Children love to experiment. Most of them have good skills for that, but this is not what the teacher expects :-) So, the goal of this feature, is to implement, intelligently, a protection for the preferences, who :

Important : this feature is only a protection to avoid children hacking the OOo4Kids, but not a security (the password is readable in Common.xcu)


The Rules :

=> Be carefull : the protection will be validated once you close the dialog box, and this change is not reversible ! Means once activated, you'll need the password to disable that.

The views  :

(green) Padlock unlocked

Green padlock : modifications authorized


(red) Padlock locked

Red padlock : modifications not possible

Disable the protection

Entering password to disable the protection

Change the password

Changing the current password for a new one


Attention : the toolbars will stay customizable.

Example of Scenarios

Password protected preferences Scenario #01


Design

=> Work in progress

Concerned modules :

To keep the clean state, and separate the changes from OpenOffice.org, the new file passwd_OOo4Kids.cxx has been added in sfx2/source/dialog

Implementation

New methods and roles

Added in SfxPasswordDialog class

Comment : an OUString, who returns the password contained in the Common.xcu, in the UserPrefsPassword property. This method is a public method of the SfxPasswordDialog class.

Comment : a void public method of SfxPasswordDialog, to write the new password in the .xcu, in the UserPrefsPassword property.


Added in OfaMiscTabPage class

Comment : a getter, as bool, who returns the state ( true, false) of both in UserPrefsPasswordFeatureEnabled and UserPrefsPasswordNeverModified properties, to know whether the feature is or not enabled, or whether it was used at least once. The need is to enable/disable the "Change the password" feature, accordingly to the returned value.

Comment : a setter, as void, used to write a bool value both in UserPrefsPasswordFeatureEnabled and UserPrefsPasswordNeverModified properties, in the Common.xcu

Comment : a callback, used to perform the action : open the "Change the password dialog box", if and only if the button is enabled

Comment : a callback, used to perform the action : set/unset the checkbox "Activate the password", if and only if the user is allowed to modify the preferences

Comment : public OfaMiscTabPage method, used to retrieve the state of the prefs (locked/unlocked)


Added in OfaTreeOptionsDialog class

Comment : a callback used to perform the action lock / unlock the preferences when the user clicks on the padlock, whatever its color is.

Comment : load the image on the ImageButton control. WARNING : used more than once for a button, caused garbage and undefined behavior.

Comment : method called in the OfaTreeOptions constructor.

Model

View

Controller

=> TBD


The controller should be based on:



DRF Star.png Ideas

As we are talking about preferences of OOo4Kids : I think we have also to review the content and the layout of this dialog box.

Because :

This is a critical related OpenOffice globaly. I think we have to keep only the majors setting and to make it clear to understand.

Another idea could be to have a Preference panel for the children with a reduce set of settings and another one with more options for the teachers. Of course it will not replace the password options proposed in this page but be a complement. Lafonjm 21 avril 2009 à 09:10 (CEST)

DRF Public.png To do

DRF Globe.png External links

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox