N4S4 / synology-api

A Python wrapper around Synology API
MIT License
368 stars 138 forks source link

Is there a way to check if I have read-only permissions on a file ? #81

Closed danieleTrimarchi closed 8 months ago

danieleTrimarchi commented 2 years ago

The case is specific to a shared folder. In order to check file permissions, I do :

from synology_api import filestation, downloadstation
fl = filestation.FileStation(<URL>, <port>, <userName>, <password>,secure=True)
fl.check_permissions(path="/SharedFolder/myFile.png", filename="myFile.png")

According to the permissions of the user, I get:

NO ACCESS : {'error': {'code': 407}, 'success': False} FULL ACCESS : {'data': {'blSkip': False}, 'success': True} READ ONLY: {'data': {'blSkip': False}, 'success': True}

Is there a way to discriminate between FULL ACCESS and READ ONLY access ?

Note that because of https://github.com/N4S4/synology-api/pull/54 I am still on v.0.1.3.1. I think v.0.4.0 broke that fix (but I have not investigated further yet)

N4S4 commented 2 years ago

Hi Daniele,

the function check_permission() is working for me. In 'path' you don't need to specify the file but just the path , so it will be '/download' while 'filename' will be a filename you want to write to given path.

If you receive an error response means that there is no write permission for the active user, there is no way to discriminate it according to the filestation api guide, for this I will need further investigation.

Regarding #54 v.0.4 did not break the fix

To allow it to work on local network with https you will need to set 'secure=True, cert_verify=False' while logging in.

N4S4 commented 8 months ago

Closed for inactivity