Hi! I would like to grant READ permission for “NotAuthenticatedUser” after creating file, but i’m not able.
BackendlessFile mediaFile = ...
I have no exception but in console the file hasn’t read permission (for NotAuthenticatedUser role)
Are you able to alter role permissions using Concole?
Yes, i’m able. The problem is only the code, that it seems to have no effect. (i am AuthenticatedUser when i create the file and the AuthenticatedUser has granted all permissions by default on file)
I assume there is a logged in user at the time when the “grantForRole” method is called. Does the “AuthenticatedUser” role or the specific logged in user have the “Permission” permission?
You can check it using console:
Upload a file using API
Open console and navigate to the file
Click the "lock" icon for the file
Switch to "Roles Permissions"
See the "Permission" column and the row for the role in question.
Yes, the AuthenticatedUser has “Permission” permission
Thank you. I just tried the same thing and notices that the “url” parameter must be of a specific format.
For example, the call to mediaFile.getFileUrl() may return this:
The “url” argument for that file for this call:
must be this:
In that case, it works as expected.
I will make sure the doc is updated to reflect this.