アクセス許可管理
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user