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

Didn't found any way to list files of others users #68

Open
luffah opened this issue Apr 29, 2021 · 1 comment
Open

Didn't found any way to list files of others users #68

luffah opened this issue Apr 29, 2021 · 1 comment

Comments

@luffah
Copy link

luffah commented Apr 29, 2021

In methods list_folders, you can specify the user, therefore an altenative user, but i did'nt have any success using this.
To have this not working is not so bad... it could imply many security issues.

    def list_folders(self, uid, path=None, depth=1, all_properties=False):
        """
        Get path files list with files properties for given user, with given depth

        Args:
 --->       uid (str): uid of user     <---
            path (str/None): files path
            depth (int): depth of listing files (directories content for example)
            all_properties (bool): list all available file properties in Nextcloud
        """
    ...
    # therefore many requests occur to be...
    nxc.list_folder(nxc.user, '/')
    #  if alternative user can't be explored, it may be simpler to do
    nxc.list_folder('/')
@luffah luffah changed the title Found anyway to list files of others users Didn't found any way to list files of others users May 1, 2021
@luffah
Copy link
Author

luffah commented May 1, 2021

Tested with curl:

getfiles.xml

<?xml version="1.0" encoding="UTF-8"?>
<d:propfind
    xmlns:d="DAV:"
    xmlns:oc="http://owncloud.org/ns"
    xmlns:nc="http://nextcloud.org/ns">
    <d:prop>
        <oc:id />
        <oc:fileid />
    </d:prop>
</d:propfind>
_curl(){
  echo "<!-- $* -->"
  curl --silent \
    -k \
    -X $1 \
    --data "$2" \
    -u ${NC_USER}:${NC_USER_PWD} \
    "$3" | xmllint --format -
}
# let's assume to ease example that passwords are the same for all user
NC_USER=ncadmin
_curl PROPFIND @getfiles.xml $NC_DAV_URL/files/${NC_USER}  
# ->  <d:status>HTTP/1.1 200 OK</d:status>

NC_USER=test
_curl PROPFIND @getfiles.xml $NC_DAV_URL/files/${NC_USER}
# ->  <d:status>HTTP/1.1 200 OK</d:status>

NC_USER=ncadmin
_curl PROPFIND @getfiles.xml $NC_DAV_URL/files/test
# -> <d:status>HTTP/1.1 404 Not Found</d:status>

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

No branches or pull requests

1 participant