Commit graph

46 commits

Author SHA1 Message Date
Miklos Vajna
0f2fa202c0 LocalStorage::LocalFileInfo: make members private
Change-Id: Ibdbf35275e2b2f0b935a301fe77a54aef51e4514
2018-11-27 09:09:29 +01:00
Miklos Vajna
2751f2aeba WopiStorage::WOPIFileInfo: make members private
Change-Id: I62b709acf856b86a8880a517f45152abfa6e32b2
2018-11-21 09:08:00 +01:00
Henry Castro
665863b50a wsd: wopi: introduce a "EnableShare" entry in the CheckFileInfo
Change-Id: Ia47d7e8f5c8cd8ae1eb314467c664b27b50e7fd3
2018-10-31 18:12:07 +01:00
Henry Castro
8643128180 wsd: wopi: introduce a "EnableInsertRemoteImage" entry in the CheckFileInfo
Change-Id: I66e5f12fbd49509ce8e82ea07ae7a2cc75ddc665
2018-10-31 18:12:07 +01:00
Tamás Zolnai
bb50c9e0cd Enable convert-to features for wopi hosts
Change-Id: I994be7087247215b09d117df18b661906d941266
2018-10-20 13:26:38 +02:00
Tamás Zolnai
ec65ecd0f1 Revert "Revert "Enable convert-to features for wopi hosts""
This reverts commit 343ba48d27.
2018-10-20 12:57:53 +02:00
Tamás Zolnai
343ba48d27 Revert "Enable convert-to features for wopi hosts"
This reverts commit 8dd28ed664.
2018-10-20 12:55:55 +02:00
Tamás Zolnai
8dd28ed664 Enable convert-to features for wopi hosts
Change-Id: I8aa37c61f3df5356fb7a14d93cda6279e7ec3cf1
2018-10-19 18:15:22 +02:00
Ashod Nakashian
1d5b6ca20b wsd: use obfascated user id when provided by WOPI
Change-Id: I69a17dff0e5e6b27e4538d9fe9019e4d1eebb16f
Reviewed-on: https://gerrit.libreoffice.org/57171
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 62dadb8aaa5cf9ba8cbbe0bc7f84dfc1076104c1)
2018-10-16 20:12:23 -04:00
Jan Holesovsky
6ec9b5c836 anonymization: Anonymize uri's in the storage
(cherry picked from commit 34359547cc735ebae4014837bcb92b7f0136bdf0)

Change-Id: Ifba57c5c765b9f2291255cc7de567520a21370ef
2018-10-16 20:12:23 -04:00
Ashod Nakashian
7f569a61dc wsd: anonymize jailed filename
Change-Id: I0af46ae6779caf9851e3142889940e4f774f9eb9
2018-10-16 20:12:23 -04:00
Ashod Nakashian
b3bdd5786d wsd: support optional forcing tracking changes at load
Since changing the tracking state is done by toggling,
we need to wait to get the current state at load time
before we can tell whether we need to toggle it or not.

Change-Id: Ib5a2639b2acf3874c191971eedf9a3bebcefebad
Reviewed-on: https://gerrit.libreoffice.org/53415
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-06-14 17:00:39 +02:00
Marco Cecchetti
6a0fcdf15f wopi flag for hiding the change tracking controls from UI
Change-Id: I1b9aa4f8111d77ae12093022205fad1cbee850ac
Reviewed-on: https://gerrit.libreoffice.org/53335
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-04-24 18:15:44 +02:00
Ashod Nakashian
8ad29ee050 wsd: separate lastSaveTime from lastSaveResponseTime
Previously we assumed we are saving based on
lastSaveTime, which is incorrect because it
is set only upon successful saving and storing,
which might fail.

Now lastSaveResponseTime is used to track whether
there are saving requests in flight. And lastSaveTime
is only used when we do store the document in storage.

Change-Id: I73e5c04432981d0cca11b8cf854414738bd894de
Reviewed-on: https://gerrit.libreoffice.org/47884
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-15 15:02:40 +01:00
Tor Lillqvist
7c77a6c3a3 Add handling of "prefilter" plug-ins
When the name of a document to be edited ends with an extension
matching that mentioned in a prefilter plug-in's configuration file,
the command specified is run and it is the output file that is
actually edited.
2017-11-13 16:27:53 +02:00
Jan Holesovsky
6745464c70 tdf#99744 SaveAs: Report back to loleaflet that the saveas succeeded.
Change-Id: I670c8b4503c1a4c0a88001a1343f6dec2974e044
2017-10-26 11:11:38 +02:00
Jan Holesovsky
7ff432a370 tdf#99744 SaveAs: Reimplementation of the PutRelativeFile going through Kit.
This is necessary so that changing of the file type works.

Includes a unit test.

Change-Id: Id01d44e555b6bac1002ff950de461fd330602f63
2017-10-26 11:11:38 +02:00
Jan Holesovsky
f4198526ca tdf#99744 SaveAs: Reverts parts of the previous Save As work.
It is necessary to go through the Kit when performing the Save As, so that we
can change the file type, sync with loading the file, etc.
2017-10-26 11:11:38 +02:00
Pranav Kant
6a73c19d16 Show save-as option based on CheckFileInfo params
If UserCanNotWriteRelative is mentioned in the CheckFileInfo response.

