owncloud/owncloud.py
def share_file_with_user(self, path, user, **kwargs):
        """Shares a remote file with specified user

        :param path: path to the remote file to share
        :param user: name of the user whom we want to share a file/folder
        :param perms (optional): permissions of the shared object
            defaults to read only (1)
            http://doc.owncloud.org/server/6.0/admin_manual/sharing_api/index.html
        :returns: instance of :class:`UserShare` with the share info
            or False if the operation failed
        :raises: ResponseError in case an HTTP error status was returned
        """
        perms = kwargs.get('perms', self.OCS_PERMISSION_READ)
        if (((not isinstance(perms, int)) or (perms > self.OCS_PERMISSION_ALL))
            or ((not isinstance(user, basestring)) or (user == ''))):
            return False

        path = self.__normalize_path(path)
        post_data = {'shareType': self.OCS_SHARE_TYPE_USER, 'shareWith': user, 'path': path, 'permissions': perms}

        res = self.__make_ocs_request(
                'POST',
                self.OCS_SERVICE_SHARE,
                'shares',
                data = post_data
                )
        if res.status_code == 200:
            tree = ET.fromstring(res.text)
            self.__check_ocs_status(tree)
            data_el = tree.find('data')
            return UserShare(
                int(data_el.find('id').text),
                path,
                perms
            )
        raise ResponseError(res)
Shares a remote file with specified user

        :param path: path to the remote file to share
        :param user: name of the user whom we want to share a file/folder
        :param perms (optional): permissions of the shared object
            defaults to read only (1)
            http://doc.owncloud.org/server/6.0/admin_manual/sharing_api/index.html
        :returns: instance of :class:`UserShare` with the share info
            or False if the operation failed
        :raises: ResponseError in case an HTTP error status was returned
        
Shares a remote file with specified user
Shares a remote file with specified user
def share_file_with_user(self, path, user, **kwargs):
        perms = kwargs.get('perms', self.OCS_PERMISSION_READ)
        if (((not isinstance(perms, int)) or (perms > self.OCS_PERMISSION_ALL))
            or ((not isinstance(user, basestring)) or (user == ''))):
            return False
        path = self.__normalize_path(path)
        post_data = {'shareType': self.OCS_SHARE_TYPE_USER, 'shareWith': user, 'path': path, 'permissions': perms}
        res = self.__make_ocs_request(
                'POST',
                self.OCS_SERVICE_SHARE,
                'shares',
                data = post_data
                )
        if res.status_code == 200:
            tree = ET.fromstring(res.text)
            self.__check_ocs_status(tree)
            data_el = tree.find('data')
            return UserShare(
                int(data_el.find('id').text),
                path,
                perms
            )
        raise ResponseError(res)
def share_file_with_user ( self , path , user , ** kwargs ) : perms = kwargs . get ( 'perms' , self . OCS_PERMISSION_READ ) if ( ( ( not isinstance ( perms , int ) ) or ( perms > self . OCS_PERMISSION_ALL ) ) or ( ( not isinstance ( user , basestring ) ) or ( user == '' ) ) ) : return False path = self . __normalize_path ( path ) post_data = { 'shareType' : self . OCS_SHARE_TYPE_USER , 'shareWith' : user , 'path' : path , 'permissions' : perms } res = self . __make_ocs_request ( 'POST' , self . OCS_SERVICE_SHARE , 'shares' , data = post_data ) if res . status_code == 200 : tree = ET . fromstring ( res . text ) self . __check_ocs_status ( tree ) data_el = tree . find ( 'data' ) return UserShare ( int ( data_el . find ( 'id' ) . text ) , path , perms ) raise ResponseError ( res )
Shares a remote file with specified user
Shares a remote file with specified user
"""Shares a remote file with specified user

        :param path: path to the remote file to share
        :param user: name of the user whom we want to share a file/folder
        :param perms (optional): permissions of the shared object
            defaults to read only (1)
            http://doc.owncloud.org/server/6.0/admin_manual/sharing_api/index.html
        :returns: instance of :class:`UserShare` with the share info
            or False if the operation failed
        :raises: ResponseError in case an HTTP error status was returned
        """
instance of :class:`UserShare` with the share info
or False if the operation failed
instance of : class : ` UserShare ` with the share info or False if the operation failed
ResponseError in case an HTTP error status was returned
ResponseError in case an HTTP error status was returned
self
path
path to the remote file to share
path to the remote file to share
user
name of the user whom we want to share a file/folder
name of the user whom we want to share a file / folder
(optional)
None
read only (1)
http://doc.owncloud.org/server/6.0/admin_manual/sharing_api/index.html