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

Getting a share by id returns state="0" #1684

Open
kulmann opened this issue May 5, 2021 · 7 comments
Open

Getting a share by id returns state="0" #1684

kulmann opened this issue May 5, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@kulmann
Copy link
Member

kulmann commented May 5, 2021

Getting a share by id (at least with the json provider) returns state="0". Independent of the actual share state.

Used here: https://github.com/owncloud/web/pull/4988/files#diff-e6e62cfb9c3e1f6005163a9ce3192fb388add4b86d6537cebfd4fecac886d6efR251

@ishank011
Copy link
Contributor

ishank011 commented May 6, 2021

@kulmann currently, we don't return the updated received share from the POST /ocs/v2.php/apps/files_sharing/api/v1/shares/pending/$shareID endpoint. @C0rby's PR #1685 will add that.

I tried it from the CLI by adding a new command and seems to work for me (note that the share-get-received command isn't present atm, I added it for testing)

>> share-get-received -id 64ba0d8a-80e7-4a17-a48e-9cf2f07fb086
+--------------------------------------+-----------------+--------------------------------------+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------------------+-----------------+--------------------------------------+--------------------------------+--------------------------------+---------------------+
| #                                    | OWNER.IDP       | OWNER.OPAQUEID                       | RESOURCEID                                                                           | PERMISSIONS                                                                                                     | TYPE              | GRANTEE.IDP     | GRANTEE.OPAQUEID                     | CREATED                        | UPDATED                        | STATE               |
+--------------------------------------+-----------------+--------------------------------------+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------------------+-----------------+--------------------------------------+--------------------------------+--------------------------------+---------------------+
| 64ba0d8a-80e7-4a17-a48e-9cf2f07fb086 | localhost:20080 | 4c510ada-c86b-4815-8820-42cdf82c3d51 | storage_id:"123e4567-e89b-12d3-a456-426655440000" opaque_id:"fileid-einstein%2Fdef"  | permissions:<get_path:true initiate_file_download:true list_container:true list_file_versions:true stat:true >  | GRANTEE_TYPE_USER | localhost:20080 | 932b4540-8d16-481e-8ef4-588e4b6b151c | 2021-05-06 14:32:12 +0200 CEST | 2021-05-06 14:32:12 +0200 CEST | SHARE_STATE_PENDING |
+--------------------------------------+-----------------+--------------------------------------+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------------------+-----------------+--------------------------------------+--------------------------------+--------------------------------+---------------------+
>> share-update-received -state accepted 64ba0d8a-80e7-4a17-a48e-9cf2f07fb086
OK
>> share-get-received -id 64ba0d8a-80e7-4a17-a48e-9cf2f07fb086
+--------------------------------------+-----------------+--------------------------------------+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------------------+-----------------+--------------------------------------+--------------------------------+--------------------------------+----------------------+
| #                                    | OWNER.IDP       | OWNER.OPAQUEID                       | RESOURCEID                                                                           | PERMISSIONS                                                                                                     | TYPE              | GRANTEE.IDP     | GRANTEE.OPAQUEID                     | CREATED                        | UPDATED                        | STATE                |
+--------------------------------------+-----------------+--------------------------------------+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------------------+-----------------+--------------------------------------+--------------------------------+--------------------------------+----------------------+
| 64ba0d8a-80e7-4a17-a48e-9cf2f07fb086 | localhost:20080 | 4c510ada-c86b-4815-8820-42cdf82c3d51 | storage_id:"123e4567-e89b-12d3-a456-426655440000" opaque_id:"fileid-einstein%2Fdef"  | permissions:<get_path:true initiate_file_download:true list_container:true list_file_versions:true stat:true >  | GRANTEE_TYPE_USER | localhost:20080 | 932b4540-8d16-481e-8ef4-588e4b6b151c | 2021-05-06 14:32:12 +0200 CEST | 2021-05-06 14:32:12 +0200 CEST | SHARE_STATE_ACCEPTED |
+--------------------------------------+-----------------+--------------------------------------+--------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+-------------------+-----------------+--------------------------------------+--------------------------------+--------------------------------+----------------------+

@pascalwengerter
Copy link
Contributor

Can be closed since #1685 has been merged? :)

@kulmann
Copy link
Member Author

kulmann commented May 18, 2021

@individual-it do we have API tests which cover getting a share by id?

@phil-davis
Copy link
Contributor

The test steps that accept/decline a share use the /apps/files_sharing/api/v*/shares/pending/$shareId end point with POST or DELETE to accept or decline a share.

Test steps like When user "Alice" updates the last share using the sharing API with use the share-id to update attributes of the share.

Lots of test scenarios were removed from expected-failures in PR #1685 so there were lots of scenarios that used the behaviour that has been fixed.

@individual-it
Copy link
Contributor

I just had a look and I could not find tests that explicitly get shares by ID, just using that functionality inside of the test-code as @phil-davis mentioned
Should we add explicit tests?

@kulmann
Copy link
Member Author

kulmann commented May 18, 2021

@individual-it yes, that would be awesome. An API test which checks the response of getting a share by id. Current issue we're facing is that the share state is always pending and the file target doesn't have the /Shares prefix. At least when I use it in web. @ishank011 has other results (see above). Would be good to have a test in any case.

@phil-davis
Copy link
Contributor

Issue owncloud/ocis#2059 raised to add "get shares by ID" test coverage.

@ishank011 ishank011 added the bug Something isn't working label Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants