IO::FileAccess
- IO::FileAccess(fileName, mode): bool
-
Check file access.
In server scripts,
IO::functions are available only if server configuration variableNXSL.EnableFileIOFunctionsis enabled (change requires server restart). They are always available in scripts run bynxscript.In addition, a script that runs on behalf of a user (see Scripts Started by a User) needs the "Access server file system from scripts" system access right, and scripts in read-only script contexts cannot use
IO::functions whileScripts.RestrictWriteAccessis enabled. A denied call returnsfalsewithout a script error.Table 1. Parameters fileName
String
File to check access on
mode
Integer
Mode to check
Table 2. Windows access mode 00
Existence only
02
Write-only
04
Read-only
06
Read and write
Table 3. Unix like system access mode 0
Existence only
1
Execute permission
2
Write permission
4
Read permission
ReturnTRUEif user has given access to provided file andFALSEif not.return IO::FileAccess("/tmp/file", 5) // Will return true if user has read and execute access to file