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. 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']; diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index c4c26f7..016dd3d 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.4 * * @license LGPL * @license http://opensource.org/licenses/LGPL-3.0 Lesser GNU Public License @@ -1463,12 +1463,17 @@ 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'); } + if($this->is_admin($user_id)) + { + 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); $query = $this->aauth_db->get( $this->config_vars['perm_to_user'] );