GetPermission
Description and parameters
string CIBlock::GetPermission( int IBLOCK_ID );
Returns access permissions to IBLOCK_ID for current user (if code is unavailable) or user with FOR_USER_ID. Non-static method.
Note: method deemed as deprecated (doesn't work when using extended access permissions). It's recommended to use CIBlockElementRights::UserHasRightTo and CIBlockSectionRights::UserHasRightTo.
Parameters
Parameter | Description | Available from version |
---|---|---|
IBLOCK_ID | Iblock code. | |
FOR_USER_ID | User ID. Optional parameter. Prior to version 11.5.1 the parameter was named USER_ID. |
Returned value
Access permission symbol: "D" - denied, "R" - read, "U" - edit via workflow, "W" - update, "X" - full access (edit + access permission edit right).
See Also
Examples
<?
$iblock_permission = CIBlock::GetPermission($id);
if($iblock_permission<"X")
return false;
?>
Example for getting level of permissions with extended edit privileges:
$tRight = 'element_edit'; $canEdit = CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ELEMENT_ID, $tRight); if (!$tRight) echo "access denied";
$tRight can have the following values:
section_element_bind - Adding an element to a section (creating an element)element_bizproc_start - Launching a workflow for element
iblock_edit - Editing iblock parameters
iblock_rights_edit - Editing iblock access permissions
section_rights_edit - Editing section access permissions
element_rights_edit - Editing element access permissions
section_edit - Editing section
element_edit - Editing element
element_edit_any_wf_status - Editing an element in any workflow status
iblock_admin_display - Showing iblock in admin section
element_edit_price - Editing element prices
section_section_bind - Creating a subsection
iblock_delete - Deleting an iblock
section_delete - Deleting a section
element_delete - Deleting an element
section_read - Reading a section parameters
element_read - Reading an element
iblock_export - Exporting an iblock.
© «Bitrix24», 2001-2024