mirror of
https://github.com/slawkens/myaac.git
synced 2025-12-27 02:37:12 +01:00
[WIP] Add access option to Menus (#340)
* [WIP] Add access option to Menus Thanks @joelslamospersson for idea * Add notice about Guest* * Add access column into schema.sql * Remove spectrum.js from project Was used in Menus, replaced by html "color" input * Block access to page if not required Access by Menus
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
|
||||
use MyAAC\Models\Menu;
|
||||
use MyAAC\Models\Pages;
|
||||
use MyAAC\Plugins;
|
||||
|
||||
@@ -331,7 +332,20 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$tmpPageOriginal = $page;
|
||||
$pagesWithDynamicPart = ['characters', 'forum', 'highscores', 'monsters'];
|
||||
foreach ($pagesWithDynamicPart as $_page) {
|
||||
if (str_contains($page, $_page)) {
|
||||
$tmpPageOriginal = $_page;
|
||||
}
|
||||
}
|
||||
|
||||
$themeMenu = Menu::select(['name'])
|
||||
->where('template', $template_name)
|
||||
->where('link', $tmpPageOriginal)
|
||||
->where('access', '>', $logged_access);
|
||||
|
||||
if (!$found || $themeMenu->count() >= 1) {
|
||||
$page = '404';
|
||||
$file = SYSTEM . 'pages/404.php';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user