@@ -69,7 +69,8 @@ def checkFileInfo(fileid, acctok):
6969 fmd ['IsAnonymousUser' ] = False
7070 fmd ['UserFriendlyName' ] = acctok ['username' ]
7171 fmd ['BreadcrumbFolderName' ] = 'ScienceMesh share' if acctok ['usertype' ] == utils .UserType .OCM else 'Parent folder'
72- if acctok ['viewmode' ] != utils .ViewMode .VIEW_ONLY and srv .config .get ('general' , 'downloadurl' , fallback = None ):
72+ if acctok ['viewmode' ] not in (utils .ViewMode .VIEW_ONLY , utils .ViewMode .EMBEDDED ) and \
73+ srv .config .get ('general' , 'downloadurl' , fallback = None ):
7374 fmd ['DownloadUrl' ] = fmd ['FileUrl' ] = '%s?access_token=%s' % \
7475 (srv .config .get ('general' , 'downloadurl' ), flask .request .args ['access_token' ])
7576 fmd ['BreadcrumbBrandName' ] = srv .config .get ('general' , 'brandingname' , fallback = None )
@@ -87,12 +88,12 @@ def checkFileInfo(fileid, acctok):
8788 fmd ['SupportsUpdate' ] = fmd ['UserCanWrite' ] = fmd ['SupportsLocks' ] = \
8889 fmd ['SupportsDeleteFile' ] = acctok ['viewmode' ] in (utils .ViewMode .READ_WRITE , utils .ViewMode .PREVIEW )
8990 fmd ['ReadOnly' ] = not fmd ['SupportsUpdate' ]
90- fmd ['RestrictedWebViewOnly' ] = acctok ['viewmode' ] == utils .ViewMode .VIEW_ONLY
91+ fmd ['RestrictedWebViewOnly' ] = acctok ['viewmode' ] in ( utils .ViewMode .VIEW_ONLY , utils . ViewMode . EMBEDDED )
9192 # SaveAs functionality is disabled for anonymous and federated users, as they have no personal space where to save
9293 # as an alternate location and we cannot assume that saving to the same folder is allowed (e.g. single-file shares).
9394 # Instead, regular (authenticated) users are offered a SaveAs (unless in view-only mode), where the operation
9495 # is executed to the user's home if no access is given to the same folder where the file is.
95- fmd ['UserCanNotWriteRelative' ] = acctok ['viewmode' ] == utils .ViewMode .VIEW_ONLY or \
96+ fmd ['UserCanNotWriteRelative' ] = acctok ['viewmode' ] in ( utils .ViewMode .VIEW_ONLY , utils . ViewMode . EMBEDDED ) or \
9697 acctok ['usertype' ] != utils .UserType .REGULAR
9798 fmd ['SupportsRename' ] = fmd ['UserCanRename' ] = enablerename and \
9899 acctok ['viewmode' ] in (utils .ViewMode .READ_WRITE , utils .ViewMode .PREVIEW )
@@ -133,7 +134,8 @@ def checkFileInfo(fileid, acctok):
133134 # extensions for Collabora Online
134135 if 'Collabora' in acctok ['appname' ]:
135136 fmd ['EnableOwnerTermination' ] = True
136- fmd ['DisableExport' ] = fmd ['DisableCopy' ] = fmd ['DisablePrint' ] = acctok ['viewmode' ] == utils .ViewMode .VIEW_ONLY
137+ fmd ['DisableExport' ] = fmd ['DisableCopy' ] = fmd ['DisablePrint' ] = acctok ['viewmode' ] in (utils .ViewMode .VIEW_ONLY ,
138+ utils .ViewMode .EMBEDDED )
137139 if srv .config .get ('apps' , 'codedisableexport' , fallback = 'False' ).upper () == 'TRUE' :
138140 fmd ['UserCanNotWriteRelative' ] = fmd ['DisableExport' ] = True
139141
@@ -377,7 +379,7 @@ def putRelative(fileid, reqheaders, acctok):
377379 (acctok ['userid' ][- 20 :], acctok ['filename' ], fileid , suggTarget , relTarget ,
378380 overwriteTarget , reqheaders .get ('X-WOPI-TimeStamp' ), flask .request .args ['access_token' ][- 20 :]))
379381
380- if acctok ['viewmode' ] == utils .ViewMode .VIEW_ONLY or acctok ['usertype' ] != utils .UserType .REGULAR :
382+ if acctok ['viewmode' ] in ( utils .ViewMode .VIEW_ONLY , utils . ViewMode . EMBEDDED ) or acctok ['usertype' ] != utils .UserType .REGULAR :
381383 # UNAUTHORIZED may seem better but the WOPI validator tests explicitly expect NOT_IMPLEMENTED
382384 return utils .createJsonResponse ({'message' : 'Unauthorized to perform PutRelative' }, http .client .NOT_IMPLEMENTED )
383385
0 commit comments