Browse Source

Fixed an issue with is_allowed

Fixed an issue with is_allowed that would cause it to return true
if the permission name passed in did not exist and the user had access
to permission ID 1. Changed get_perm_id() to return NULL instead of FALSE.
This fixed the above issue.
develop
tswagger 10 years ago
parent
commit
d025313e31
  1. 6
      application/libraries/Aauth.php

6
application/libraries/Aauth.php

@ -1087,7 +1087,7 @@ class Aauth {
if( ! $group_id ) { if( ! $group_id ) {
$this->error( $this->CI->lang->line('group_exist') ); $this->error( $this->CI->lang->line('no_group') );
return false; return false;
} }
@ -1485,7 +1485,7 @@ class Aauth {
* Get permission id * Get permission id
* Get permission id from permisison name or id * Get permission id from permisison name or id
* @param int|string $perm_par Permission id or name to get * @param int|string $perm_par Permission id or name to get
* @return int Permission id * @return int Permission id or NULL if perm does not exist
*/ */
public function get_perm_id($perm_par) { public function get_perm_id($perm_par) {
@ -1495,7 +1495,7 @@ class Aauth {
$query = $this->CI->db->get($this->config_vars['perms']); $query = $this->CI->db->get($this->config_vars['perms']);
if ($query->num_rows() == 0) if ($query->num_rows() == 0)
return false; return NULL;
$row = $query->row(); $row = $query->row();
return $row->id; return $row->id;

Loading…
Cancel
Save