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

Sharing seems to work but does not work #1303

Closed
jasson99 opened this issue Jun 3, 2020 · 15 comments
Closed

Sharing seems to work but does not work #1303

jasson99 opened this issue Jun 3, 2020 · 15 comments
Labels
Interaction:Needs-help Asking some hints to engineering when the issue can't be reproduced Type:Discussion

Comments

@jasson99
Copy link
Contributor

jasson99 commented Jun 3, 2020

Sharing "seems" to work as expected, but resharing a received share does not work in OCIS. This is because the share does not exist for the receiver even if the response and the status code look good to sharer after sharing.

In OC10:

  1. Create users: Alice, Brian and Carol
  2. User Alice creates a folder TMP
  3. User Alice shares folder TMP with user Brian:
curl -u alice:1234 -X POST "http://172.17.0.1/oc/ocs/v1.php/apps/files_sharing/api/v1/shares" -H "OCS_APIREQUEST: true" -d path=TMP -d shareType=0 -d shareWith=brian | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1086  100  1050  100    36   6562    225 --:--:-- --:--:-- --:--:--  6787
<?xml version="1.0"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message/>
    <totalitems/>
    <itemsperpage/>
  </meta>
  <data>
    <id>33</id>
    <share_type>0</share_type>
    <uid_owner>alice</uid_owner>
    <displayname_owner>alice</displayname_owner>
    <permissions>31</permissions>
    <stime>1591159503</stime>
    <parent/>
    <expiration/>
    <token/>
    <uid_file_owner>alice</uid_file_owner>
    <displayname_file_owner>alice</displayname_file_owner>
    <additional_info_owner/>
    <additional_info_file_owner/>
    <path>/TMP</path>
    <item_type>folder</item_type>
    <mimetype>httpd/unix-directory</mimetype>
    <storage_id>home::alice</storage_id>
    <storage>48</storage>
    <item_source>2147484562</item_source>
    <file_source>2147484562</file_source>
    <file_parent>2147484449</file_parent>
    <file_target>/TMP</file_target>
    <share_with>brian</share_with>
    <share_with_displayname>brian</share_with_displayname>
    <share_with_additional_info/>
    <mail_send>0</mail_send>
    <attributes/>
  </data>
</ocs>

  1. And the response about the shared data is:
curl -u alice:1234 -X GET "http://172.17.0.1/oc/ocs/v1.php/apps/files_sharing/api/v1/shares?path=TMP" -H "OCS_APIREQUEST: true"                                                 
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>100</statuscode>
  <message/>
  <totalitems></totalitems>
  <itemsperpage></itemsperpage>
 </meta>
 <data>
  <element>
   <id>33</id>
   <share_type>0</share_type>
   <uid_owner>alice</uid_owner>
   <displayname_owner>alice</displayname_owner>
   <permissions>31</permissions>
   <stime>1591159503</stime>
   <parent/>
   <expiration/>
   <token/>
   <uid_file_owner>alice</uid_file_owner>
   <displayname_file_owner>alice</displayname_file_owner>
   <additional_info_owner/>
   <additional_info_file_owner/>
   <path>/TMP</path>
   <item_type>folder</item_type>
   <mimetype>httpd/unix-directory</mimetype>
   <storage_id>home::alice</storage_id>
   <storage>48</storage>
   <item_source>2147484562</item_source>
   <file_source>2147484562</file_source>
   <file_parent>2147484449</file_parent>
   <file_target>/TMP</file_target>
   <share_with>brian</share_with>
   <share_with_displayname>brian</share_with_displayname>
   <share_with_additional_info/>
   <mail_send>0</mail_send>
   <attributes/>
  </element>
 </data>
</ocs>

  1. User Brian checks for the presence of received share TMP:
