Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ParentId in OCS and webdav REPORT responses #4727

Closed
kulmann opened this issue Sep 30, 2022 · 6 comments · Fixed by #4750 or #4757
Closed

Add ParentId in OCS and webdav REPORT responses #4727

kulmann opened this issue Sep 30, 2022 · 6 comments · Fixed by #4750 or #4757
Assignees
Labels
Priority:p2-high Escalation, on top of current planning, release blocker

Comments

@kulmann
Copy link
Member

kulmann commented Sep 30, 2022

Web offers a navigation into parent folders in various pages / situations:

  • for file listings on search result page or in the search preview items (each file can and likely has a different parent)
  • share listings on shared with others / shared via link pages (each shared file could have a different parent)
  • in personal/project spaces when looking at the Shares section in the right sidebar of a subfolder or file of a shared parent folder
  • (in the future: favorites listing)

In order to solve owncloud/web#6247 we need to be able to include the file id of the respective parent into the navigation.

As a result, the GA blocking requirement is: Web needs the parent id of files/folders listed in OCS share and webdav REPORT responses.

Edit: The property already exists in the OCS APi and is called file_parent, hence a fitting name for WebDAV would be oc:file-parent.

Solution

Webdav PROPFIND

<d:multistatus xmlns:s="http://sabredav.org/ns" xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
    <d:response>
        <d:href>/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d/</d:href>
        <d:propstat>
            <d:prop>
                <oc:id>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:id>
                <oc:fileid>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:fileid>
                <oc:spaceid>cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:spaceid>
                <d:getetag>"616a5099844d1048bf438783e33f21eb"</d:getetag>
                <oc:permissions>SRDNVCK</oc:permissions>
                <d:resourcetype>
                    <d:collection/>
                </d:resourcetype>
                <oc:size>197</oc:size>
                <d:getlastmodified>Fri, 23 Sep 2022 08:17:43 GMT</d:getlastmodified>
                <oc:favorite>0</oc:favorite>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <oc:file-parent></oc:file-parent>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d/.space/</d:href>
        <d:propstat>
            <d:prop>
                <oc:id>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!0741cf1f-1e87-45fa-9296-b21ee44ba741</oc:id>
                <oc:fileid>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!0741cf1f-1e87-45fa-9296-b21ee44ba741</oc:fileid>
                <oc:spaceid>cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:spaceid>
                <oc:file-parent>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:file-parent>
                <oc:name>.space</oc:name>
                <d:getetag>"9a44b1cfc90376074b6b5399f49ae226"</d:getetag>
                <oc:permissions>RDNVCK</oc:permissions>
                <d:resourcetype>
                    <d:collection/>
                </d:resourcetype>
                <oc:size>197</oc:size>
                <d:getlastmodified>Fri, 23 Sep 2022 06:50:34 GMT</d:getlastmodified>
                <oc:favorite>0</oc:favorite>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d/Folder/</d:href>
        <d:propstat>
            <d:prop>
                <oc:id>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!3e519da2-1812-4e44-a9b1-390144bb3feb</oc:id>
                <oc:fileid>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!3e519da2-1812-4e44-a9b1-390144bb3feb</oc:fileid>
                <oc:spaceid>cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:spaceid>
                <oc:file-parent>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:file-parent>
                <oc:name>Folder</oc:name>
                <d:getetag>"2a601c7ce774949cd1dd786f19a5b359"</d:getetag>
                <oc:permissions>RDNVCK</oc:permissions>
                <d:resourcetype>
                    <d:collection/>
                </d:resourcetype>
                <oc:size>0</oc:size>
                <d:getlastmodified>Fri, 23 Sep 2022 08:12:37 GMT</d:getlastmodified>
                <oc:favorite>0</oc:favorite>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
    </d:response>
    <d:response>
        <d:href>/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d/Shared%20Folder/</d:href>
        <d:propstat>
            <d:prop>
                <oc:id>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!5e683056-2338-49b1-add0-bb1c41b5a1dc</oc:id>
                <oc:fileid>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!5e683056-2338-49b1-add0-bb1c41b5a1dc</oc:fileid>
                <oc:spaceid>cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:spaceid>
                <oc:file-parent>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</oc:file-parent>
                <oc:name>Shared Folder</oc:name>
                <d:getetag>"c171eb07817781f23493db5084736335"</d:getetag>
                <oc:permissions>SRDNVCK</oc:permissions>
                <d:resourcetype>
                    <d:collection/>
                </d:resourcetype>
                <oc:size>0</oc:size>
                <d:getlastmodified>Fri, 23 Sep 2022 06:50:43 GMT</d:getlastmodified>
                <oc:favorite>0</oc:favorite>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>

