/** * Gets context this strategy is working in * * @throws \RuntimeException * @return PermissionGrantingStrategyContextInterface */ protected function getContext() { if ($this->contextLink === null) { throw new \RuntimeException('The context link is not set.'); } return $this->contextLink->getService(); }
public function preUpdate(PreUpdateEventArgs $eventArgs) { if ($eventArgs->getEntity() instanceof Role && $eventArgs->hasChangedField('role')) { $oldRoleName = $eventArgs->getOldValue('role'); $newRoleName = $eventArgs->getNewValue('role'); /** @var $aclSidManager AclSidManager */ $aclSidManager = $this->aclSidManagerLink->getService(); $aclSidManager->updateSid($aclSidManager->getSid($newRoleName), $oldRoleName); } }