File permission NotAuthenticatedUser

Hi! I would like to grant READ permission for “NotAuthenticatedUser” after creating file, but i’m not able.
My code:

BackendlessFile mediaFile = ...
FilePermission.READ.grantForRole("NotAuthenticatedUser", mediaFile.getFileUrl());

I have no exception but in console the file hasn’t read permission (for NotAuthenticatedUser role)

Hello @kegita,
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?


How can i check it ad runtime???

however, from dashboard</img>


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:

FilePermission.READ.grantForRole("NotAuthenticatedUser", url);

must be this:


In that case, it works as expected.

I will make sure the doc is updated to reflect this.


Thank you! now it works!