Note: the space root has no parent

OCS

List outgoing shares

<ocs>
    <meta>
        <status>ok</status>
        <statuscode>100</statuscode>
        <message>OK</message>
    </meta>
    <data>
        <element>
            <id>CyvwfRqbrzpgJvA</id>
            <share_type>3</share_type>
            <uid_owner>admin</uid_owner>
            <displayname_owner>Admin</displayname_owner>
            <additional_info_owner>admin@example.org</additional_info_owner>
            <permissions>1</permissions>
            <stime>1664204880</stime>
            <parent></parent>
            <expiration></expiration>
            <token>ySZgJetXqXoweTG</token>
            <uid_file_owner>admin</uid_file_owner>
            <displayname_file_owner>Admin</displayname_file_owner>
            <additional_info_file_owner>admin@example.org</additional_info_file_owner>
            <state>0</state>
            <path>/Neue Datei.txt</path>
            <item_type>file</item_type>
            <mimetype>text/plain</mimetype>
            <storage_id>shared::/Neue Datei.txt</storage_id>
            <storage>0</storage>
            <item_source>1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000!ad92d8e2-3059-45db-a34d-267c57ee4c4e</item_source>
            <file_source>1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000!ad92d8e2-3059-45db-a34d-267c57ee4c4e</file_source>
            <file_parent>1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000!some-admin-user-id-0000-000000000000</file_parent>
            <file_target>/Neue Datei.txt</file_target>
            <share_with_user_type>0</share_with_user_type>
            <share_with_additional_info></share_with_additional_info>
            <mail_send>0</mail_send>
            <name>Quicklink</name>
            <url>https://localhost:9200/s/ySZgJetXqXoweTG</url>
            <quicklink>true</quicklink>
        </element>
        <element>
            <id>MsSvqCkvGcjdhal</id>
            <share_type>3</share_type>
            <uid_owner>admin</uid_owner>
            <displayname_owner>Admin</displayname_owner>
            <additional_info_owner>admin@example.org</additional_info_owner>
            <permissions>1</permissions>
            <stime>1664309312</stime>
            <parent></parent>
            <expiration></expiration>
            <token>JxKTODpBohwWQnd</token>
            <uid_file_owner>admin</uid_file_owner>
            <displayname_file_owner>Admin</displayname_file_owner>
            <additional_info_file_owner>admin@example.org</additional_info_file_owner>
            <state>0</state>
            <path>/Neue Datei.docx</path>
            <item_type>file</item_type>
            <mimetype>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mimetype>
            <storage_id>shared::/Neue Datei.docx</storage_id>
            <storage>0</storage>
            <item_source>1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000!34c6d699-bbf1-46ed-b544-89d1b91758a0</item_source>
            <file_source>1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000!34c6d699-bbf1-46ed-b544-89d1b91758a0</file_source>
            <file_parent>1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000!some-admin-user-id-0000-000000000000</file_parent>
            <file_target>/Neue Datei.docx</file_target>
            <share_with_user_type>0</share_with_user_type>
            <share_with_additional_info></share_with_additional_info>
            <mail_send>0</mail_send>
            <name>Quicklink</name>
            <url>https://localhost:9200/s/JxKTODpBohwWQnd</url>
            <quicklink>true</quicklink>
        </element>
        <element>
            <id>1284d238-aa92-42ce-bdc4-0b0000009157:cf792ee7-cdf7-4bc3-99db-7de27ae01d2d:0b334991-066a-4d08-b9dd-00629c32ce62</id>
            <share_type>0</share_type>
            <uid_owner>admin</uid_owner>
            <displayname_owner>Admin</displayname_owner>
            <additional_info_owner>admin@example.org</additional_info_owner>
            <permissions>31</permissions>
            <stime>1663915914</stime>
            <parent></parent>
            <expiration></expiration>
            <token></token>
            <uid_file_owner>cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</uid_file_owner>
            <displayname_file_owner></displayname_file_owner>
            <additional_info_file_owner></additional_info_file_owner>
            <state>0</state>
            <path>/Shared Folder</path>
            <item_type>folder</item_type>
            <mimetype>httpd/unix-directory</mimetype>
            <storage_id>shared::/Shares/Shared Folder</storage_id>
            <storage>0</storage>
            <item_source>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!5e683056-2338-49b1-add0-bb1c41b5a1dc</item_source>
            <file_source>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!5e683056-2338-49b1-add0-bb1c41b5a1dc</file_source>
            <file_parent>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</file_parent>
            <file_target>/Shares/Shared Folder</file_target>
            <share_with_user_type>0</share_with_user_type>
            <share_with_additional_info></share_with_additional_info>
            <mail_send>0</mail_send>
            <name></name>
        </element>
        <element>
            <id>1284d238-aa92-42ce-bdc4-0b0000009157:cf792ee7-cdf7-4bc3-99db-7de27ae01d2d:1b90eac6-d497-4904-9e5f-915af7f2b32b</id>
            <share_type>0</share_type>
            <uid_owner>admin</uid_owner>
            <displayname_owner>Admin</displayname_owner>
            <additional_info_owner>admin@example.org</additional_info_owner>
            <permissions>31</permissions>
            <stime>1663920764</stime>
            <parent></parent>
            <expiration></expiration>
            <token></token>
            <uid_file_owner>cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</uid_file_owner>
            <displayname_file_owner></displayname_file_owner>
            <additional_info_file_owner></additional_info_file_owner>
            <state>0</state>
            <path>/Folder</path>
            <item_type>folder</item_type>
            <mimetype>httpd/unix-directory</mimetype>
            <storage_id>shared::/Shares/Folder</storage_id>
            <storage>0</storage>
            <item_source>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!3e519da2-1812-4e44-a9b1-390144bb3feb</item_source>
            <file_source>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!3e519da2-1812-4e44-a9b1-390144bb3feb</file_source>
            <file_parent>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</file_parent>
            <file_target>/Shares/Folder</file_target>
            <share_with>marie</share_with>
            <share_with_user_type>0</share_with_user_type>
            <share_with_displayname>Marie Skłodowska Curie</share_with_displayname>
            <share_with_additional_info>marie@example.org</share_with_additional_info>
            <mail_send>0</mail_send>
            <name></name>
        </element>
        <element>
            <id>1284d238-aa92-42ce-bdc4-0b0000009157:cf792ee7-cdf7-4bc3-99db-7de27ae01d2d:c36a7974-f6ad-4531-b1fa-41f03d6bd499</id>
            <share_type>0</share_type>
            <uid_owner>admin</uid_owner>
            <displayname_owner>Admin</displayname_owner>
            <additional_info_owner>admin@example.org</additional_info_owner>
            <permissions>17</permissions>
            <stime>1663920729</stime>
            <parent></parent>
            <expiration></expiration>
            <token></token>
            <uid_file_owner>cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</uid_file_owner>
            <displayname_file_owner></displayname_file_owner>
            <additional_info_file_owner></additional_info_file_owner>
            <state>0</state>
            <path>/Shared Folder</path>
            <item_type>folder</item_type>
            <mimetype>httpd/unix-directory</mimetype>
            <storage_id>shared::/Shares/Shared Folder</storage_id>
            <storage>0</storage>
            <item_source>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!5e683056-2338-49b1-add0-bb1c41b5a1dc</item_source>
            <file_source>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!5e683056-2338-49b1-add0-bb1c41b5a1dc</file_source>
            <file_parent>1284d238-aa92-42ce-bdc4-0b0000009157$cf792ee7-cdf7-4bc3-99db-7de27ae01d2d!cf792ee7-cdf7-4bc3-99db-7de27ae01d2d</file_parent>
            <file_target>/Shares/Shared Folder</file_target>
            <share_with>marie</share_with>
            <share_with_user_type>0</share_with_user_type>
            <share_with_displayname>Marie Skłodowska Curie</share_with_displayname>
            <share_with_additional_info>marie@example.org</share_with_additional_info>
            <mail_send>0</mail_send>
            <name></name>
        </element>
    </data>