curl -u brian:12345 -X PROPFIND http://172.17.0.1/oc/remote.php/dav/files/brian/TMP -v | xmllint --format -

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/oc/remote.php/dav/files/brian/TMP/</d:href>
    <d:propstat>
      <d:prop>
        <d:getlastmodified>Mon, 08 Jun 2020 09:51:42 GMT</d:getlastmodified>
        <d:resourcetype>
          <d:collection/>
        </d:resourcetype>
        <d:quota-used-bytes>0</d:quota-used-bytes>
        <d:quota-available-bytes>-3</d:quota-available-bytes>
        <d:getetag>"5ede0a2ed216b"</d:getetag>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

  1. And user Brian shares received share TMP with user Carol:
curl -u brian:12345 -X POST "http://172.17.0.1/oc/ocs/v1.php/apps/files_sharing/api/v1/shares" -H "OCS_APIREQUEST: true" -d path=TMP -d shareType=0 -d shareWith=carol | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1087  100  1051  100    36    290      9  0:00:04  0:00:03  0:00:01   300
<?xml version="1.0"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message/>
    <totalitems/>
    <itemsperpage/>
  </meta>
  <data>
    <id>34</id>
    <share_type>0</share_type>
    <uid_owner>brian</uid_owner>
    <displayname_owner>brian</displayname_owner>
    <permissions>31</permissions>
    <stime>1591159762</stime>
    <parent/>
    <expiration/>
    <token/>
    <uid_file_owner>alice</uid_file_owner>
    <displayname_file_owner>alice</displayname_file_owner>
    <additional_info_owner/>
    <additional_info_file_owner/>
    <path>/TMP</path>
    <item_type>folder</item_type>
    <mimetype>httpd/unix-directory</mimetype>
    <storage_id>shared::/TMP</storage_id>
    <storage>48</storage>
    <item_source>2147484562</item_source>
    <file_source>2147484562</file_source>
    <file_parent>2147484565</file_parent>
    <file_target>/TMP</file_target>
    <share_with>carol</share_with>
    <share_with_displayname>carol</share_with_displayname>
    <share_with_additional_info/>
    <mail_send>0</mail_send>
    <attributes/>
  </data>
</ocs>

In OCIS:

  1. Create users: Alice, Brian and Carol
  2. User Alice creates a folder TMP
  3. User Alice makes sure for the presence of folder TMP and PROPFIND works on both endpoints:
 curl -u alice:1234 -X PROPFIND http://localhost:9140/remote.php/dav/files/alice/TMP -v | xmllint --format - 

 curl -u alice:1234 -X PROPFIND http://localhost:9140/remote.php/webdav/TMP -v | xmllint --format - 

< HTTP/1.1 207 Multi-Status

<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/remote.php/dav/files/alice/folder/</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTYyOjFlMDQxZWIxLWQzZDMtNGZjYy04MTQxLWM1M2RiOWFmYTg5Yw==</oc:id>
        <oc:fileid>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTYyOjFlMDQxZWIxLWQzZDMtNGZjYy04MTQxLWM1M2RiOWFmYTg5Yw==</oc:fileid>
        <d:getetag>"3017e62a28a41f44828c78187888c958"</d:getetag>
        <oc:permissions>WCKDNVR</oc:permissions>
        <d:resourcetype>
          <d:collection/>
        </d:resourcetype>
        <d:getcontenttype>httpd/unix-directory</d:getcontenttype>
        <oc:size>4096</oc:size>
        <d:getlastmodified>Mon, 08 Jun 2020 10:08:10 UTC</d:getlastmodified>
        <oc:favorite>0</oc:favorite>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

  1. User Alice shares folder TMP with user Brian:
curl -u alice:1234 -X POST "http://localhost:9140/ocs/v1.php/apps/files_sharing/api/v1/shares" -H "OCS_APIREQUEST: true" -d path=TMP -d shareType=0 -d shareWith=brian | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1177  100  1141  100    36  10764    339 --:--:-- --:--:-- --:--:-- 11103
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message>OK</message>
  </meta>
  <data>
    <id>32e0dfe2-02e1-478f-92ac-457f0dc381cb</id>
    <share_type>0</share_type>
    <uid_owner>alice</uid_owner>
    <displayname_owner>User Alice</displayname_owner>
    <permissions>31</permissions>
    <stime>1591157454</stime>
    <parent/>
    <expiration/>
    <token/>
    <uid_file_owner>alice</uid_file_owner>
    <displayname_file_owner>User Alice</displayname_file_owner>
    <additional_info_owner/>
    <additional_info_file_owner/>
    <state>0</state>
    <path>/TMP</path>
    <item_type>folder</item_type>
    <mimetype>httpd/unix-directory</mimetype>
    <storage_id>1284d238-aa92-42ce-bdc4-0b0000009162</storage_id>
    <storage>0</storage>
    <item_source>28468a89-f5b8-4ff8-aad1-98f2897a750a</item_source>
    <file_source>28468a89-f5b8-4ff8-aad1-98f2897a750a</file_source>
    <file_parent/>
    <file_target>/TMP</file_target>
    <share_with>brian</share_with>
    <share_with_displayname>User Brian</share_with_displayname>
    <share_with_additional_info/>
    <mail_send/>
  </data>
</ocs>

  1. And the response to user Alice about the created share is:
curl -u alice:1234 -X GET "http://localhost:9140/ocs/v1.php/apps/files_sharing/api/v1/shares?path=TMP" -H "OCS_APIREQUEST: true"| xmllint --format -                                        
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1160  100  1160    0     0  13975      0 --:--:-- --:--:-- --:--:-- 13809
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message>OK</message>
  </meta>
  <data>
    <element>
      <id>32e0dfe2-02e1-478f-92ac-457f0dc381cb</id>
      <share_type>0</share_type>
      <uid_owner>alice</uid_owner>
      <displayname_owner>User Alice</displayname_owner>
      <permissions>31</permissions>
      <stime>1591157454</stime>
      <parent/>
      <expiration/>
      <token/>
      <uid_file_owner>alice</uid_file_owner>
      <displayname_file_owner>User Alice</displayname_file_owner>
      <additional_info_owner/>
      <additional_info_file_owner/>
      <state>0</state>
      <path>/TMP</path>
      <item_type>folder</item_type>
      <mimetype>httpd/unix-directory</mimetype>
      <storage_id>1284d238-aa92-42ce-bdc4-0b0000009162</storage_id>
      <storage>0</storage>
      <item_source>28468a89-f5b8-4ff8-aad1-98f2897a750a</item_source>
      <file_source>28468a89-f5b8-4ff8-aad1-98f2897a750a</file_source>
      <file_parent/>
      <file_target>/TMP</file_target>
      <share_with>brian</share_with>
      <share_with_displayname>User Brian</share_with_displayname>
      <share_with_additional_info/>
      <mail_send/>
    </element>
  </data>
</ocs>

  1. User Brian checks for the presence of received share TMP:
curl -u brian:12345 -X PROPFIND http://localhost:9140/remote.php/dav/files/brian/TMP -v | xmllint --format -

< HTTP/1.1 404 Not Found
curl -u brian:12345 -X PROPFIND http://localhost:9140/remote.php/webdav/TMP -v | xmllint --format -

< HTTP/1.1 404 Not Found
  1. User Brian shares the received share TMP with user Carol:
curl -u brian:12345 -X POST "http://localhost:9140/ocs/v1.php/apps/files_sharing/api/v1/shares" -H "OCS_APIREQUEST: true" -d path=TMP -d shareType=0 -d shareWith=carol | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   177  100   141  100    36   3710    947 --:--:-- --:--:-- --:--:--  4657
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
  <meta>
    <status>error</status>
    <statuscode>998</statuscode>
    <message>not found</message>
  </meta>
</ocs>

@jasson99
Copy link
Contributor Author

jasson99 commented Jun 8, 2020

Even if the sharing looks good when we look at the successful response and status code for the sharer, the receiver does not have the share received. That's why resharing does not work. This means, maybe, the share is not created successfully in spite of getting success messages and status code.

@jasson99 jasson99 changed the title Resharing a received share does not work Resharing a share does not work Jun 8, 2020
@jasson99 jasson99 changed the title Resharing a share does not work Sharing does not work Jun 8, 2020
@jasson99 jasson99 changed the title Sharing does not work Sharing seems to work but does not work Jun 8, 2020
@individual-it
Copy link
Member

need to re-check with EOS

@individual-it individual-it self-assigned this Jun 9, 2020
@C0rby
Copy link
Contributor

C0rby commented Jun 9, 2020

In OCIS the user first has to accept files that were shared.
With

curl -s -k -u feynman:superfluidity "https://localhost:9200/ocs/v2.php/apps/files_sharing//api/v1/shares?format=json&
shared_with_me=true&state=all&include_tags=false&format=json" | jq

The shared files can be listed. It looks like so:

{
  "ocs": {
    "meta": {
      "status": "ok",
      "statuscode": 200,
      "message": "OK"
    },
    "data": [
      {
        "id": "a6670f46-ebad-4872-b459-4d58d1afc415",
        "share_type": 0,
        "uid_owner": "einstein",
        "displayname_owner": "Einstein",
        "permissions": 1,
        "stime": 1591716907,
        "parent": "",
        "expiration": "",
        "token": "",
        "uid_file_owner": "einstein",
        "displayname_file_owner": "Einstein",
        "additional_info_owner": "",
        "additional_info_file_owner": "",
        "state": 1,
        "path": "/asdf.png",
        "item_type": "file",
        "mimetype": "image/png",
        "storage_id": "1284d238-aa92-42ce-bdc4-0b0000009162",
        "storage": 0,
        "item_source": "f94eebbe-6e81-40d0-9b26-c7c093916695",
        "file_source": "f94eebbe-6e81-40d0-9b26-c7c093916695",
        "file_parent": "",
        "file_target": "/asdf.png",
        "share_with": "feynman",
        "share_with_displayname": "Feynman",
        "share_with_additional_info": "",
        "mail_send": ""
      }
    ]
  }
}

To accept the share one has to send this request. But yes this is not implemented yet.

curl -k -s -u feynman:superfluidity 'https://localhost:9200/ocs/v2.php/apps/files_sharing//api/v1/shares/pending/a6670f46-ebad-4872-b459-4d58d1afc415?format=json'

@PVince81
Copy link
Contributor

seems you missed adding -X POST to the accept request

I happened to have tried it with a non-existing request and it returns {"ocs":{"meta":{"status":"error","statuscode":996,"message":"grpc update received share request (accept) failed"}}} instead of a 404, so probably another thing to look into (error handling)

@PVince81
Copy link
Contributor

right, with ocfs it's not implemented:

error creating reference error="error: not supported: ocfs: operation not supported" pkg=rgrpc service=reva traceid=7aaad2f1fa74a003527e7db13e66183c

@C0rby
Copy link
Contributor

C0rby commented Jun 10, 2020

I did implement a prototype but still need some feedback on it.
owncloud/reva#6

@individual-it
Copy link
Member

Testing with EOS blocked by https://github.com/owncloud/ocis/issues/253
with EOS we even cannot upload a file

@jasson99
Copy link
Contributor Author

jasson99 commented Jun 11, 2020

Issue : https://github.com/owncloud/ocis-reva/issues/260 is created since sharee gets information about all the shares even when path is provided for the retrieval of information about a specific share.

@C0rby
Copy link
Contributor

C0rby commented Jun 15, 2020

Issue : #1257 is created since sharee gets information about all the shares even when path is provided for the retrieval of information about a specific share.

Is that even necessary?
I'm not sure if we need to be able to list a single recieved share. (Before it is accepted)

