SetFileAccessPermission
bool CMain::SetFileAccessPermission( string path, array permissions, bool overwrite = true )
The method sets the access permissions for a file or folder. Returns true on success and false otherwise. Non-static method.
Parameters
Parameter | Description |
---|---|
path | Path to the file or folder relative to the root. In case of multiple sites, if the root directory is different , this parameters should specify an array: array("site ID", "Path to file or folder relative to the root") |
permissions | Array with access permissions of the Array("user group ID"=>"access permissions" [, ...]) format type. "Access permissions" can have the following values:
|
overwrite | If true, the existing permissions will be overwritten. Optional. By default value is true. |
See Also
- CMain::GetFileAccessPermission
- CMain::CopyFileAccessPermission
- CMain::RemoveFileAccessPermission
- "OnChangePermissions" event
Examples of use
<? // set the following permissions for the file /en/index.php: // for group #23 - read // for group #5 - write // other groups - deny access if ($APPLICATION->SetFileAccessPermission("/en/index.php", array("23" => "R", "5" => "W", "*" => "D"))) ShowNote("Permissions successfully modified."); ?>
© «Bitrix24», 2001-2024