mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-26 01:06:42 +00:00
Add new PUT argument for the public upload permission and include in the operation
This commit is contained in:
parent
cf3baa6cd5
commit
46f930f6cf
@ -46,7 +46,7 @@ package com.owncloud.android.lib.resources.shares;
|
||||
|
||||
/**
|
||||
* Updates parameters of an existing Share resource, known its remote ID.
|
||||
*
|
||||
* <p/>
|
||||
* Allow updating several parameters, triggering a request to the server per parameter.
|
||||
*/
|
||||
|
||||
@ -57,23 +57,37 @@ public class UpdateRemoteShareOperation extends RemoteOperation {
|
||||
private static final String PARAM_PASSWORD = "password";
|
||||
private static final String PARAM_EXPIRATION_DATE = "expireDate";
|
||||
private static final String PARAM_PERMISSIONS = "permissions";
|
||||
private static final String PARAM_PUBLIC_UPLOAD = "publicUpload";
|
||||
private static final String FORMAT_EXPIRATION_DATE = "yyyy-MM-dd";
|
||||
private static final String ENTITY_CONTENT_TYPE = "application/x-www-form-urlencoded";
|
||||
private static final String ENTITY_CHARSET = "UTF-8";
|
||||
|
||||
|
||||
/** Identifier of the share to update */
|
||||
/**
|
||||
* Identifier of the share to update
|
||||
*/
|
||||
private long mRemoteId;
|
||||
|
||||
/** Password to set for the public link */
|
||||
/**
|
||||
* Password to set for the public link
|
||||
*/
|
||||
private String mPassword;
|
||||
|
||||
/** Expiration date to set for the public link */
|
||||
/**
|
||||
* Expiration date to set for the public link
|
||||
*/
|
||||
private long mExpirationDateInMillis;
|
||||
|
||||
/** Access permissions for the file bound to the share */
|
||||
/**
|
||||
* Access permissions for the file bound to the share
|
||||
*/
|
||||
private int mPermissions;
|
||||
|
||||
/**
|
||||
* Upload permissions for the public link (only folders)
|
||||
*/
|
||||
private boolean mPublicUpload;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. No update is initialized by default, need to be applied with setters below.
|
||||
@ -84,6 +98,7 @@ public class UpdateRemoteShareOperation extends RemoteOperation {
|
||||
mRemoteId = remoteId;
|
||||
mPassword = null; // no update
|
||||
mExpirationDateInMillis = 0; // no update
|
||||
mPublicUpload = false;
|
||||
}
|
||||
|
||||
|
||||
@ -115,13 +130,22 @@ public class UpdateRemoteShareOperation extends RemoteOperation {
|
||||
/**
|
||||
* Set permissions to update in Share resource.
|
||||
*
|
||||
* @param permissions Permissions date to set to the target share.
|
||||
* @param permissions Permissions to set to the target share.
|
||||
* Values <= 0 result in no update applied to the permissions.
|
||||
*/
|
||||
public void setPermissions(int permissions) {
|
||||
mPermissions = permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable upload permissions to update in Share resource.
|
||||
*
|
||||
* @param publicUpload Upload Permission to set to the target share.
|
||||
*/
|
||||
public void setPublicUpload(boolean publicUpload) {
|
||||
mPublicUpload = publicUpload;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RemoteOperationResult run(OwnCloudClient client) {
|
||||
RemoteOperationResult result = null;
|
||||
@ -150,6 +174,8 @@ public class UpdateRemoteShareOperation extends RemoteOperation {
|
||||
parametersToUpdate.add(new Pair(PARAM_PERMISSIONS, Integer.toString(mPermissions)));
|
||||
}
|
||||
|
||||
parametersToUpdate.add(new Pair(PARAM_PUBLIC_UPLOAD, Boolean.toString(mPublicUpload)));
|
||||
|
||||
/* TODO complete rest of parameters
|
||||
if (mPublicUpload != null) {
|
||||
parametersToUpdate.add(new Pair("publicUpload", mPublicUpload.toString());
|
||||
|
Loading…
x
Reference in New Issue
Block a user