From a11eee24137783874bee4234c18fddce5fdcd617 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Thu, 19 May 2022 14:56:09 +0200 Subject: [PATCH 1/2] fix : PHP 8.0.x Deprecated: Required parameter $secret follows optional parameter $user_id in /application/libraries/Aauth.php on line 2660 PHP 8.0: Deprecate required parameters after optional parameters in function/method signatures --- application/libraries/Aauth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index faae290c..23892ffb 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -2661,7 +2661,7 @@ public function generate_recaptcha_field(){ return $content; } - public function update_user_totp_secret($user_id = false, $secret) { + public function update_user_totp_secret($user_id, $secret) { if ($user_id == false) $user_id = $this->CI->session->userdata('id'); From fd89cad210900d38f05b60723ef01720332bac43 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Wed, 25 May 2022 12:27:26 +0200 Subject: [PATCH 2/2] add pipe | for check multiple groupe same time is_member('Admin|User'); is_member('Admin|User', 1); --- application/libraries/Aauth.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 23892ffb..f86e033c 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -1507,11 +1507,11 @@ public function remove_member_from_all($user_id) { $this->aauth_db->where('user_id', $user_id); return $this->aauth_db->delete($this->config_vars['user_to_group']); } - //tested + /** * Is member * Check if current user is a member of a group - * @param int|string $group_par Group id or name to check + * @param int|string $group_par Group id or name to check, use pipe | for check multiple groups same time * @param int|bool $user_id User id, if not given current user * @return bool */ @@ -1522,10 +1522,19 @@ public function is_member( $group_par, $user_id = false ) { $user_id = $this->CI->session->userdata('id'); } - $group_id = $this->get_group_id($group_par); + $this->aauth_db->where('user_id', $user_id); - $query = $this->aauth_db->where('user_id', $user_id); - $query = $this->aauth_db->where('group_id', $group_id); + $groups_par = explode('|', $group_par); + if(count($groups_par) > 1){ + foreach ($groups_par as $key => $group_par) { + $group_id = $this->get_group_id($group_par); + $this->aauth_db->or_where('group_id', $group_id); + } + } else { + $group_id = $this->get_group_id($group_par); + $this->aauth_db->where('group_id', $group_id); + } + $query = $this->aauth_db->get($this->config_vars['user_to_group']); $row = $query->row();