diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 881188df..94e12908 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,6 +7,7 @@ - Updated dependencies - Updated Composer to 2.8.2 - Remove email addresses from api output #109 +- Added possibility to view errors only from the log #81 ### Bug fix - Fix: Course start dates are shown earlier in different timezone #113 diff --git a/src/Controller/LogentriesController.php b/src/Controller/LogentriesController.php index 0aacaa9e..2e9769dd 100644 --- a/src/Controller/LogentriesController.php +++ b/src/Controller/LogentriesController.php @@ -32,5 +32,32 @@ public function index() $query = $this->Logentries->find('all', ['order' => ['Logentries.id' => 'DESC']])->contain(['LogentryCodes', 'Users']); $this->set('logentries', $this->paginate($query)); $this->set(compact('user')); // required for contributors menu + $this->render('show-entries'); + } + + public function errors() + { + $user = $this->Authentication->getIdentity(); + if (!$user->is_admin) { + $this->Flash->error(__('Not authorized to logentries errors')); + return $this->redirect(['controller' => 'Dashboard', 'action' => 'index']); + } + // Set breadcrums + $breadcrumTitles[0] = 'Category Lists'; + $breadcrumControllers[0] = 'Dashboard'; + $breadcrumActions[0] = 'categoryLists'; + $breadcrumTitles[1] = 'Log Entries'; + $breadcrumControllers[1] = 'Logentries'; + $breadcrumActions[1] = 'index'; + $breadcrumTitles[2] = 'Errors'; + $breadcrumControllers[2] = 'Logentries'; + $breadcrumActions[2] = 'errors'; + $this->set((compact('breadcrumTitles', 'breadcrumControllers', 'breadcrumActions'))); + $query = $this->Logentries->find('all', ['order' => ['Logentries.id' => 'DESC']]) + ->where(['logentry_code_id >=' => '50']) + ->contain(['LogentryCodes', 'Users']); + $this->set('logentries', $this->paginate($query)); + $this->set(compact('user')); // required for contributors menu + $this->render('show-entries'); } } diff --git a/templates/Logentries/index.php b/templates/Logentries/show_entries.php similarity index 86% rename from templates/Logentries/index.php rename to templates/Logentries/show_entries.php index 35ccae34..f294861b 100644 --- a/templates/Logentries/index.php +++ b/templates/Logentries/show_entries.php @@ -13,6 +13,18 @@
+