アクセス許可管理

This commit is contained in:
2025-12-29 15:53:34 +09:00
parent decf69e8b4
commit 8c76fe2733
14 changed files with 127 additions and 12 deletions

View File

@@ -77,4 +77,54 @@ class Page {
throw new \Exception($e->getMessage());
}
}
public function memberonly(array $params): void {
try {
$tmpl = new Template('/');
$pagetit = 'サインインしたユーザー限定';
$description = 'PHPフレームワークについて';
// ユーザー
$auth = new Auth();
$user = $auth->getLoggedInUser();
$tmpl->assign('user', $user);
$tmpl->assign('pagetit', $pagetit);
$tmpl->assign('curPage', 'memberonly');
$tmpl->assign('custCss', false);
$tmpl->assign('menu', $this->getMenu());
$tmpl->assign('description', $description);
if ($user && $user->role != -1) $tmpl->render('memberonly');
else $tmpl->render('nopermission');
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
public function staffonly(array $params): void {
try {
$tmpl = new Template('/');
$pagetit = 'スタッフ限定';
$description = 'PHPフレームワークについて';
// ユーザー
$auth = new Auth();
$user = $auth->getLoggedInUser();
$tmpl->assign('user', $user);
$tmpl->assign('pagetit', $pagetit);
$tmpl->assign('curPage', 'staffonly');
$tmpl->assign('custCss', false);
$tmpl->assign('menu', $this->getMenu());
$tmpl->assign('description', $description);
if ($user && $user->role == 1) $tmpl->render('staffonly');
else $tmpl->render('nopermission');
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
}