From 66bdcf04f431d615b5fac93e7677e7304888e90c Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 18 Jan 2025 20:02:39 +0000 Subject: implement settings editor page --- Digitigrade/Model/UserAccount.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Digitigrade/Model') diff --git a/Digitigrade/Model/UserAccount.php b/Digitigrade/Model/UserAccount.php index d0fa94b..37e0c7e 100644 --- a/Digitigrade/Model/UserAccount.php +++ b/Digitigrade/Model/UserAccount.php @@ -1,6 +1,7 @@ passwordHash); } + + /** + * Throws if this user isn't an admin. + * @return self this user (so you can use it in chains) + */ + public function requireAdmin(): self { + if (!$this->isAdmin) { + throw new Forbidden(); + } + return $this; + } } \ No newline at end of file -- cgit v1.3