</ocs>

List incoming shares

<ocs>
    <meta>
        <status>ok</status>
        <statuscode>100</statuscode>
        <message>OK</message>
    </meta>
    <data>
        <element>
            <id>1284d238-aa92-42ce-bdc4-0b0000009157:4c510ada-c86b-4815-8820-42cdf82c3d51:e674409d-29fa-4759-92db-672a8f80c543</id>
            <share_type>0</share_type>
            <uid_owner>einstein</uid_owner>
            <displayname_owner>Albert Einstein</displayname_owner>
            <additional_info_owner>einstein@example.org</additional_info_owner>
            <permissions>31</permissions>
            <stime>1665146161</stime>
            <parent></parent>
            <expiration></expiration>
            <token></token>
            <uid_file_owner>einstein</uid_file_owner>
            <displayname_file_owner>Albert Einstein</displayname_file_owner>
            <additional_info_file_owner>einstein@example.org</additional_info_file_owner>
            <state>1</state>
            <path>/For admin</path>
            <item_type>folder</item_type>
            <mimetype>httpd/unix-directory</mimetype>
            <storage_id>shared::/Shares/For admin</storage_id>
            <storage>0</storage>
            <item_source>1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51!92d5b2c5-bc36-4835-ab89-ca05785398e9</item_source>
            <file_source>1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51!92d5b2c5-bc36-4835-ab89-ca05785398e9</file_source>
            <file_parent>1284d238-aa92-42ce-bdc4-0b0000009157$4c510ada-c86b-4815-8820-42cdf82c3d51!4c510ada-c86b-4815-8820-42cdf82c3d51</file_parent>
            <file_target>/Shares/For admin</file_target>
            <share_with>admin</share_with>
            <share_with_user_type>0</share_with_user_type>
            <share_with_displayname>Admin</share_with_displayname>
            <share_with_additional_info>admin@example.org</share_with_additional_info>
            <mail_send>0</mail_send>
            <name></name>
        </element>
    </data>
