Thanks LPH, but unfortunately that doesn't really fit what I'm trying to accomplish. I was really hoping for there to be something like "hasPermission", but instead of it being for a single user, it would return all users that have the permission.
I ended up with the following to return a list of users that have a specific permission set. I'm not really sure if this is the best approach but I've pasted it below incase anyone is looking to achieve the same thing.
Permission
Code
Code:
public function getUsersWithPermission($permission_group_id, $permission_id, $permission_value)
{
$users = $this->db()->fetchAll("
SELECT
xf_user.user_id, xf_user.username, xf_permission_combination.cache_value
FROM
xf_user
INNER JOIN
xf_permission_combination ON xf_user.permission_combination_id = xf_permission_combination.permission_combination_id;
");
foreach ($users AS $id => $user)
{
$cache_value = unserialize($user['cache_value']);
if (isset($cache_value[$permission_group_id][$permission_id]))
{
if ($cache_value[$permission_group_id][$permission_id] != $permission_value)
{
unset($users[$id]);
}
}
}
return $users;
}