Function API only Updated 17 Oct 2026
allowRead(path, [username])
Checks whether the logged-in visitor, or a given user, may open the specified file or folder in Docly. For a folder this is Browse access, for a file Read access. Only meaningful on sites with login.
See also Path traversal
Parameters
pathstringrequiredPath to the file or folder, from the site root. The path is looked up as a folder first, then as a file.
usernamestringoptionalLogin (email) of the user to check. Defaults to the logged-in visitor.
Returns
true or false. false when no username is given and nobody is logged in, when the user is unknown, or when the path matches neither a folder nor a file.
Example
Normal JavaScript, running in the browser or on the Docly™ server.
if (docly.allowRead("test file"))
{
return "Access allowed";
}