Hello !

We had this subject discussed a few weeks ago, but as it gets more precise, here's a short rationale and a patch (attached) for the desktop-entry-spec.

##############################   Purpose   #############################

The purpose is to hide, in the menus, programs that require elevated privileges from non admin users, therefore reducing application clutter. A side effect would be to allow some distribution maintainers not to manually prepend, for example, "gksudo" to the "Exec" value for these entries.

###########################   Specification   ##########################

The new key is RootRequired=yes|no|optional. It basically specifies whether the program needs elevated privileges ; if "optional", the program needs the privileges to fulfill all of its capabilities, but can still be run and provide useful information if it hasn't.

###############   Possible implementation and rationale   ##############

Now, apart from the spec, here's the most probable interpretation of this. A boolean environment variable (USER_IS_ADMIN) could be set, each distribution using its preferred way (for example, Ubuntu has an "admin" group) to set it. Then the values of RootRequired would be used as follows :

* "yes" : if USER_IS_ADMIN == 1, display the entry in the menus and use elevated privileges (eg prepend "gksudo" to the Exec value). Otherwise, hide the entry from the menus.

* "no" : do nothing (do not hide the entry, do not modify the Exec value).

* "optional" : do not hide the entry. If USER_IS_ADMIN == 1, use elevated privileges ; otherwise, don't.

* If USER_IS_ADMIN is not set or the RootRequired key doesn't exist in the entry, assume the value is "no".


Doing this will allow the following :

1) Non-admin users don't see all these programs for which they don't have the authorization anyway.

2) Elevated privileges are automatically used when needed.

3) Some programs, for example package management tools, can be run without elevated privileges (eg list installed packages, search for a particular package), but still need them for more control (eg actually install new packages). By using the "optional" value, non-admin users can still perform non-admin actions, while admin users can use the full capabilities of the program.


That's it :o) The attached patch adds the RootRequired key to the desktop-entry-spec. Can it be committed ?

Cheers,
Manu Cornet
? desktop_entry_spec_add_root_required_key.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/menus/desktop-entry-spec/ChangeLog,v
retrieving revision 1.8
diff -r1.8 ChangeLog
0a1,4
> 2005-08-29  Manu Cornet <[EMAIL PROTECTED]>
> 
> 	* desktop-entry-spec.xml: added the RootRequired key.
> 
Index: desktop-entry-spec.xml
===================================================================
RCS file: /cvs/menus/desktop-entry-spec/desktop-entry-spec.xml,v
retrieving revision 1.9
diff -r1.9 desktop-entry-spec.xml
604a605,616
> 	  <row>
> 	    <entry id="key-rootrequired"><varname>RootRequired</varname></entry>
> 	    <entry>
> 	                Specifies whether the program needs elevated privileges (<varname>yes</varname> or 
> 			<varname>no</varname>). If <varname>optional</varname>, the program needs elevated
> 			privileges for full capacities, but can work and provide useful information without.
> 	    </entry>
> 	    <entry>string</entry>
> 	    <entry>NO</entry>
> 	    <entry>NO</entry>
> 		<entry>1</entry>
> 	  </row>
_______________________________________________
xdg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to