ProductRightsChecker extends IblockRightsChecker
Table of Contents
Methods
- __construct() : mixed
- canAddElement() : bool
- canBindElementToSection() : bool
- canBindSectionToSection() : bool
- canDeleteElement() : bool
- canDeleteElements() : bool
- canDeleteSection() : bool
- canEditElement() : bool
- canEditElements() : bool
- canEditPrices() : bool
- canEditSection() : bool
- preloadRights() : void
- Preloading rights for elements and sections (necessary for performance).
Methods
__construct()
public
__construct(int $iblockId[, AccessController|null $controller = null ]) : mixed
Parameters
- $iblockId : int
- $controller : AccessController|null = null
canAddElement()
public
canAddElement(int $elementId) : bool
Parameters
- $elementId : int
Return values
boolcanBindElementToSection()
public
canBindElementToSection(int $sectionId) : bool
Parameters
- $sectionId : int
Return values
boolcanBindSectionToSection()
public
canBindSectionToSection(int $sectionId) : bool
Parameters
- $sectionId : int
Return values
boolcanDeleteElement()
public
canDeleteElement(int $elementId) : bool
Parameters
- $elementId : int
Return values
boolcanDeleteElements()
public
canDeleteElements() : bool
Return values
boolcanDeleteSection()
public
canDeleteSection(int $sectionId) : bool
Parameters
- $sectionId : int
Return values
boolcanEditElement()
public
canEditElement(int $elementId) : bool
Parameters
- $elementId : int
Return values
boolcanEditElements()
public
canEditElements() : bool
Return values
boolcanEditPrices()
public
canEditPrices() : bool
Return values
boolcanEditSection()
public
canEditSection(int $sectionId) : bool
Parameters
- $sectionId : int
Return values
boolpreloadRights()
Preloading rights for elements and sections (necessary for performance).
public
preloadRights(array<string|int, mixed> $elementIds, array<string|int, mixed> $sectionIds) : void
The best way to override the setRawRows
grid method:
public function setRawRows(iterable $rawValue): void
{
parent::setRawRows($rawValue);
// preload rights
if (!empty($rawValue))
{
$elementIds = [];
$sectionIds = [];
foreach ($this->getRawRows() as $row)
{
$id = (int)($row['ID'] ?? 0);
if ($id <= 0)
{
continue;
}
$type = $row['ROW_TYPE'] ?? RowType::ELEMENT;
if ($type === RowType::SECTION)
{
$sectionIds[] = $id;
}
else
{
$elementIds[] = $id;
}
}
// before create getter for rights checker
$this->getIblockRightsChecker()->preloadRights($elementIds, $sectionIds);
}
}
Parameters
- $elementIds : array<string|int, mixed>
- $sectionIds : array<string|int, mixed>