Bug 66398 - FILESAVE: DOCX export document: 'Restrict Editing' is lost on roundtrip (because not imported)
Summary: FILESAVE: DOCX export document: 'Restrict Editing' is lost on roundtrip (beca...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: high major
Assignee: Serge Krot (CIB)
URL:
Whiteboard: BSA target:6.0.0
Keywords: filter:docx, notBibisectable
Depends on: 66397
Blocks: Track-Changes DOCX-Doc-Protection
  Show dependency treegraph
 
Reported: 2013-06-30 13:23 UTC by Adam CloudOn
Modified: 2019-02-08 18:21 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
DOCX containing 'Restricted' paragraphs and an 'Editable' paragraph (10.18 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-06-30 13:23 UTC, Adam CloudOn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam CloudOn 2013-06-30 13:23:30 UTC
Created attachment 81742 [details]
DOCX containing 'Restricted' paragraphs and an 'Editable' paragraph

Problem description: 
When you load a DOCX that has a protection of type 'Restrict Editing' - LO loads it with no protection (I have opened a bug for the 'import' side in https://www.libreoffice.org/bugzilla/show_bug.cgi?id=66397).

When you save the file back to a DOCX - the 'Restrict Editing' is lost, and when opening the file in Word - the user can edit anything he wants in the document.

Password to disable restrictions is '12345'.

Steps to reproduce:
1. Open the attached DOCX in LO
2. Save as a NEW.DOCX
3. Open the NEW.DOCX in Word
4. You can now edit anything in the document

Current behavior:
'Restrict Editing' is lost.
The user can edit anything in the NEW.DOCX in Word.

Expected behavior:
'Restrict Editing' should be preserved.
The user should be allowed to edit only the editable sections in the document.
              
Operating System: All
Version: 4.2.0.0.alpha0+ Master
Comment 1 Adam CloudOn 2013-06-30 13:26:21 UTC
The nodes that are not imported are:
 -   <w:permStart> in the 'document.xml' file.
 -   <w:permEnd> in the 'document.xml' file.
 -   <w:documentProtection> in the 'settings.xml' file.
Comment 2 Adam CloudOn 2013-06-30 13:35:35 UTC
> The nodes that are not imported are:
Of course, I meant 'the nodes that are not exported are'
Comment 3 Cor Nouws 2013-07-01 07:49:31 UTC
See my comment with bug 66397 ?
Comment 4 Jorendc 2013-07-01 09:31:35 UTC
I can confirm this behavior using Mac OSX 10.8.4 with LibreOffice Version: 4.2.0.0.alpha0+ Build ID: 9ab800829b8a0e44824dc11276b54b1870bc5b2b in combination of Word for Mac 2011.

'Data loss' - > major high in this case :)

Kind regards,
Joren
Comment 5 QA Administrators 2015-04-01 14:41:54 UTC Comment hidden (obsolete)
Comment 6 Buovjaga 2015-04-27 09:36:26 UTC
Reproduced with attachment 81742 [details].

Win 8.1 32-bit
MSO 2013
LibO Version: 5.0.0.0.alpha1+
Build ID: f0edb677f09ad338e22ac3b5d91497b4479e0b3c
TinderBox: Win-x86@39, Branch:master, Time: 2015-04-27_00:34:58
Locale: fi_FI
Comment 7 QA Administrators 2016-09-20 09:32:23 UTC Comment hidden (obsolete)
Comment 8 Justin L 2016-12-09 09:07:18 UTC
confirmed protection is not exported (and not imported) still exists on Ubuntu 16.04 with LO5.3beta1.
used bibisect43all oldest and was not able to import/export the protection, so marking as notbibisectable/inherited.
Comment 9 Serge Krot (CIB) 2017-10-05 07:54:47 UTC
Implemented:
-    import/export document protection settings
-    added unit test for checking of import/export document protection settings. Now we have 3 unit tests:
--    DECLARE_OOXMLEXPORT_TEST(testSectionProtection, "sectionprot.odt")
--    DECLARE_OOXMLEXPORT_TEST(testTDF99434, "protectedform.docx")
--    DECLARE_OOXMLEXPORT_TEST(tdf66398_permissions, "tdf66398_permissions.docx")
Comment 10 Commit Notification 2017-10-06 06:07:57 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2694162969cf86ef366d3ce812fccd0630acc800

tdf#66398 Import/export docx document protection properties

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2017-10-06 17:14:11 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=40f627c28deb9c7eacd77c4a2c4e2eb919d5cf88

tdf#66398 Remove double initialization of the form protection

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2017-10-06 17:15:29 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4054051cd5aee8cbc6cd2b3384b4ab3d6b6a6ace

tdf#66398 Do not output document protection in docx twice

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2017-10-06 17:16:47 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f4cbd31465d3737855e694b7341fb3bc063d63c4

related tdf#66398 remove useless breaks

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Serge Krot (CIB) 2017-10-09 10:31:47 UTC
Implemented:

-    Permission ranges are parsed using temporary structure inside DomainMapper_Impl in the same way as parsing of bookmarks was done.
-    When complete permission range is parsed we add a new bookmark with special name. Syntax is:
--        "permission-for-user:<permission-id>:<permission-user-name>"
--        "permission-for-group:<permission-id>:<permission-group-name>"
-    During output into DOCX we intercept such names and perform output of the w:pernStart and w:PermEnd nodes instead of w:bookmarkStart and w:bookmarkEnd.
-    All other output formats will have additional bookmarks range indicating former permission ranges inside DOCX input file.
Comment 15 Commit Notification 2017-10-10 17:35:55 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f5c266695a4a88da7db971a21915e2bbf758d48e

tdf#66398 Parse and output permissions for DOCX using bookmarks

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Serge Krot (CIB) 2017-10-11 08:02:30 UTC
Implemented:
* Enhanced unit test: check permissions at content level, see DECLARE_OOXMLEXPORT_TEST(tdf66398_permissions, "tdf66398_permissions.docx").
Comment 17 Commit Notification 2017-10-13 08:28:44 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8b7910e0ba63aebb6fd6befa937259420f7266f3

tdf#66398 Enhance unit test: check permissions at content level

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2017-10-16 08:39:00 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1818bffa3e97a47f5bdde0bca9ea6679b93543d2

tdf#66398 Fix copy-paste: call start() bookmark instead of end()

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.