Skip to content

Share not created with default permissions #1277

Closed

Description

@dpakach

While creating the share if we dont specify the permission, it doesn't use one by default.

e.g.

no permission specified

❯ curl -k -u tu1:1234 -XPOST http://localhost:9140/ocs/v1.php/apps/files_sharing/api/v1/shares -d path=file.txt -d shareType=3 -v 
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 127.0.0.1:9140...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9140 (#0)
* Server auth using Basic with user 'tu1'
> POST /ocs/v1.php/apps/files_sharing/api/v1/shares HTTP/1.1
> Host: localhost:9140
> Authorization: Basic dHUxOjEyMzQ=
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 25
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 25 out of 25 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Vary: Origin
< X-Access-Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZXZhIiwiZXhwIjoxNTkzNDkyMDgyLCJpYXQiOjE1OTM0ODg0ODIsImlzcyI6Imh0dHBzOi8vbG9jYWxob3N0OjkyMDAiLCJ1c2VyIjp7ImlkIjp7ImlkcCI6Imh0dHBzOi8vbG9jYWxob3N0OjkyMDAiLCJvcGFxdWVfaWQiOiJ0dTEifSwidXNlcm5hbWUiOiJ0dTEiLCJtYWlsIjoidHUxQGV4YW1wbGUub3JnIn19.fqJ5XmRG-t7ea_9v3-0CWKCtzaQQcQkZ1l7h2feGKac
< Date: Tue, 30 Jun 2020 03:41:22 GMT
< Content-Length: 0
< 
* Connection #0 to host localhost left intact

With permission specified

❯ curl -k -u tu1:1234 -XPOST http://localhost:9140/ocs/v1.php/apps/files_sharing/api/v1/shares -d permissions=4 -d path=file.txt -d shareType=3 -v
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 127.0.0.1:9140...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9140 (#0)
* Server auth using Basic with user 'tu1'
> POST /ocs/v1.php/apps/files_sharing/api/v1/shares HTTP/1.1
> Host: localhost:9140
> Authorization: Basic dHUxOjEyMzQ=
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 39
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 39 out of 39 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Vary: Origin
< X-Access-Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZXZhIiwiZXhwIjoxNTkzNDkxOTk5LCJpYXQiOjE1OTM0ODgzOTksImlzcyI6Imh0dHBzOi8vbG9jYWxob3N0OjkyMDAiLCJ1c2VyIjp7ImlkIjp7ImlkcCI6Imh0dHBzOi8vbG9jYWxob3N0OjkyMDAiLCJvcGFxdWVfaWQiOiJ0dTEifSwidXNlcm5hbWUiOiJ0dTEiLCJtYWlsIjoidHUxQGV4YW1wbGUub3JnIn19.MlE5MG05XBEBEQga_xvrpK0ukjM6915vB7LYl62gric
< Date: Tue, 30 Jun 2020 03:40:00 GMT
< Content-Length: 1030
< Content-Type: text/xml; charset=utf-8
< 
<?xml version="1.0" encoding="UTF-8"?>
<ocs><meta><status>ok</status><statuscode>100</statuscode><message>OK</message></meta><data><id>BRvCKVOuHfyS</id><share_type>3</share_type><uid_owner>tu1@https://localhost:9200</uid_owner><displayname_owner></displayname_owner><permissions>4</permissions><stime>1593488400</stime><parent></parent><expiration></expiration><token>suECupWuxgDD</token><uid_file_owner>tu1</uid_file_owner><displayname_file_owner></displayname_file_owner><additional_info_owner></additional_info_owner><additional_info_file_owner></additional_info_file_owner><state>0</state><path>/file.txt</path><item_type>file</item_type><mimetype>application/octet-stream</mimetype><storage_id>1284d238-aa92-42ce-bdc4-0b0000009158</storage_id><storage>0</storage><item_source>394600120320</item_source><file_source>394600120320</file_source><file_parent></file_parent><file_target>/file.txt</file_target><share_with_additional_info></share_with_additional_info><mail_send></mail_send><url>/#/s/suECupWuxgDD</url></data>* Connection #0 to host localhost left intact
</ocs>%   

Activity

  1. transferred this issue fromowncloud/ocis-revaon Jan 18, 2021
  2. changed the title [-][EOS] share not created with default permissions[/-] [+]Share not created with default permissions[/+] on Jan 18, 2021
  3. jasson99 commented on Apr 15, 2021

    @jasson99
    Contributor

    The behaviour now seems to be a bit different.

    No permission specified:

    curl -k -X POST https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d path=file.txt -d shareType=3 -u tu1:1234 |xmllint --format -

    <?xml version="1.0" encoding="UTF-8"?>
    <ocs>
      <meta>
        <status>ok</status>
        <statuscode>100</statuscode>
        <message>OK</message>
      </meta>
      <data>
        <id>TwxKRUXOLoJinyx</id>
        <share_type>3</share_type>
        <uid_owner>tu1</uid_owner>
        <displayname_owner>tu1</displayname_owner>
        <additional_info_owner>[email protected]</additional_info_owner>
        <permissions>1</permissions>
        <stime>1618486387</stime>
        <parent/>
        <expiration/>
        <token>gkenAwNCpxaMJLb</token>
        <uid_file_owner>tu1</uid_file_owner>
        <displayname_file_owner>tu1</displayname_file_owner>
        <additional_info_file_owner>[email protected]</additional_info_file_owner>
        <state>0</state>
        <path>/file.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>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjQ2NzhlM2I4LWY3Y2QtNDRjMi1iMzMwLTNhMmFiMjJhNjJmOQ==</item_source>
        <file_source>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjQ2NzhlM2I4LWY3Y2QtNDRjMi1iMzMwLTNhMmFiMjJhNjJmOQ==</file_source>
        <file_parent/>
        <file_target>/file.txt</file_target>
        <share_with_additional_info/>
        <mail_send>0</mail_send>
        <name/>
        <url>https://localhost:9200/#/s/gkenAwNCpxaMJLb</url>
      </data>
    </ocs>
    

    Permissions specified:

    curl -k -u tu1:1234 -X POST https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d permissions=3 -d path=file.txt -d shareType=3 |xmllint --format -

    <?xml version="1.0" encoding="UTF-8"?>
    <ocs>
      <meta>
        <status>error</status>
        <statuscode>400</statuscode>
        <message>Could not read permission from request</message>
      </meta>
    </ocs>
    
    

    curl -k -u tu1:1234 -X POST https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d permissions=15 -d path=file.txt -d shareType=3 |xmllint --format -

    <?xml version="1.0" encoding="UTF-8"?>
    <ocs>
      <meta>
        <status>ok</status>
        <statuscode>100</statuscode>
        <message>OK</message>
      </meta>
      <data>
        <id>ntMrseYsxKAyXkh</id>
        <share_type>3</share_type>
        <uid_owner>tu1</uid_owner>
        <displayname_owner>tu1</displayname_owner>
        <additional_info_owner>[email protected]</additional_info_owner>
        <permissions>3</permissions>
        <stime>1618989126</stime>
        <parent/>
        <expiration/>
        <token>eSeunsLEcVNiBcW</token>
        <uid_file_owner>tu1</uid_file_owner>
        <displayname_file_owner>tu1</displayname_file_owner>
        <additional_info_file_owner>[email protected]</additional_info_file_owner>
        <state>0</state>
        <path>/file.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>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjQ2NzhlM2I4LWY3Y2QtNDRjMi1iMzMwLTNhMmFiMjJhNjJmOQ==</item_source>
        <file_source>MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU3OjQ2NzhlM2I4LWY3Y2QtNDRjMi1iMzMwLTNhMmFiMjJhNjJmOQ==</file_source>
        <file_parent/>
        <file_target>/file.txt</file_target>
        <share_with_additional_info/>
        <mail_send>0</mail_send>
        <name/>
        <url>https://localhost:9200/#/s/eSeunsLEcVNiBcW</url>
      </data>
    </ocs>
    
    

    curl -k -u tu1:1234 -X POST https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d permissions=4 -d path=file.txt -d shareType=3 |xmllint --format -

    <?xml version="1.0" encoding="UTF-8"?>
    <ocs>
      <meta>
        <status>error</status>
        <statuscode>400</statuscode>
        <message>Cannot set the requested share permissions</message>
      </meta>
    </ocs>
    
    
  4. jasson99 commented on Apr 21, 2021

    @jasson99
    Contributor

    Description:

    Different share permissions have varying role in core and ocis

    In OC10:

    1. Create a share with permissions 31 or default has role specified as Editor.
      curl -k -X POST http://localhost/oc/ocs/v2.php/apps/files_sharing/api/v1/shares\?format\=json -d path="new new" -d shareWith="test123" -d permissions=31 -d shareType="0" -u admin:admin -v;

    2. Create a share with permissions 1 has role specified as Advanced Permissions
      curl -k -X POST http://localhost/oc/ocs/v2.php/apps/files_sharing/api/v1/shares\?format\=json -d path="new new" -d shareWith="test123" -d permissions=1 -d shareType="0" -u admin:admin -v;

    3. Create a share with permissions 17 has role specified as Viewer
      curl -k -X POST http://localhost/oc/ocs/v2.php/apps/files_sharing/api/v1/shares\?format\=json -d path="new new" -d shareWith="test123" -d permissions=17 -d shareType="0" -u admin:admin -v;

    In OCIS:

    1. Create a share with permissions 31 or default has role specified as Advanced Permissions.
      curl -k -u admin:admin -X POST https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d permissions=31 -d path="new new" -d shareType=0 -d shareWith="user1" |xmllint --format -

    2. Create a share with permissions 1 has role specified as Viewer
      curl -k -u admin:admin -X POST https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d permissions=1 -d path="new new" -d shareType=0 -d shareWith="user1" |xmllint --format -

    3. Create a share with permissions 17 has role specified as Advanced Permissions
      curl -k -u admin:admin -X POST https://localhost:9200/ocs/v1.php/apps/files_sharing/api/v1/shares -d permissions=17 -d path="new new" -d shareType=0 -d shareWith="user1" |xmllint --format -

  5. kiranparajuli589 commented on Jun 20, 2022

    @kiranparajuli589
    Contributor

    The behavior has evolved now behaving as:

    Link shares

    • without permission supplied
      • share is created with permission 1
      • the UI shows Viewer role assigned
    • with permissions supplied
      • permission 3 provided with payload -> share is created with the same permission -> UI shows the Editor role assigned
      • permission 4 or 15 or 17 or 31 provided with payload -> share is not created -> message: unknown share types

    User shares

    • without permission supplied
      • share is created with permission 19
      • UI shows the Editor role assigned
    • with permission supplied
      • permission 1 provided -> share created with permission 1 -> UI shows the Custom Permissions role assigned
      • permission 3 provided -> share created with permission 3 -> UI shows the Custom Permissions role assigned
      • permission 4 provided -> share is not created -> message: [400]Cannot set the requested share permissions
      • permission 15 provided -> share created with permission 3 -> UI shows the Custom Permissions role assigned
      • permission 17 provided -> share created with permission 17 -> UI shows the Viewer role assigned
      • permission 19 provided -> share created with permission 19 -> UI shows the Editor role assigned
      • permission 31 provided -> share created with permission 19 -> UI shows the Editor role assigned
  6. kiranparajuli589 commented on Jun 21, 2022

    @kiranparajuli589
    Contributor

    After owncloud/web#7136, a lot of the tagged scenarios have been removed.
    QA-Team Todo:

    • investigate the remaining scenarios in the expected failures list
  7. saw-jan commented on Jun 21, 2022

    @saw-jan
    Member

    After owncloud/web#7136, a lot of the tagged scenarios have been removed. QA-Team Todo:

    • investigate the remaining scenarios in the expected failures list

    Also, it would be nice to see if this issue can be closed

  8. amrita-shrestha commented on Jun 22, 2022

    @amrita-shrestha
    Contributor

    Creating share without specific permission, create user-share with default permission 31 and public-share with default permission 1.That's a actual behavior

    In ocis, the behavior has evolved now behaving as:

    Link shares

    • without permission supplied
      • share is created with permission 1 (default permission for public-link share)
      • the UI shows Viewer role assigned
    • with permissions supplied
      • permission 2 provided -> htpp status code 400 -> message:Could not read permission from request
      • permission 3 provided with payload -> share is created with the same permission -> UI shows [ocis] Shares sidebar does not show created public-link with Permission 3  web#7164
      • permission 4 provided -> share created with permission 4 -> UI shows the Uploader role assigned
      • permission 15 provided -> share created with permission 15 -> UI shows the Editor role assigned
      • permission 17 provided -> htpp status code 400 -> message:Could not read permission from request
      • permission 31 provided -> share created with permission 1 -> UI shows the Viewer role assigned

    User shares

    • without permission supplied
      • share is created with permission 31 (default permission for user-share)
      • UI shows the Editor role assigned
    • with permission supplied
      • permission 1 provided -> share created with permission 1 -> UI shows the Custom Permissions (read)role assigned
      • permission 2 provided -> share created with permission 2 -> UI shows the Custom Permissions (Update)role assigned
      • permission 3 provided -> share created with permission 3 -> UI shows the Custom Permissions role assigned (read, update)
      • permission 4 provided ->share created with permission 4 -> UI shows the Custom Permissions (create)role assigned
      • permission 5 provided ->share created with permission 5 -> UI shows the Custom Permissions (read,create)role assigned
      • permission 6 provided -> share created with permission 6 -> UI shows the Custom Permissions (Update,create)role assigned
      • permission 7 provided -> share created with permission 3 -> UI shows the Custom Permissions role assigned (read, update,create)
      • permission 15 provided -> share created with permission 15 -> UI shows the Custom Permissions role assigned (read, update,create, delete )
      • permission 17 provided -> share created with permission 17 -> UI shows the Viewer role assigned
      • permission 19 provided -> share created with permission 19 -> UI shows the Custom Permissions role assigned(read, update, share)
      • permission 31 provided -> share created with permission 31 -> UI shows the Editor role assigned
  9. amrita-shrestha commented on Jun 24, 2022

    @amrita-shrestha
    Contributor
    • investigate the remaining scenarios in the expected failures list

    This issue has been solved but there are many scenarios under this issue in the expected failure list. Need a lot of changes on that scenario to pass. Should be discussed first Is it worth investing time in such a task. Until any decision is made transfered into the backlog.

  10. SwikritiT commented on Jul 6, 2022

    @SwikritiT
    Contributor
  11. SwikritiT commented on Jul 8, 2022

    @SwikritiT
    Contributor

    follow up PR for expected to fail here owncloud/web#7246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions