Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Cannot get information of a specific share by providing share_id #249

Closed
jasson99 opened this issue Jun 5, 2020 · 13 comments · Fixed by owncloud/core#37672
Closed

Cannot get information of a specific share by providing share_id #249

jasson99 opened this issue Jun 5, 2020 · 13 comments · Fixed by owncloud/core#37672
Assignees
Labels
bug Something isn't working QA-team

Comments

@jasson99
Copy link
Contributor

jasson99 commented Jun 5, 2020

In OC10:

  1. Create users Alice, Brian and Carol
  2. User Alice creates folder Alice-folder
  3. User Alice creates folder Alice-folder/folder2
  4. User Carol creates folder Carol-folder
  5. User Alice shares folder Alice-folder with user Brian with permissions all
  6. User Carol shares folder Carol-folder with user Brian with permissions all
  7. User Brian moves folder Alice-folder/folder2 to Carol-folder/folder2
  8. User Carol gets the information of the last share as:
 curl -u carol:123456 -X GET "http://172.17.0.1/oc/ocs/v1.php/apps/files_sharing/api/v1/shares" -H "OCS_APIREQUEST: true" | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1120  100  1120    0     0   8421      0 --:--:-- --:--:-- --:--:--  8421
<?xml version="1.0"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message/>
    <totalitems/>
    <itemsperpage/>
  </meta>
  <data>
    <element>
      <id>22</id>
      <share_type>0</share_type>
      <uid_owner>carol</uid_owner>
      <displayname_owner>carol</displayname_owner>
      <permissions>31</permissions>
      <stime>1591334770</stime>
      <parent/>
      <expiration/>
      <token/>
      <uid_file_owner>carol</uid_file_owner>
      <displayname_file_owner>carol</displayname_file_owner>
      <additional_info_owner/>
      <additional_info_file_owner/>
      <path>/Carol-folder</path>
      <item_type>folder</item_type>
      <mimetype>httpd/unix-directory</mimetype>
      <storage_id>home::carol</storage_id>
      <storage>34</storage>
      <item_source>2147483990</item_source>
      <file_source>2147483990</file_source>
      <file_parent>2147483977</file_parent>
      <file_target>/Carol-folder</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. The share id is 22. So when we get the information about the share with id = 22 as:
curl -u carol:123456 -X GET "http://172.17.0.1/oc/ocs/v1.php/apps/files_sharing/api/v1/shares/22" -H "OCS_APIREQUEST: true" | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1120  100  1120    0     0   8615      0 --:--:-- --:--:-- --:--:--  8615
<?xml version="1.0"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message/>
    <totalitems/>
    <itemsperpage/>
  </meta>
  <data>
    <element>
      <id>22</id>
      <share_type>0</share_type>
      <uid_owner>carol</uid_owner>
      <displayname_owner>carol</displayname_owner>
      <permissions>31</permissions>
      <stime>1591334770</stime>
      <parent/>
      <expiration/>
      <token/>
      <uid_file_owner>carol</uid_file_owner>
      <displayname_file_owner>carol</displayname_file_owner>
      <additional_info_owner/>
      <additional_info_file_owner/>
      <path>/Carol-folder</path>
      <item_type>folder</item_type>
      <mimetype>httpd/unix-directory</mimetype>
      <storage_id>home::carol</storage_id>
      <storage>34</storage>
      <item_source>2147483990</item_source>
      <file_source>2147483990</file_source>
      <file_parent>2147483977</file_parent>
      <file_target>/Carol-folder</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>

In OCIS:

  1. Create users Alice, Brian and Carol
  2. User Alice creates folder Alice-folder
  3. User Alice creates folder Alice-folder/folder2
  4. User Carol creates folder Carol-folder
  5. User Alice shares folder Alice-folder with user Brian with permissions all
  6. User Carol shares folder Carol-folder with user Brian with permissions all
  7. User Brian moves folder Alice-folder/folder2 to Carol-folder/folder2
  8. User Carol gets the information of the last share as:
curl -u carol:123456 -X GET "http://localhost:9140/ocs/v1.php/apps/files_sharing/api/v1/shares" -H "OCS_APIREQUEST: true" | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1178  100  1178    0     0  14365      0 --:--:-- --:--:-- --:--:-- 14365
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
  <meta>
    <status>ok</status>
    <statuscode>100</statuscode>
    <message>OK</message>
  </meta>
  <data>
    <element>
      <id>9867b95b-3f37-4f4a-b1d1-1eafab13bf9a</id>
      <share_type>0</share_type>
      <uid_owner>carol</uid_owner>
      <displayname_owner>User Carol</displayname_owner>
      <permissions>31</permissions>
      <stime>1591342058</stime>
      <parent/>
      <expiration/>
      <token/>
      <uid_file_owner>carol</uid_file_owner>
      <displayname_file_owner>User Carol</displayname_file_owner>
      <additional_info_owner/>
      <additional_info_file_owner/>
      <state>0</state>
      <path>/Carol-folder</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>cca7d265-aff9-4c25-8c9b-b03d42b3e50c</item_source>
      <file_source>cca7d265-aff9-4c25-8c9b-b03d42b3e50c</file_source>
      <file_parent/>
      <file_target>/Carol-folder</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. The share id is : 9867b95b-3f37-4f4a-b1d1-1eafab13bf9a. So when we get the information about the share with id = 9867b95b-3f37-4f4a-b1d1-1eafab13bf9a as:
