From 1c5e9aad63a1ce5fe93afb92eb28452a4e162b9e Mon Sep 17 00:00:00 2001 From: REJack Date: Mon, 26 Oct 2015 15:41:33 +0100 Subject: [PATCH 1/6] fix for #81 Invalid new config file --- application/config/aauth.php | 68 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/application/config/aauth.php b/application/config/aauth.php index 66c94dc..053324c 100644 --- a/application/config/aauth.php +++ b/application/config/aauth.php @@ -68,54 +68,54 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $config_aauth = array(); $config_aauth["default"] = array( - ['no_permission'] = FALSE, + 'no_permission' => FALSE, - ['admin_group'] = 'admin', - ['default_group'] = 'default', - ['public_group'] = 'public', + 'admin_group' => 'admin', + 'default_group' => 'default', + 'public_group' => 'public', - ['db_profile'] = 'default', + 'db_profile' => 'default', - ['users'] = 'aauth_users', - ['groups'] = 'aauth_groups', - ['user_to_group'] = 'aauth_user_to_group', - ['perms'] = 'aauth_perms', - ['perm_to_group'] = 'aauth_perm_to_group', - ['perm_to_user'] = 'aauth_perm_to_user', - ['pms'] = 'aauth_pms', - ['system_variables'] = 'aauth_system_variables', - ['user_variables'] = 'aauth_user_variables', + 'users' => 'aauth_users', + 'groups' => 'aauth_groups', + 'user_to_group' => 'aauth_user_to_group', + 'perms' => 'aauth_perms', + 'perm_to_group' => 'aauth_perm_to_group', + 'perm_to_user' => 'aauth_perm_to_user', + 'pms' => 'aauth_pms', + 'system_variables' => 'aauth_system_variables', + 'user_variables' => 'aauth_user_variables', - ['remember'] = ' +3 days', + 'remember' => ' +3 days', - ['max'] = 13, - ['min'] = 5, + 'max' => 13, + 'min' => 5, - ['valid_chars'] = array(), + 'valid_chars' => array(), - ['ddos_protection'] = true, + 'ddos_protection' => true, - ['recaptcha_active'] = false, - ['recaptcha_login_attempts'] = 4, - ['recaptcha_siteKey'] = '', - ['recaptcha_secret'] = '', + 'recaptcha_active' => false, + 'recaptcha_login_attempts' => 4, + 'recaptcha_siteKey' => '', + 'recaptcha_secret' => '', - ['totp_active'] = false, - ['totp_only_on_ip_change'] = false, - ['totp_reset_over_reset_password'] = false, + 'totp_active' => false, + 'totp_only_on_ip_change' => false, + 'totp_reset_over_reset_password' => false, - ['max_login_attempt'] = 10, + 'max_login_attempt' => 10, - ['login_with_name'] = false, + 'login_with_name' => false, - ['use_cookies'] = true, + 'use_cookies' => true, - ['email'] = 'admin@admin.com', - ['name'] = 'Emre Akay', + 'email' => 'admin@admin.com', + 'name' => 'Emre Akay', - ['verification'] = false, - ['verification_link'] = '/account/verification/', - ['reset_password_link'] = '/account/reset_password/' + 'verification' => false, + 'verification_link' => '/account/verification/', + 'reset_password_link' => '/account/reset_password/' ); $config['aauth'] = $config_aauth['default']; From 0f31aa7ea7095b56964e90ab03c08b14cf5105d2 Mon Sep 17 00:00:00 2001 From: Emre Akay Date: Tue, 27 Oct 2015 08:15:35 +0200 Subject: [PATCH 2/6] Update Aauth.php --- 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 c4c26f7..39c7be2 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -13,7 +13,7 @@ * * @copyright 2014-2015 Emre Akay * - * @version 2.4.2 + * @version 2.4.3 * * @license LGPL * @license http://opensource.org/licenses/LGPL-3.0 Lesser GNU Public License From c999d7c8da0a612af41d44a6d73c487d2b220d07 Mon Sep 17 00:00:00 2001 From: Emre Akay Date: Tue, 27 Oct 2015 09:10:38 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e15c64a..44ce482 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +![CodeIgniter-Aauth-Logo](https://cloud.githubusercontent.com/assets/2417212/8925689/add409ea-34be-11e5-8e50-845da8f5b1b0.png) + + *** Aauth is a User Authorization Library for CodeIgniter 2.x and 3.x, which aims to make easy some essential jobs such as login, permissions and access operations. Despite its ease of use, it has also very advanced features like private messages, groupping, access management, and public access. From f51e1b4ff2dd761f631f322fe80c7682c36d8b89 Mon Sep 17 00:00:00 2001 From: REJack Date: Tue, 27 Oct 2015 11:40:30 +0100 Subject: [PATCH 4/6] 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 5/6] 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); From 6f70228f7117411c785046b0a13f0c4c0316a3a9 Mon Sep 17 00:00:00 2001 From: Emre Akay Date: Tue, 27 Oct 2015 15:46:11 +0200 Subject: [PATCH 6/6] Update Aauth.php --- 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 972afd7..016dd3d 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -13,7 +13,7 @@ * * @copyright 2014-2015 Emre Akay * - * @version 2.4.3 + * @version 2.4.4 * * @license LGPL * @license http://opensource.org/licenses/LGPL-3.0 Lesser GNU Public License