diff --git a/Admin/Installer.php b/Admin/Installer.php index e893b46..3559343 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -52,6 +52,7 @@ class Installer extends InstallerAbstract `nav_from` varchar(255) DEFAULT NULL, `nav_order` smallint(3) DEFAULT NULL, `nav_parent` int(11) DEFAULT NULL, + `nav_permission_permission` int(11) DEFAULT NULL, `nav_permission_type` int(11) DEFAULT NULL, `nav_permission_element` int(11) DEFAULT NULL, PRIMARY KEY (`nav_id`) @@ -97,8 +98,8 @@ class Installer extends InstallerAbstract private static function installLink($dbPool, $data) : void { $sth = $dbPool->get()->con->prepare( - 'INSERT INTO `' . $dbPool->get()->prefix . 'nav` (`nav_id`, `nav_pid`, `nav_name`, `nav_type`, `nav_subtype`, `nav_icon`, `nav_uri`, `nav_target`, `nav_from`, `nav_order`, `nav_parent`, `nav_permission_type`, `nav_permission_element`) VALUES - (:id, :pid, :name, :type, :subtype, :icon, :uri, :target, :from, :order, :parent, :perm_type, :perm_element);' + 'INSERT INTO `' . $dbPool->get()->prefix . 'nav` (`nav_id`, `nav_pid`, `nav_name`, `nav_type`, `nav_subtype`, `nav_icon`, `nav_uri`, `nav_target`, `nav_from`, `nav_order`, `nav_parent`, `nav_permission_permission`, `nav_permission_type`, `nav_permission_element`) VALUES + (:id, :pid, :name, :type, :subtype, :icon, :uri, :target, :from, :order, :parent, :perm_perm, :perm_type, :perm_element);' ); $sth->bindValue(':id', $data['id'] ?? 0, \PDO::PARAM_INT); @@ -112,6 +113,7 @@ class Installer extends InstallerAbstract $sth->bindValue(':from', $data['from'] ?? 0, \PDO::PARAM_STR); $sth->bindValue(':order', $data['order'] ?? 1, \PDO::PARAM_INT); $sth->bindValue(':parent', $data['parent'], \PDO::PARAM_INT); + $sth->bindValue(':perm_perm', $data['permission']['permission'] ?? null, \PDO::PARAM_INT); $sth->bindValue(':perm_type', $data['permission']['type'] ?? null, \PDO::PARAM_INT); $sth->bindValue(':perm_element', $data['permission']['element'] ?? null, \PDO::PARAM_INT); @@ -121,7 +123,7 @@ class Installer extends InstallerAbstract foreach ($data['children'] as $link) { $parent = ($link['parent'] == null ? $lastInsertID : $link['parent']); - self::installLink($dbPool, $link, $parent); + self::installLink($dbPool, $link); } } } diff --git a/Models/Navigation.php b/Models/Navigation.php index 31f694d..520308c 100644 --- a/Models/Navigation.php +++ b/Models/Navigation.php @@ -105,7 +105,7 @@ class Navigation foreach ($tempNav as $id => $link) { $isReadable = $account->hasPermission( - PermissionType::READ, + (int) $link[0]['nav_permission_permission'], $unit, $app, (string) $link[0]['nav_from'], @@ -170,7 +170,7 @@ class Navigation public static function getInstance(RequestAbstract $hashes = null, Account $account, DatabasePool $dbPool, int $unit, string $appName) { if (!isset(self::$instance)) { - if (!isset($hashes) || !isset($dbPool)) { + if (!isset($hashes)) { throw new \Exception('Invalid parameters'); } diff --git a/Theme/Backend/side.tpl.php b/Theme/Backend/side.tpl.php index 997c9d5..9a554e0 100644 --- a/Theme/Backend/side.tpl.php +++ b/Theme/Backend/side.tpl.php @@ -24,12 +24,13 @@ if (isset($this->nav[\Modules\Navigation\Models\NavigationType::SIDE])) : ?> getHtml($parent['nav_name']) ?> - nav[\Modules\Navigation\Models\NavigationType::SIDE][\Modules\Navigation\Models\LinkType::LINK] as $key2 => $link) : + nav[\Modules\Navigation\Models\NavigationType::SIDE][\Modules\Navigation\Models\LinkType::LINK])) : + foreach ($this->nav[\Modules\Navigation\Models\NavigationType::SIDE][\Modules\Navigation\Models\LinkType::LINK] as $key2 => $link) : if ($link['nav_parent'] === $key) : ?>
  • getHtml($link['nav_name']) ?> + endforeach; endif; ?>