</ocs>

Search REPORT

<d:multistatus xmlns:s="http://sabredav.org/ns" xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
    <d:response>
        <d:href>/remote.php/dav/spaces/1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000/Test-parent.txt</d:href>
        <d:propstat>
            <d:prop>
                <oc:fileid>1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000!c717b732-894a-4fb2-a21c-62b794a584dc</oc:fileid>
                <oc:file-parent>1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000!some-admin-user-id-0000-000000000000</oc:file-parent>
                <oc:name>Test-parent.txt</oc:name>
                <d:getlastmodified>2022-10-07T12:30:26Z</d:getlastmodified>
                <d:getcontenttype>text/plain</d:getcontenttype>
                <oc:permissions>RDNVW</oc:permissions>
                <d:getetag></d:getetag>
                <d:resourcetype></d:resourcetype>
                <d:getcontentlength>30</d:getcontentlength>
                <oc:score>0.640641450881958</oc:score>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>
@kulmann
Copy link
Member Author

kulmann commented Oct 4, 2022

And another use case: after deleting the current folder the web ui navigates up to the parent folder. That led me to the thought: Would be really helpful if we'd have the parentId in all propfinds as well. Saves us from doing a propfind on the parent path just for navigating there... from what you showed me last week this should be easy to achieve, right?

@micbar
Copy link
Contributor

micbar commented Oct 6, 2022

The first PR which comes with #4750 fixes ocs and Webdav PROPFINDs.

Search service is not yet done.

@aduffeck @butonic who can take care?

@micbar
Copy link
Contributor

micbar commented Oct 6, 2022

REPORT requests are still pending.

@micbar micbar reopened this Oct 6, 2022
@butonic butonic self-assigned this Oct 7, 2022
@micbar micbar added Priority:p2-high Escalation, on top of current planning, release blocker GA-Blocker labels Oct 7, 2022
@micbar
Copy link
Contributor

micbar commented Oct 7, 2022

All done so far.

The search index stores the parentID from now on. Existing items from the index will not have a file-parent but will get one when they are re-indexed.

./ocis/bin/ocis search index --space <space> --user <user can be used to recreate the index

@butonic
Copy link
Member

butonic commented Oct 7, 2022

recreating the index only works when a non memory registry is used. Otherwise ocis search index ----space 1284d238-aa92-42ce-bdc4-0b0000009157$some-admin-user-id-0000-000000000000 --user admin cannot look up the search service and will error.

Try setting MICRO_REGISTRY=mdns to use the mdns registry. But this needs to happen for both: running ocis server and ocis search index ....

@rhafer @micbar in effect using our default in memory registry makes it impossible to use cli commands if they need to look up services ...

@SwikritiT
Copy link
Contributor

SwikritiT commented Jun 22, 2023

TODO QA team:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:p2-high Escalation, on top of current planning, release blocker
Projects
Archived in project
4 participants