Change-Id: I33d2e21159b3e18ae88fd72f404f2d1d1d9b64e5
2017-10-03 20:58:36 +05:30
Jan Holesovsky
7f49b1eba6 PutFile ext: X-LOOL-WOPI-IsAutosave header to indicate autosave + unit test.
Change-Id: I65ed711dae5100467fe6ed9902bd7bad8c7f8d68
Reviewed-on: https://gerrit.libreoffice.org/43074
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-10-03 12:04:18 +02:00
Jan Holesovsky
5c604e9f78 PutFile ext: X-LOOL-WOPI-IsModifiedByUser header to indicate modifications.
Change-Id: I5d69903211045969d678df695717eae7452e7f04
Reviewed-on: https://gerrit.libreoffice.org/42852
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-09-27 16:36:02 +02:00
Miklos Vajna
bcb5b744b8 net, wsd: fix -Werror,-Wdelete-non-virtual-dtor warnings
Two problem types:

- non-final class has virtual functions but no virtual dtor -> mark the
  class final
- abstract class has no virtual dtor -> add a virtual dtor

Change-Id: Iae208b65c774e6da7a3dda5e725fe07d4d589e4f
2017-09-12 10:03:32 +02:00
Marco Cecchetti
dee39a562c support for rendering a watermark on each tile
Change-Id: I3edccac49a3bcd3d2493d8d7ef3a1ae29307e727
Reviewed-on: https://gerrit.libreoffice.org/41898
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-09-07 17:28:44 +02:00
Jan Holesovsky
f7c199684c WOPI extension: DisableInactiveMessages to avoid showing message when dimmed.
Change-Id: I925602295dde95611ab1a6565dd7266460769a50
Reviewed-on: https://gerrit.libreoffice.org/41709
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-08-29 19:44:33 +02:00
Pranav Kant
769e41dfb2 Fix build
Mismerge. There is no session->getAccessToken now

Change-Id: I4d8f2cc612cbd39b3163bcdbba5df8ea5d732774
2017-08-18 07:14:33 +05:30
Aditya Dewan
c3711a4375 Extending WOPI implementaion to introduce 'Save As' feature
Change-Id: Ic4c80f4c4b54944143682c25a5878c1336787b27
Reviewed-on: https://gerrit.libreoffice.org/40946
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-08-17 19:25:44 +02:00
Jan Holesovsky
afcfac4bef access_header: Infrastructure for providing custom headers for authentication.
Change-Id: I52e61dc01dbad0d501471e663aaf364d9bc23c52
Reviewed-on: https://gerrit.libreoffice.org/41223
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-08-17 13:40:57 +02:00
Ashod Nakashian
194faa6d69 wsd: force readonly for view file types per discovery.xml
File extensions marked as view (as opposed to edit)
in discovery.xml are now forced to be read-only,
regardless of what the client tries to request.

Change-Id: I3eb00c33ff716800dc317f7377281c6d5f0909d7
Reviewed-on: https://gerrit.libreoffice.org/38480
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-07 06:02:30 +02:00
Pranav Kant
41234773e3 If user permits, save to storage force-fully in case of doc conflict
There is one known problem still - after any user decides to overwrite
the file to storage, other users are not informed, so their dialog keeps
hanging on the screen until they press the cancel or reload button.

Change-Id: I6dad1585e4c53eeed79cd38316892a7f239d44ef
2017-06-01 19:53:10 +05:30
Pranav Kant
4d61cae4c8 If user commands, refresh the document for all in case of doc conflict
Change-Id: I42c61fb8099b0bcc60f942e602561cc97486a918
2017-06-01 19:46:38 +05:30
Pranav Kant
ba4e75cfae Inform all clients when document changed behind our back
Introduce a new header X-LOOL-WOPI-Timestamp

This is a WOPI header extension to detect any external document change. For
example, when the file that is already opened by LOOL is changed
in storage.

The WOPI host sends LastModifiedTime field (in WOPI specs) as part
of the CheckFileInfo response. It also expects wsd to send the
same timestamp in X-LOOL-WOPI-Timestamp header during WOPI::PutFile. If
this header is present, then WOPI host checks, before saving the
document, if the timestamp in the header is equal to the timestamp of
the file in its storage. Only upon meeting this condition, it saves the
file back to storage, otherwise it informs us about some change
to the document.

We are supposed to inform the user accordingly. If user is okay
with over-writing the document, then we can omit sending
X-LOOL-WOPI-Timestamp header, in which case, no check as mentioned above
would be performed while saving the file and document will be
overwritten.

Also, use a separate list of LOOL status codes to denote such a change.
It would be wrong to use HTTP_CONFLICT status code for denoting doc
changed in storage scenario. WOPI specs reserves that for WOPI locks
which are not yet implemented. Better to use a separate LOOL specific
status codes synced across WOPI hosts and us to denote scenario that we
expect and are not covered in WOPI specs.

