Skip to content

Commit d6b9833

Browse files
authored
added list_group_perms($group_par)
Thanks @oniricosistemas for the nice function
1 parent 817f184 commit d6b9833

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

application/libraries/Aauth.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,31 @@ public function delete_perm($perm_par) {
15831583
return $this->aauth_db->delete($this->config_vars['perms']);
15841584
}
15851585

1586+
/**
1587+
* List Group Permissions
1588+
* List all permissions by Group
1589+
* @param int $group_par Group id or name to check
1590+
* @return object Array of permissions
1591+
*/
1592+
public function list_group_perms($group_par) {
1593+
if(empty($group_par)){
1594+
return false;
1595+
}
1596+
1597+
$group_par = $this->get_group_id($group_par);
1598+
1599+
$this->aauth_db->select('*');
1600+
$this->aauth_db->from($this->config_vars['perms']);
1601+
$this->aauth_db->join($this->config_vars['perm_to_group'], "perm_id = ".$this->config_vars['perms'].".id");
1602+
$this->aauth_db->where($this->config_vars['perm_to_group'].'.group_id', $group_par);
1603+
1604+
$query = $this->aauth_db->get();
1605+
if ($query->num_rows() == 0)
1606+
return FALSE;
1607+
1608+
return $query->result();
1609+
}
1610+
15861611
/**
15871612
* Is user allowed
15881613
* Check if user allowed to do specified action, admin always allowed

0 commit comments

Comments
 (0)