curl -u carol:123456 -X GET "http://localhost:9140/ocs/v1.php/apps/files_sharing/api/v1/shares/9867" -H "OCS_APIREQUEST: true" | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   166  100   166    0     0  11857      0 --:--:-- --:--:-- --:--:-- 11857
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
  <meta>
    <status>error</status>
    <statuscode>400</statuscode>
    <message>Only GET, POST and PUT are allowed</message>
  </meta>
</ocs>
 curl -u carol:123456 -X GET "http://localhost:9140/ocs/v1.php/apps/files_sharing/api/v1/shares/9867b95b-3f37-4f4a-b1d1-1eafab13bf9a" -H "OCS_APIREQUEST: true" | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   166  100   166    0     0  11857      0 --:--:-- --:--:-- --:--:-- 11857
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
  <meta>
    <status>error</status>
    <statuscode>400</statuscode>
    <message>Only GET, POST and PUT are allowed</message>
  </meta>
</ocs>
@jasson99 jasson99 changed the title Cannot get information of a specific share providing share_id Cannot get information of a specific share by providing share_id Jun 5, 2020
@PVince81
Copy link
Contributor

PVince81 commented Jun 5, 2020

can you add an API test for that ?

@PVince81
Copy link
Contributor

PVince81 commented Jul 1, 2020

seems this isn't implemented at all, the GET handler is only implemented for retrieving lists: https://github.com/cs3org/reva/blob/master/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go#L119

@PVince81 PVince81 self-assigned this Jul 1, 2020
@PVince81
Copy link
Contributor

PVince81 commented Jul 1, 2020

PR here: cs3org/reva#921

tests cannot yet be enabled due to further expectations not being satisfied, like the "file_parent" field being empty

@PVince81
Copy link
Contributor

PVince81 commented Jul 1, 2020

I've grepped the OC 10 core code and it seems "file_parent" is never used anywhere.
But implementing this will require an additional stat to the storage :-/

@PVince81
Copy link
Contributor

PVince81 commented Jul 1, 2020

Raised #326 to sort out the "file_parent" case

@phil-davis
Copy link
Contributor

owncloud/core#37624 adjusts one scenario that was causing grief, so that the version of the scenario that is run on OCIS does not expect file_parent in the response.

@PVince81
Copy link
Contributor

PVince81 commented Jul 2, 2020

I've checked tests to enable in owncloud/core#37633 but either they are blocked by other tags, or some even seem unrelated like share deletion.

@PVince81
Copy link
Contributor

PVince81 commented Jul 2, 2020

  • recheck the tests tagged and properly split them by raising other tickets where it makes sense:
    • some tests are about deleting shares tests/acceptance/features/apiShareManagementBasic/deleteShare.feature:37 which fails because there's a missing "element" in the XML response
    • ...

@PVince81
Copy link
Contributor

PVince81 commented Jul 2, 2020

  • it is likely that the response for getting single user shares is still not compliant. The one for public share seemed to work.

@individual-it
Copy link
Member

works with EOS, but displayname_owner is not reported

@PVince81
Copy link
Contributor

PVince81 commented Jul 3, 2020

even though the feature seems to work, we still need to look into all the tagged tests and retag them in case they are blocked by other issues, to make it possible to close this ticket here

  • refine tags in tagged tests

@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2020

BEHAT_FILTER_TAGS='~@skipOnOcV10&&~@skipOnLDAP&&~@local_storage&&@issue-ocis-reva-249&&~@issue-ocis-reva-335&&~@issue-ocis-reva-333'

/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareManagementBasic/deleteShare.feature:21
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareManagementBasic/deleteShare.feature:22
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareManagementBasic/deleteShare.feature:36
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareManagementBasic/deleteShare.feature:37
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareOperations/gettingShares.feature:123
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareOperations/gettingShares.feature:124
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:116
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:146
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:298
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:299
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:314
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:315
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:342
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:343
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:372
/srv/www/htdocs/owncloud/tests/acceptance/features/apiShareUpdate/updateShare.feature:373

@individual-it
Copy link
Member

@PVince81 cleanup of tags in owncloud/core#37672 please review

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working QA-team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants