Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Problem sharing a Shared Folder #704

Closed
6 tasks done
daorte opened this issue Jun 14, 2016 · 15 comments · Fixed by #726
Closed
6 tasks done

Problem sharing a Shared Folder #704

daorte opened this issue Jun 14, 2016 · 15 comments · Fixed by #726

Comments

@daorte
Copy link

daorte commented Jun 14, 2016

Hi! i found an unexpected behavior trying to create a share link from a shared folder

Steps to reproduce

  1. i have two users, userOne and userTwo
  2. userOne shares a folder with full permissions to userTwo
  3. userTwo tries to create a share link on a file of his shared folder using the iOS app
  4. the iOS app does nothing

Expected behaviour

the iOS app should create the share link

Actual behaviour

the iOS app does nothing

Server configuration

Web server: Apache 2.4
Database: MySQL
PHP version: 7
Client: User-Agent: Mozilla/5.0 (iOS) ownCloud-iOS/3.4.9
OwnCloud: 9.0.2.2
Device model: iPhone 6 Plus iOS 9.3.2

Some help

the app is validating if the user is the owner of the file, in the share API response XML, this <uid_file_owner>userOne</uid_file_owner> and this <displayname_file_owner>userOne</displayname_file_owner>
tags refers to userOne. If i try to create a share in a NOT shared folder it works correctly

---edited by @nasli, added tasks:

TASKS

PR: #726 , owncloud/ios-library#134

@nasli
Copy link
Contributor

nasli commented Jun 21, 2016

Hi @daorte, thanks for your feedback!!
It seems a bug with that server version, if you enter through the website you can see that this file it is shared but it is not reflected in the iOS UI.
Will fix it within next release.

@nasli nasli added this to the 3.5.0-current milestone Jun 21, 2016
@nasli
Copy link
Contributor

nasli commented Jun 29, 2016

cc @rullzer
This is related to the response of share api,
ex: user1 share /folder1shareTo2 that it is inside: /test/folder1shareTo2/
user2 receive /folder1shareto2/ and share a file inside: /folder1shareto2/file.txt to user3

the share api in user2 it is return:

<path>  /test/folder1shareTo2/file.txt (path of the owner)
<file_target> /file.txt (path of the destiny)

neither of them exists in user1, so for user1 is shown as no shared
could we add the path for user1?

related owncloud/core#25302

@nasli
Copy link
Contributor

nasli commented Jul 5, 2016

@rullzer , @PVince81 any input here?

@davivel
Copy link
Contributor

davivel commented Jul 6, 2016

Also failing in Android.

As user2, the call GET [server]:[share_path]/shares?path=/folder1shareto2/file.txt&reshares=false returns an empty list.

The same call with reshares=truereturn the expected share with user3.

This is not what we would expect from the Share API documentation:
URL Arguments: reshares - (boolean) returns not only the shares from the current user but all shares from the given file.

From this I understand that the first call should return the share, that was created by user2. Is not user2 the owner of the share with user3, though it's resharing a file owned by user1?

@PVince81
Copy link

PVince81 commented Jul 6, 2016

The web UI of 9.0.2 also uses the OCS Share API for sharing and it works there to reshare a received folder with link share.

My steps:

  1. Login as admin
  2. Create two users "user1" and "user2"
  3. Login as "user1"
  4. Create a folder "test"
  5. Share "test" with "user2" with full permissions
  6. Login as "user2"
  7. Create a link share for the received folder "test" in the sharing panel

This is the POST request as observed in the network console (copy as curl, stripped down a bit):

curl 'http://localhost/owncloud/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json' -H 'OCS-APIREQUEST: true' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data 'password=&passwordChanged=false&permissions=31&expireDate=&shareType=3&path=%2Ftest' --compressed

Then after refreshing the page, to display the status in the sidebar, it does this request:
http://localhost/owncloud/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json&path=%2Ftest&reshares=true and that one returns

It returns:

{
  "ocs": {
    "meta": {
      "status": "ok",
      "statuscode": 200,
      "message": null
    },
    "data": [
      {
        "id": 3,
        "share_type": 3,
        "uid_owner": "user2",
        "displayname_owner": "user2",
        "permissions": 1,
        "stime": 1467794355,
        "parent": null,
        "expiration": null,
        "token": "5xpjhpUZrUkrRf9",
        "uid_file_owner": "user1",
        "displayname_file_owner": "user1",
        "path": "\\/test",
        "item_type": "folder",
        "mimetype": "httpd\\/unix-directory",
        "storage_id": "home::user1",
        "storage": "3",
        "item_source": 19,
        "file_source": 19,
        "file_parent": 13,
        "file_target": "\\/test",
        "share_with": null,
        "share_with_displayname": null,
        "url": "http:\\/\\/localhost\\/owncloud\\/index.php\\/s\\/5xpjhpUZrUkrRf9",
        "mail_send": 0
      }
    ]
  }
}

Same result if I set "reshares=false".

Not sure who that "user3" is @davivel ? Mind describing the use case / sharing situation you tested with more details ? (ideally with steps to reproduce).

@davivel
Copy link
Contributor

davivel commented Jul 6, 2016

Something strange happened in my environment... after calling with reshares=true, reshares=false responds as expected. Now I'm not sure if I made a mistake in the test and all that I told before is useless.

I'll double check, sorry for the noise.

@davivel
Copy link
Contributor

davivel commented Jul 6, 2016

@PVince81, just to clarify: instead of creating a link share in the step 7, I shared with user3; problem in mobile is the same no matter if the last share is public or private.

@PVince81
Copy link

PVince81 commented Jul 6, 2016

Also another question is whether 8.2.6 behaves differently or this bug hasn't been discovered until now.
If you think there is a problem with the API, please make a ticket in core with reproduction steps. (and ideally regression status)
Thanks.

@davivel
Copy link
Contributor

davivel commented Jul 6, 2016

After more (and better) testing, I'd say this is fixed with 9.0.3, here: owncloud/core#25067

@nasli, could you confirm for iOS?

@nasli
Copy link
Contributor

nasli commented Jul 6, 2016

@PVince81 to notice the error you must share a folder inside another one:
ex: user1 share /folder1shareTo2 that it is inside: /test/folder1shareTo2/
user2 receives /folder1shareto2/ and share a file inside: /folder1shareto2/file.txt to user3
Because if share a root folder all works.

Tested over
Works : 9.1.0.11, 9.0.3.2, 8.2.6.2, 8.2.4.2,
Fails : 9.0.2.2, 9.0.1.3, 9.0.0.19 -->in the path return the path of user1

@PVince81
Copy link

PVince81 commented Jul 7, 2016

Ah, I see.
Does it work with 9.0.3 ? (with owncloud/core#25067)

@nasli
Copy link
Contributor

nasli commented Jul 7, 2016

Yes @PVince81, with this PR works!

@nasli
Copy link
Contributor

nasli commented Jul 7, 2016

For Android nothing more is needed, but for the iOS app we need to revert a fix made to use file_target instead path in these cases for latest server version.

@daorte, this will be fixed with the next release of iOS 3.5.0 that is expected in next weeks and also you need to update your server to 9.0.3.2

@daorte
Copy link
Author

daorte commented Aug 24, 2016

Tested with OwnCloud 9.1.0.15 and iOS Client 3.5.0 and it works now...

Thanks

@nasli
Copy link
Contributor

nasli commented Aug 24, 2016

Great! Thanks for your feedback! ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants