Backendless Support
 
Declined

beforeRead event handler to protect file reads

Hi all together,

in my application, the users store a lot of files on the server, which are then read by the same user or others in the same company. That means I cannot set the read permission per file only to the one specific user which uploaded the file.

But then other users (in the authenticated users group) can also read these files if they know the path.

Here a beforeRead Event handler would be nice, to check whether the user is allowed to read this file. (I have stored the Information in the datebase which file belongs to which user and who is allowed to Access the file.)

Best regards,

Jonas

Leave a Comment

Comments (3)

photo
1

Thanks for this idea!

However, you can use user permissions to allow or disallow them to read the file.

Regards, Olga

photo
1

But how do I protect uploaded files from the user to be read by another user?

Is there any possibility to set the read/write permissions from codeless? Need to do this for about 10 user per file.

photo
1

Jonas,

There is no codeless block to set a permission. However, the API is available for using it from business logic (in JS and Java):

https://backendless.com/docs/js/doc.html#file_permissions_api

Regards,

Mark