From e9e15035d65796aa722a6a98d1201bef6497c6a8 Mon Sep 17 00:00:00 2001 From: REJack Date: Tue, 20 Sep 2016 18:52:22 +0200 Subject: [PATCH] is_allowed improvement (#166) --- application/libraries/Aauth.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index b8e3df02..5291e81f 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -1612,17 +1612,14 @@ public function is_allowed($perm_par, $user_id=FALSE){ if( $query->num_rows() > 0){ return TRUE; } else { - if( $user_id===FALSE){ - return $this->is_group_allowed($perm_id); - } else { - $g_allowed=FALSE; - foreach( $this->get_user_groups($user_id) as $group ){ - if ( $this->is_group_allowed($perm_id, $group->id) ){ - $g_allowed=TRUE; - } + $g_allowed=FALSE; + foreach( $this->get_user_groups($user_id) as $group ){ + if ( $this->is_group_allowed($perm_id, $group->id) ){ + $g_allowed=TRUE; + break; } - return $g_allowed; } + return $g_allowed; } }