@phil-davis
Copy link
Contributor

I guess this "feature" is available in ownCloud10 - @jasson99 ?

So a client app could do such a request and maybe expect to get just the already-filtered list of share(s) for the requested resource.

So it depends how much of this detailed oC10 compatible behavior is to be strictly followed.

@individual-it
Copy link
Member

with EOS accepting the share works and the receiver can see the share through the /webdav/Shares endpoint, but not through the /dav endpoint

@individual-it
Copy link
Member

tests have been added, so I'm taking away the QA-team label. If more tests are needed please add the label again

@individual-it individual-it removed their assignment Jun 18, 2020
@individual-it
Copy link
Member

this also blocks running sharing tests on EOS, because the path where the shares are accessible are different to oc10, so ether we have to adjust the EOS settings or make the test-code smarter

@butonic butonic transferred this issue from owncloud/ocis-reva Jan 18, 2021
@refs refs added Interaction:Needs-help Asking some hints to engineering when the issue can't be reproduced Type:Discussion labels Jan 18, 2021
@settings settings bot removed the p3-medium label Apr 7, 2021
@stale
Copy link

stale bot commented Jun 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status:Stale label Jun 6, 2021
@kiranparajuli589
Copy link
Contributor

kiranparajuli589 commented Jun 9, 2021

