IsFileAccessibleByUser
boolean CTaskFiles::isFileAccessibleByUser( $fileId, $userId );
This method checks the file accessibility (within task module) for a specified user.
Note: This method accepts an array of configuration parameters and generates scripts, necessary to show file dialog. Static method.
Method parameters
Parameter | Description |
---|---|
$fileId | Checked file ID. |
$userId | ID of the user for which the file accessibility is checked. |
Returned value
Returns true, if file with $fileId identifier is available for user with $userId identifier to be read within task module framework. File is accessible to user, if the file is attached to at least one of the tasks, accessible to user, or to at least one of the task templates that is accessible to user. Also, file is accessible, if it was registered via CTaskFiles::saveFileTemporary() as temporary file for subsequent attachment to a task.
If the user $userId identifier is an administrator, then true will be returned independently of whether this file is available in tasks/temlates or among temporary uploaded files.
Examples of use
<?php CModule::IncludeModule('tasks'); $fileId = 456; $userId = (int) $GLOBALS['USER']->getId(); if (CTaskFiles::isFileAccessibleByUser($fileId, $userId)) echo 'Files is accessible'; else echo 'Access denied'; ?>
© «Bitrix24», 2001-2024