Skip to content

Commit

Permalink
magemojo#120 add acl for access to MageMojo views in admin
Browse files Browse the repository at this point in the history
improve error reporting on reports view if error message is json formatted
  • Loading branch information
Jessica King committed Sep 8, 2023
1 parent 7da592c commit 64bb80b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Block/Adminhtml/Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,14 @@ public function getLocalTimezone()
return $this->resourceconfig->getConfigValue('general/locale/timezone', 'default', 0);
}

/* If the logged message is in JSON Format, parse the message only */
public function getErrorMessage($error){
$errorMessage = $error["messages"];
$errorJson = json_decode($errorMessage);
if (!is_null($errorJson) && isset($errorJson->message)){
return $errorJson->message;
} else {
return $errorMessage;
}
}
}
14 changes: 14 additions & 0 deletions etc/acl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="MageMojo_Cron::heading" title="MageMojo Cron" translate="title" sortOrder="79">
<resource id="MageMojo_Cron::settings" title="Cron Configuration" translate="title" sortOrder="1"/>
<resource id="MageMojo_Cron::reports" title="Cron Execution Report" translate="title" sortOrder="1"/>
</resource>
</resource>
</resources>
</acl>
</config>

0 comments on commit 64bb80b

Please sign in to comment.