[PATCH] [REVIEW:3-5] fdo#47937 UI locks read-only when partial write privilege

Lionel Elie Mamane lionel at mamane.lu
Tue Mar 27 02:03:08 PDT 2012


Attached patch fixes fdo#47937, namely that if the current user has
privileges to UPDATE or INSERT only some columns of table tbl, then
the Base UI locks the whole tbl for insertion or editing, and does not
let the user add new rows, nor edit the columns (s)he *is* allowed to
insert / edit.

This patch may look like an ugly hack, but not that much:

See http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getTablePrivileges(java.lang.String,%20java.lang.String,%20java.lang.String)
which says:
 Note that a table privilege applies to one or more columns in the
 table. It would be wrong to assume that this privilege applies to all
 columns (this may be true for some systems but is not true for all.)

Which means that at least some JDBC drivers will return a privilege
(for the table) even when the privilege is only over one column among
several. So this patch actually unifies the situation "manually" so
that Base works well with all drivers: those that list a privilege as
soon as one column, and those that list a privilege only if all
columns (and then give the detailed privileges in
getColumnPrivileges).

Future enhancement: selectively lock columns / controls depending on
privileges on the underlying column.

Please apply to libreoffice-3-5.

-- 
Lionel


More information about the LibreOffice mailing list