CanUserOperateDocument
bool
public static function CBPDocument::CanUserOperateDocument(
int operation,
int userId,
array documentId,
array arParameters = array()
);
This method verifies if a user can perform the specified operation with a document. Verification is performed by addressing the document entity.
Note: Method accepts an array of configuration parameters and generates scripts, required to show file dialog. Static method.
Method parameters
Parameter | Description |
---|---|
operation | Operation from CBPCanUserOperateOperation |
userId | User ID code |
documentId | Document ID code as an array(module, document_class, document_code_in_module) |
arParameters | Associative array of auxiliary parameters. It is used to avoid recalculation of the computed values, which are already known at the moment of method call. Keys for the DocumentStates array - workflows statuses array for this document, are deemed as standard, WorkflowId - workflow ID code (if required, operation must be checked on one of workflows). Array can be supplemented by other arbitrary keys. |
Returned value
Returns "true", if the user has the right to complete the specified operation. Otherwise, returns "false".
See Also
Example
<?
$bCanAccess = CBPDocument::CanUserOperateDocument(
CBPCanUserOperateOperation::CreateWorkflow,
$GLOBALS["USER"]->GetID(),
$documentId,
array("UserGroups" => $arUserGroups)
);
if (!$bCanAccess)
die("Access denied");
?>
© «Bitrix24», 2001-2024