@@ -652,25 +652,41 @@ def copy(self, remote_path_source, remote_path_target):
652652 """
653653 return self .__webdav_move_copy (remote_path_source ,remote_path_target ,"COPY" )
654654
655- def share_file_with_link (self , path ):
655+ def share_file_with_link (self , path , ** kwargs ):
656656 """Shares a remote file with link
657657
658658 :param path: path to the remote file to share
659+ :param perms (optional): permission of the shared object
660+ defaults to read only (1)
661+ :param public_upload (optional): allows users to upload files or folders
662+ :param password (optional): sets a password
663+ http://doc.owncloud.org/server/6.0/admin_manual/sharing_api/index.html
659664 :returns: instance of :class:`PublicShare` with the share info
660665 or False if the operation failed
661666 :raises: HTTPResponseError in case an HTTP error status was returned
662667 """
668+ perms = kwargs .get ('perms' , None )
669+ public_upload = kwargs .get ('public_upload' , 'false' )
670+ password = kwargs .get ('password' , None )
671+
672+
663673 path = self .__normalize_path (path )
664674 post_data = {
665675 'shareType' : self .OCS_SHARE_TYPE_LINK ,
666- 'path' : self .__encode_string (path )
676+ 'path' : self .__encode_string (path ),
667677 }
678+ if (public_upload is not None ) and (isinstance (public_upload , bool )):
679+ post_data ['publicUpload' ] = str (public_upload ).lower ()
680+ if isinstance (password , basestring ):
681+ post_data ['password' ] = password
682+ if perms :
683+ post_data ['permissions' ] = perms
668684
669685 res = self .__make_ocs_request (
670686 'POST' ,
671687 self .OCS_SERVICE_SHARE ,
672688 'shares' ,
673- data = post_data
689+ data = post_data
674690 )
675691 if res .status_code == 200 :
676692 tree = ET .fromstring (res .content )
0 commit comments