logEntryRepository = $logEntryRepository; $this->backendSession = $backendSession; } public function execute() { if ($storeIds = $this->getAvailableStoreIds()) { $this->logEntryRepository->cleanByStoreIds($storeIds); } else { $this->logEntryRepository->clean(); } $this->messageManager->addSuccessMessage(__('Actions Log has been successfully cleared.')); return $this->resultRedirectFactory->create()->setRefererUrl(); } private function getAvailableStoreIds(): array { $userRole = $this->backendSession->getUser()->getRole(); if ($userRole->getData('gws_is_all')) { return []; } if ($userRole->getData('gws_stores')) { return $userRole->getData('gws_stores'); } return []; } }