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

delete public link passwords based on permission #4270

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

micbar
Copy link
Member

@micbar micbar commented Oct 19, 2023

Enhancement: Opt out of public link password enforcement

Users with special permissions can now delete passwords on read-only public links.

owncloud/ocis#7538

Needs owncloud/ocis#7540

Example

  1. Create Space "Test" as Admin (Admin has the permission ReadOnlyPublicLinkPassword.Delete)
  2. Invite Einstein as "Manager"
  3. Create Folder "New folder"
  4. As Einstein, create public link with "View" permission

No permission (Einstein)

As Einstein, try to remove the password after the link creation

Request

curl -L -X PUT 'https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/VftJhiyPEQbvPWw' \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-F 'permissions="1"' \
-F 'name="Link"' \
-F 'password=""' \
-F 'expireDate=""'

Response 403 - Forbidden

<?xml version="1.0" encoding="UTF-8"?>
<ocs>
    <meta>
        <status>error</status>
        <statuscode>104</statuscode>
        <message>user is not allowed to delete the password from the public link</message>
    </meta>
</ocs>
<?xml version="1.0" encoding="UTF-8"?>
<ocs>
    <meta>
        <status>ok</status>
        <statuscode>200</statuscode>
        <message>OK</message>
    </meta>
    <data>
        <id>VftJhiyPEQbvPWw</id>
        <share_type>3</share_type>
        <uid_owner>admin</uid_owner>
        <displayname_owner>Admin</displayname_owner>
        <additional_info_owner>[email protected]</additional_info_owner>
        <permissions>1</permissions>
        <stime>1698057363</stime>
        <parent></parent>
        <expiration></expiration>
        <token>YPFrYuLKgiQqxgH</token>
        <uid_file_owner>e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4</uid_file_owner>
        <displayname_file_owner></displayname_file_owner>
        <additional_info_file_owner></additional_info_file_owner>
        <state>0</state>
        <path>/New folder</path>
        <item_type>folder</item_type>
        <mimetype>httpd/unix-directory</mimetype>
        <space_id>storage-users-1$e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4!e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4</space_id>
        <space_alias>project/test</space_alias>
        <storage_id>shared::/New folder</storage_id>
        <storage>0</storage>
        <item_source>storage-users-1$e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4!59fafad1-fdaf-49fc-81ed-9eced1c4ea34</item_source>
        <file_source>storage-users-1$e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4!59fafad1-fdaf-49fc-81ed-9eced1c4ea34</file_source>
        <file_parent>storage-users-1$e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4!e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4</file_parent>
        <file_target>/New folder</file_target>
        <share_with_user_type>0</share_with_user_type>
        <share_with_additional_info></share_with_additional_info>
        <mail_send>0</mail_send>
        <name>Link</name>
        <url>https://localhost:9200/s/YPFrYuLKgiQqxgH</url>
        <quicklink>true</quicklink>
        <hide>false</hide>
    </data>
</ocs>

With permission (Admin)

As Admin, try to remove the password after the link creation

Request

curl -L -X PUT 'https://localhost:9200/ocs/v2.php/apps/files_sharing/api/v1/shares/VftJhiyPEQbvPWw' \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-F 'permissions="1"' \
-F 'name="Link"' \
-F 'password=""' \
-F 'expireDate=""'

Response 200 - OK

<?xml version="1.0" encoding="UTF-8"?>
<ocs>
    <meta>
        <status>ok</status>
        <statuscode>200</statuscode>
        <message>OK</message>
    </meta>
    <data>
        <id>VftJhiyPEQbvPWw</id>
        <share_type>3</share_type>
        <uid_owner>admin</uid_owner>
        <displayname_owner>Admin</displayname_owner>
        <additional_info_owner>[email protected]</additional_info_owner>
        <permissions>1</permissions>
        <stime>1698057363</stime>
        <parent></parent>
        <expiration></expiration>
        <token>YPFrYuLKgiQqxgH</token>
        <uid_file_owner>e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4</uid_file_owner>
        <displayname_file_owner></displayname_file_owner>
        <additional_info_file_owner></additional_info_file_owner>
        <state>0</state>
        <path>/New folder</path>
        <item_type>folder</item_type>
        <mimetype>httpd/unix-directory</mimetype>
        <space_id>storage-users-1$e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4!e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4</space_id>
        <space_alias>project/test</space_alias>
        <storage_id>shared::/New folder</storage_id>
        <storage>0</storage>
        <item_source>storage-users-1$e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4!59fafad1-fdaf-49fc-81ed-9eced1c4ea34</item_source>
        <file_source>storage-users-1$e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4!59fafad1-fdaf-49fc-81ed-9eced1c4ea34</file_source>
        <file_parent>storage-users-1$e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4!e6c4fc73-ddbc-41c1-b0ee-c35a648bf6e4</file_parent>
        <file_target>/New folder</file_target>
        <share_with_user_type>0</share_with_user_type>
        <share_with_additional_info></share_with_additional_info>
        <mail_send>0</mail_send>
        <name>Link</name>
        <url>https://localhost:9200/s/YPFrYuLKgiQqxgH</url>
        <quicklink>true</quicklink>
        <hide>false</hide>
    </data>
</ocs>

@micbar micbar marked this pull request as draft October 19, 2023 20:05
@micbar micbar marked this pull request as ready for review October 23, 2023 10:51
@micbar micbar merged commit f9a6637 into cs3org:edge Oct 23, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants