From f51e1b4ff2dd761f631f322fe80c7682c36d8b89 Mon Sep 17 00:00:00 2001 From: REJack Date: Tue, 27 Oct 2015 11:40:30 +0100 Subject: [PATCH 1/2] Enchantment on is_allowed() function #83 --- application/libraries/Aauth.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 39c7be2..3663b67 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -1469,6 +1469,11 @@ class Aauth { $user_id = $this->CI->session->userdata('id'); } + if($this->is_admin($user_id)) + { + return true; + } + $query = $this->aauth_db->where('perm_id', $perm_id); $query = $this->aauth_db->where('user_id', $user_id); $query = $this->aauth_db->get( $this->config_vars['perm_to_user'] ); From f42e5468ffc5037ac10c20256509e690064d6c83 Mon Sep 17 00:00:00 2001 From: REJack Date: Tue, 27 Oct 2015 12:14:37 +0100 Subject: [PATCH 2/2] moved $perm_id after the if's conditions for more performance --- application/libraries/Aauth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 3663b67..972afd7 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -1463,8 +1463,6 @@ class Aauth { */ public function is_allowed($perm_par, $user_id=FALSE){ - $perm_id = $this->get_perm_id($perm_par); - if( $user_id == FALSE){ $user_id = $this->CI->session->userdata('id'); } @@ -1473,6 +1471,8 @@ class Aauth { { return true; } + + $perm_id = $this->get_perm_id($perm_par); $query = $this->aauth_db->where('perm_id', $perm_id); $query = $this->aauth_db->where('user_id', $user_id);