Documentation

CanUserOperateDocumentType

bool
public static function CBPDocument::CanUserOperateDocumentType(
 int operation,
 int userId,
 array documentType,
 array arParameters = array()
);

This method verifies if user can perform the specified operation with documents of this type. This method performs verification by addressing the document type entity.

Note: This method receives the array of configuration parameters and generates scripts, required to show file dialog. Static method.

Method parameters

ParameterDescription
operationOperation from CBPCanUserOperateOperation
userIdUser ID code
documentTypeDocument type code as an array(module, document_class, document_type_in_module)
arParametersAssociative 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 user has the access right to perform the specified operation. Otherwise, returns "false".

See Also

Examples

<?
$bCanAccess = CBPDocument::CanUserOperateDocumentType(
CBPCanUserOperateOperation::CreateWorkflow,
$GLOBALS["USER"]->GetID(),
$documentType,
array("UserGroups" => $arUserGroups)
);
if (!$bCanAccess)
die("Access denied");
?>


© «Bitrix24», 2001-2024
Up