Documentation

GetPermissions

array
CFormResult::GetPermissions(
 int result_id,
 int &current_status_id
)

The function returns an array of symbol values of access permissions for the current user for the specified result. Additionally, the method returns an ID of status containing the specified result. Non-static method.

The resulting array can have the following symbol designations for access permissions:

  • VIEW - access permission to view the result;
  • EDIT - access permission to edit the result;
  • DELETE - access permission to delete the result.

Note
generally, access permissions to the result are also the access permissions to the status containing this result.

Method parameters

Parameter Description
result_id ID of the result.
current_status_id Reference to the variable that saves the status ID for the specified result_id.

See Also

Examples of use

<?
$RESULT_ID = 189; // result ID

// get array of access permissions 
$arPerm = CFormResult::GetPermissions($RESULT_ID, $current_status_id);

echo "The #".$RESULT_ID." has the status ".$current_status_id;

if (in_array("VIEW", $arPerm)) 
    echo "You have access permission to view the result #".$RESULT_ID;

if (in_array("EDIT", $arPerm)) 
    echo "You have access permission to edit the result #".$RESULT_ID;

if (in_array("DELETE", $arPerm)) 
    echo "You have access permission to delete the result #".$RESULT_ID;
?>


© «Bitrix24», 2001-2024
Up