Change-Id: I61539dfae672bc104b8008f030f96e90f9ff48a5
2017-06-01 16:17:07 +05:30
Pranav Kant
d840e8720a Handle WOPI PutFile unauthorized access token
Change-Id: I29ee8cc0c9f3ea42f70628eca6f74d161d1a38f9
2017-05-31 12:08:31 +05:30
Ashod Nakashian
da2d3cbc92 wsd: support per-user links and commands
userextrainfo is a json array that contains
extra user-specific links.

Currently 'avatar' is assumed to hold the
image url for the user's avatar.

'mail' and other links can also be added.

Change-Id: I37c4c68bfa0b7ee659e017b4867dcb8cf5c2ca2f
Reviewed-on: https://gerrit.libreoffice.org/38120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:45:18 +02:00
Jan Holesovsky
9db41725f4 Revert "wsd: use WOPI host instance ID to support hostname aliases"
Turns out this introduces two calls to the CheckFileInfo which is not really
what we should be doing; instead, let's do a kind of cannonicalization in the
WOPI host directly.

This reverts commit ec2fd0844f.

Change-Id: I311bf8a45b706ed9a4d8cd00db0a990ac6d461b4
2017-05-19 10:34:38 +02:00
Ashod Nakashian
ec2fd0844f wsd: use WOPI host instance ID to support hostname aliases
The docKey creation moved to Storage where we first
invoke WOPI (if/when it's a WOPI-hosted doc and WOPI enabled)
and see if the user has access to the document at all.
If they do, we expect the server to give us a
unique ID to use for identifying the host regardless
of hostname aliases.

If a unique ID is not returned (i.e. empty or missing)
we use the hostname and port in its place as fallback.
This will break hostname aliases, but it will still work.

Change-Id: I407b0087395f9df6ad9cc6e037570487999be4a4
Reviewed-on: https://gerrit.libreoffice.org/37697
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-17 04:18:31 +02:00
Jan Holesovsky
95e892168c wsd: When connecting new sessions, always use the original URI...
...but in combination with the appropriate session's access_token to always
authenticate against the same instance of the WOPI host.

Change-Id: Ic94dfa8fcb226a2d134272b22edc1f8f76c24e34
2017-05-12 18:07:23 +02:00
Ashod Nakashian
0314f8751c wsd: fix saving of modified documents
Detection of modified documents used the
directory path rather than the document
path, which obviously wasn't correct.

Change-Id: I4a054a9ce2b64d70cd7a0a1c488dcc38ef46a581
Reviewed-on: https://gerrit.libreoffice.org/35526
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-22 02:59:30 +00:00
Ashod Nakashian
57212b69b8 wsd: take snapshot of source file before trace recording
Change-Id: Ia3e25467a20d2442dcf0497c21a8fdce2efedbc2
2017-02-05 21:59:23 -05:00
Ashod Nakashian
dc57cf8d3c wsd: 0-byte files are valid and LO loads them as new docs
Change-Id: Icf0cdd05ca7397f29bf66139d4ef15ef86ec05fd
Reviewed-on: https://gerrit.libreoffice.org/33141
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 06:26:22 +00:00
Ashod Nakashian
aef5af8114 wsd: Storage logs updated
Change-Id: Ib3083e833fdc2891ab0c89231bf2ec3e81285803
Reviewed-on: https://gerrit.libreoffice.org/32560
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 04:19:47 +00:00
Noel Grandin
4199efc91c convert enums to scoped
Change-Id: Ic3d4c09dbcec28b4638bb8888f812f970f40a1c5
Reviewed-on: https://gerrit.libreoffice.org/32331
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-22 09:51:56 +00:00
Tor Lillqvist
45aad66e65 Inititalize _fileInfo's dummy timestamp in StorageBase ctor as the epoch
And not as the current time. The getLocalFileInfo() and
getWOPIFileInfo() functions will reset it anyway.

Change-Id: Ief821482cf789113cecd85e5d59afecf6ad2c3ab
2016-12-19 14:33:30 +02:00
Tor Lillqvist
889adad09a As the code is now, no need for StorageBase::getFileInfo() to be virtual
It would be another thing if it would be abstract and overridden in
the concrete derived classes. But now it just returns the _fileInfo
field that is set by the separate getLocalFileInfo() and
getWOPIFileInfo() functions. Possibly this should be re-designed
and/or stuff re-named for clarity.

Change-Id: I30d01277ac0c6bd4b9daa317aade319b6ef39342
2016-12-19 14:33:30 +02:00
Pranav Kant
6affbb307c wsd: Allow hosts to disable print, export
using these WOPI protocol extensions: DisablePrint,
DisableExport, DisableCopy. All assumed to be false if not
provided.

Change-Id: I415597d710107f9d8cbb8757f361365cc2a88eb1
2016-12-13 17:45:16 +05:30
Pranav Kant
3e2a9df6dd wsd: Store wopifileinfo separately per client session
Client needs to act accordingly as per permissions/settings set
by the WOPI host.

Change-Id: I7c9f311be50d4aff2562da0cfef2fff889f111d0
2016-12-13 17:45:16 +05:30
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Renamed from loolwsd/Storage.hpp (Browse further)