sharing works properly with ocis now:

  • create a share

    curl -k -u uu1:uu1 https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d 'path=fileToShare.txt' -d 'shareWith=uu2' -d 'shareType=0' | xmllint --format -
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    Dload  Upload   Total   Spent    Left  Speed
    100  1341  100  1295  100    46   7485    265 --:--:-- --:--:-- --:--:--  7751
    <?xml version="1.0" encoding="UTF-8"?>
    <ocs>
    <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message>OK</message>
    </meta>
    <data>
    <id>9814c365-bf23-4332-b144-ee24edaca981</id>
    <share_type>0</share_type>
    <uid_owner>uu1</uid_owner>
    <displayname_owner>uu1</displayname_owner>
    <additional_info_owner>uu1@uu.cc</additional_info_owner>
    <permissions>19</permissions>
    <stime>1623214201</stime>
    <parent/>
    <expiration/>
    <token/>
    <uid_file_owner>uu1</uid_file_owner>
    <displayname_file_owner>uu1</displayname_file_owner>
    <additional_info_file_owner>uu1@uu.cc</additional_info_file_owner>
    <state>0</state>
    <path>/fileToShare.txt</path>
    <item_type>file</item_type>
    <mimetype>text/plain</mimetype>
    <storage_id>1284d238-aa92-42ce-bdc4-0b0000009157</storage_id>
    <storage>0</storage>
    <item_source>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==</item_source>
    <file_source>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==</file_source>
    <file_parent/>
    <file_target>/fileToShare.txt</file_target>
    <share_with>uu2</share_with>
    <share_with_displayname>uu2</share_with_displayname>
    <share_with_additional_info>uu2@uu.cc</share_with_additional_info>
    <mail_send>0</mail_send>
    <name/>
    </data>
    </ocs>
  • receive a share as pending

    curl -k -u uu2:uu2 https://localhost:9200/ocs/v2.php/apps/files_sharing//api/v1/shares\?format\=json\&shared_with_me\=true\&state\=1\&include_tags\=false\&format\=json -v | jq
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    Dload  Upload   Total   Spent    Left  Speed
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1:9200...
      * TCP_NODELAY set
      * Connected to localhost (127.0.0.1) port 9200 (#0)
      * ALPN, offering h2
      * ALPN, offering http/1.1
      * successfully set certificate verify locations:
      *   CAfile: /etc/ssl/certs/ca-certificates.crt
    CApath: /etc/ssl/certs
    } [5 bytes data]
      * TLSv1.3 (OUT), TLS handshake, Client hello (1):
    } [512 bytes data]
      * TLSv1.3 (IN), TLS handshake, Server hello (2):
    { [122 bytes data]
      * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
    { [6 bytes data]
      * TLSv1.3 (IN), TLS handshake, Certificate (11):
    { [818 bytes data]
      * TLSv1.3 (IN), TLS handshake, CERT verify (15):
    { [264 bytes data]
      * TLSv1.3 (IN), TLS handshake, Finished (20):
    { [52 bytes data]
      * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
    } [1 bytes data]
      * TLSv1.3 (OUT), TLS handshake, Finished (20):
    } [52 bytes data]
      * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
      * ALPN, server did not agree to a protocol
      * Server certificate:
      *  subject: O=Acme Corp; CN=OCIS
      *  start date: Jun  4 12:31:40 2021 GMT
      *  expire date: Jun  4 12:31:40 2022 GMT
      *  issuer: O=Acme Corp; CN=OCIS
      *  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
      * Server auth using Basic with user 'uu2'
    } [5 bytes data]
    > GET /ocs/v2.php/apps/files_sharing//api/v1/shares?format=json&shared_with_me=true&state=1&include_tags=false&format=json HTTP/1.1
    > Host: localhost:9200
    > Authorization: Basic dXUyOnV1Mg==
    > User-Agent: curl/7.68.0
    > Accept: */*
    >
    { [5 bytes data]
      * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
    { [146 bytes data]
      * Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < Content-Length: 926
    < Content-Type: text/plain; charset=utf-8
    < Date: Wed, 09 Jun 2021 05:00:07 GMT
    < Vary: Origin
    <
    { [926 bytes data]
    100   926  100   926    0     0   3330      0 --:--:-- --:--:-- --:--:--  3330
      * Connection #0 to host localhost left intact
    {
    "ocs": {
    "meta": {
    "status": "ok",
    "statuscode": 200,
    "message": "OK"
    },
    "data": [
    {
    "id": "9814c365-bf23-4332-b144-ee24edaca981",
    "share_type": 0,
    "uid_owner": "uu1",
    "displayname_owner": "uu1",
    "additional_info_owner": "uu1@uu.cc",
    "permissions": 19,
    "stime": 1623214201,
    "parent": "",
    "expiration": "",
    "token": "",
    "uid_file_owner": "uu1",
    "displayname_file_owner": "uu1",
    "additional_info_file_owner": "uu1@uu.cc",
    "state": 1,
    "path": "/fileToShare.txt",
    "item_type": "file",
    "mimetype": "text/plain",
    "storage_id": "1284d238-aa92-42ce-bdc4-0b0000009157",
    "storage": 0,
    "item_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==",
    "file_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==",
    "file_parent": "",
    "file_target": "/fileToShare.txt",
    "share_with": "uu2",
    "share_with_displayname": "uu2",
    "share_with_additional_info": "uu2@uu.cc",
    "mail_send": 0,
    "name": ""
    }
    ]
    }
    }
  • accept a share

    curl -k -u uu2:uu2 -XPOST https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/9814c365-bf23-4332-b144-ee24edaca981\?format\=json | jq
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    Dload  Upload   Total   Spent    Left  Speed
    100   940  100   940    0     0  20000      0 --:--:-- --:--:-- --:--:-- 20000
    {
    "ocs": {
    "meta": {
    "status": "ok",
    "statuscode": 200,
    "message": "OK"
    },
    "data": [
    {
    "id": "9814c365-bf23-4332-b144-ee24edaca981",
    "share_type": 0,
    "uid_owner": "uu1",
    "displayname_owner": "uu1",
    "additional_info_owner": "uu1@uu.cc",
    "permissions": 19,
    "stime": 1623214201,
    "parent": "",
    "expiration": "",
    "token": "",
    "uid_file_owner": "uu1",
    "displayname_file_owner": "uu1",
    "additional_info_file_owner": "uu1@uu.cc",
    "state": 0,
    "path": "/Shares/fileToShare.txt",
    "item_type": "file",
    "mimetype": "text/plain",
    "storage_id": "1284d238-aa92-42ce-bdc4-0b0000009157",
    "storage": 0,
    "item_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==",
    "file_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==",
    "file_parent": "",
    "file_target": "/Shares/fileToShare.txt",
    "share_with": "uu2",
    "share_with_displayname": "uu2",
    "share_with_additional_info": "uu2@uu.cc",
    "mail_send": 0,
    "name": ""
    }
    ]
    }
    }
  • get share

      curl -k -u uu2:uu2 -X PROPFIND https://localhost:9200/remote.php/webdav/Shares/fileToShare.txt | xmllint --format -
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
      Dload  Upload   Total   Spent    Left  Speed
      100  1043  100  1043    0     0  65187      0 --:--:-- --:--:-- --:--:-- 65187
      <?xml version="1.0" encoding="utf-8"?>
      <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
      <d:response>
      <d:href>/remote.php/webdav/Shares/fileToShare.txt</d:href>
      <d:propstat>
      <d:prop>
      <oc:id>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==</oc:id>
      <oc:fileid>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==</oc:fileid>
      <d:getetag>"673ebb5ffb4ebbae34fb621ba88dc05f"</d:getetag>
      <oc:permissions>SRNVW</oc:permissions>
      <d:resourcetype/>
      <d:getcontentlength>377</d:getcontentlength>
      <d:getcontenttype>text/plain; charset=utf-8</d:getcontenttype>
      <d:getlastmodified>Wed, 09 Jun 2021 04:41:25 GMT</d:getlastmodified>
      <oc:checksums>
      <oc:checksum>SHA1:ec892cbfe95fec9cd1ceca926273f9ef8e8b5d00 MD5:92485a536e71f95e417c7ed967687258 ADLER32:ae758bd2</oc:checksum>
      </oc:checksums>
      <oc:favorite>0</oc:favorite>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
      </d:propstat>
      </d:response>
      </d:multistatus>
      ```
    </details>
  • decline a share

    curl -k -u uu2:uu2 -XDELETE https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/pending/9814c365-bf23-4332-b144-ee24edaca981\?format\=json | jq
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    Dload  Upload   Total   Spent    Left  Speed
    100   926  100   926    0     0  23150      0 --:--:-- --:--:-- --:--:-- 23150
    {
    "ocs": {
    "meta": {
    "status": "ok",
    "statuscode": 200,
    "message": "OK"
    },
    "data": [
    {
    "id": "9814c365-bf23-4332-b144-ee24edaca981",
    "share_type": 0,
    "uid_owner": "uu1",
    "displayname_owner": "uu1",
    "additional_info_owner": "uu1@uu.cc",
    "permissions": 19,
    "stime": 1623214201,
    "parent": "",
    "expiration": "",
    "token": "",
    "uid_file_owner": "uu1",
    "displayname_file_owner": "uu1",
    "additional_info_file_owner": "uu1@uu.cc",
    "state": 2,
    "path": "/fileToShare.txt",
    "item_type": "file",
    "mimetype": "text/plain",
    "storage_id": "1284d238-aa92-42ce-bdc4-0b0000009157",
    "storage": 0,
    "item_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==",
    "file_source": "MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjE5NmQxOTgwLTNmNzEtNGMzNS1hYzA1LTEwMTE0NjYyMjk2OA==",
    "file_parent": "",
    "file_target": "/fileToShare.txt",
    "share_with": "uu2",
    "share_with_displayname": "uu2",
    "share_with_additional_info": "uu2@uu.cc",
    "mail_send": 0,
    "name": ""
    }
    ]
    }
    }
  • file is now gone for the sharee (a declined share still exists in Shares directory #2128)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Interaction:Needs-help Asking some hints to engineering when the issue can't be reproduced Type:Discussion
Projects
None yet
Development

No branches or pull requests

7 participants