From 2f0e3ab98e0c304f3df3b6e0f686e52beb4d667c Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 26 Jul 2016 14:30:57 +0200 Subject: Array of administrator IDs in constants.php --- classes/constants.php | 3 +++ classes/user.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/constants.php b/classes/constants.php index e5630de..ef34668 100644 --- a/classes/constants.php +++ b/classes/constants.php @@ -69,6 +69,9 @@ class constants { /** @const fa_valuta see http://fontawesome.io/icons/#currency; the fa- postfix for valuta */ const fa_valuta = 'eur'; + /** @const user_admins The user ids that have administrator rights (creating and deleting users) */ + const user_admins = [1]; + /** * @const password_algo Algorithm for the password_hash function. * @const password_cost Cost for the password_hash function. Run install?password_cost to benchmark your system diff --git a/classes/user.php b/classes/user.php index 750e8bb..f6c6322 100644 --- a/classes/user.php +++ b/classes/user.php @@ -156,7 +156,7 @@ class user { * @return bool True iff the user has administrator rights */ public function isAdmin() { - return $this->getId() == 1; + return in_array($this->getId(), constants::user_admins); } /** -- cgit v1.2.3