Commit 086f2ea0 authored by webchick's avatar webchick

#870196 by tobiasb, mitchmac, ericduran: Fixed Notice: Undefined variable:...

#870196 by tobiasb, mitchmac, ericduran: Fixed Notice: Undefined variable: user_role_alias() in user_build_filter_query().
parent d30b2bad
......@@ -3209,13 +3209,13 @@ function user_build_filter_query(SelectQuery $query) {
if (user_access($value, $account)) {
continue;
}
$user_role_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
$permission_alias = $query->join('role_permission', 'p', $user_role_alias . '.rid = %alias.rid');
$users_roles_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
$permission_alias = $query->join('role_permission', 'p', $users_roles_alias . '.rid = %alias.rid');
$query->condition($permission_alias . '.permission', $value);
}
elseif ($key == 'role') {
$user_roles_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
$query->condition($user_role_alias . '.rid' , $value);
$users_roles_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
$query->condition($users_roles_alias . '.rid' , $value);
}
else {
$query->condition($filters[$key]['field'], $value);
......
......@@ -1062,19 +1062,28 @@ class UserAdminTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/people', $edit, t('Filter'));
// Check if the correct users show up.
$this->assertNoText($user_a->name, t('User A not on filtered by perm admin users page'));
$this->assertNoText($user_a->name, t('User A not on filtered by perm admin users page'));
$this->assertText($user_b->name, t('Found user B on filtered by perm admin users page'));
$this->assertText($user_c->name, t('Found user C on filtered by perm admin users page'));
// Filter the users by role. Grab the system-generated role name for User C.
$edit['role'] = max(array_flip($user_c->roles));
$this->drupalPost('admin/people', $edit, t('Refine'));
// Check if the correct users show up when filtered by role.
$this->assertNoText($user_a->name, t('User A not on filtered by role on admin users page'));
$this->assertNoText($user_b->name, t('User B not on filtered by role on admin users page'));
$this->assertText($user_c->name, t('User C on filtered by role on admin users page'));
// Test blocking of a user.
$account = user_load($user_b->uid);
$this->assertEqual($account->status, 1, 'User B not blocked');
$account = user_load($user_c->uid);
$this->assertEqual($account->status, 1, 'User C not blocked');
$edit = array();
$edit['operation'] = 'block';
$edit['accounts[' . $account->uid . ']'] = TRUE;
$this->drupalPost('admin/people', $edit, t('Update'));
$account = user_load($user_b->uid, TRUE);
$this->assertEqual($account->status, 0, 'User B blocked');
$account = user_load($user_c->uid, TRUE);
$this->assertEqual($account->status, 0, 'User C blocked');
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment