Browse Source

added list_group_perms($group_par)

Thanks @oniricosistemas for the nice function
2.5-stable
Raphael Jackstadt 8 years ago committed by GitHub
parent
commit
d6b9833c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      application/libraries/Aauth.php

25
application/libraries/Aauth.php

@ -1583,6 +1583,31 @@ class Aauth {
return $this->aauth_db->delete($this->config_vars['perms']);
}
/**
* List Group Permissions
* List all permissions by Group
* @param int $group_par Group id or name to check
* @return object Array of permissions
*/
public function list_group_perms($group_par) {
if(empty($group_par)){
return false;
}
$group_par = $this->get_group_id($group_par);
$this->aauth_db->select('*');
$this->aauth_db->from($this->config_vars['perms']);
$this->aauth_db->join($this->config_vars['perm_to_group'], "perm_id = ".$this->config_vars['perms'].".id");
$this->aauth_db->where($this->config_vars['perm_to_group'].'.group_id', $group_par);
$query = $this->aauth_db->get();
if ($query->num_rows() == 0)
return FALSE;
return $query->result();
}
/**
* Is user allowed
* Check if user allowed to do specified action, admin always allowed

Loading…
Cancel
Save