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

OC Sharing API removes expiration date when updating a share with a password #14826

Closed
SergioBertolinSG opened this issue Mar 12, 2015 · 8 comments

Comments

@SergioBertolinSG
Copy link
Contributor

Steps to reproduce

  1. Share a folder by link.

  2. Update the public share adding an expiration date
    2.1 get the shares ids:

    curl -X GET http://USER:PASSWORD@OWNCLOUDPATH/ocs/v1.php/apps/files_sharing/api/v1/shares
    

    2.2 Use the share id for your folder:

    curl -v -X PUT -d expireDate=2015-03-13     http://USER:PASSWORD@OWNCLOUDPATH/ocs/v1.php/apps/files_sharing/api/v1/shares/SHARE_ID
    
  3. Add a password

curl -v -X PUT -d password=Manolito http://USER:PASSWORD@OWNCLOUDPATH/ocs/v1.php/apps/files_sharing/api/v1/shares/SHARE_ID

Expected behaviour

A password is added and the expiration date is kept.

Actual behaviour

Password is added and expiration date is lost.

Server configuration

Operating system:
Ubuntu 14.04 LTS

Web server:
Apache

Database:
MySQL

PHP version:
5.5.9

ownCloud version: (see ownCloud admin page)
{"installed":true,"maintenance":false,"version":"8.0.1.1","versionstring":"8.0.1","edition":"Enterprise"}

Updated from an older ownCloud or fresh install:
Updated

List of activated apps:
Default in enterprise version.

The content of config/config.php:


Are you using external storage, if yes which one: local/smb/sftp/...
no

Are you using encryption: yes

Client configuration

*browser
Chrome

@PVince81
Copy link
Contributor

Related: #10671
Setting a password actually creates a new share... so even the token changes.

@PVince81
Copy link
Contributor

@schiesbn

@luciamaestro
Copy link

The same problem when you do it from the desktop client

@PVince81 PVince81 added this to the 8.1-current milestone Mar 12, 2015
@PVince81
Copy link
Contributor

Setting to 8.1 to keep this in mind @DeepDiver1975 especially that it will affect the clients more in the future.

@rullzer
Copy link
Contributor

rullzer commented Mar 13, 2015

So I just ran a few tests and it seems that it even worse.
Even when expiration is enforced. Adding a password removes the expiration date.

So it seems that for some reason we handle adding a password differently from modifying any of the other properties. (permission expire date). I do not really get why we do this (maybe some historic reason?).

If the old expire date is retrieved in https://github.com/owncloud/core/blob/master/lib/private/share/share.php#L668 (which works) and then passed in https://github.com/owncloud/core/blob/master/lib/private/share/share.php#L711 things still break. So it seems like the whole bunch of functions called after that are somewhat broken with respect to adding a password.

I'll see what happens if we just add some logic to update the password in the same way we update the expire date.

@PVince81
Copy link
Contributor

I don't think there is any specific reason for resetting the share when changing the password. It doesn't even make sense.
From what I remember it's just a bug.

@rullzer
Copy link
Contributor

rullzer commented Mar 13, 2015

WIP PR in #14868

@MorrisJobke
Copy link
Contributor

Fixed in #14987

@lock lock bot locked as resolved and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants