private function ForumAccessTestCase::testForumAccessGetPermissionsUser in Forum Access 6
This function gets the user permissions for a specific from the database
1 call to ForumAccessTestCase::testForumAccessGetPermissionsUser()
- ForumAccessTestCase::testForumAccessDumpDebugInfo in ./
forum_access.test - This function is called when the program detects an error. It gives extra information so that the error can be fixed. hopefully :)
File
- ./
forum_access.test, line 1348 - Test file for forum_access.module.
Class
- ForumAccessTestCase
- This is the base class for forum access testing.
Code
private function testForumAccessGetPermissionsUser($uid = 0, $if_empty_return_none = FALSE) {
if ($uid > 0) {
$result_authenticated = db_fetch_object(db_query("SELECT perm FROM {permission} WHERE rid = %d", DRUPAL_AUTHENTICATED_RID));
$result_user = db_fetch_object(db_query("SELECT p.perm as perm FROM {users_roles} u JOIN {permission} p ON u.rid = p.rid where u.uid = %d", $uid));
if (!empty($result_authenticated->perm) && !empty($result_user->perm)) {
return array_merge(explode(', ', $result_authenticated->perm), explode(', ', $result_user->perm));
}
elseif (!empty($result_authenticated->perm)) {
return explode(', ', $result_authenticated->perm);
}
elseif (!empty($result_user->perm)) {
return explode(', ', $result_user->perm);
}
elseif ($if_empty_return_none) {
return array(
t('none'),
);
}
}
return array();
}