We need tests for user autocomplete. Create some users, make sure they show up in autocomplete results.

CommentFileSizeAuthor
#1 user_autocomplete.patch1.04 KBjoachim

Comments

joachim’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

Hello from the testing pancake session!

Here's a patch with a test.
But it fails.
We think this is because of a bug in Drupal core, as testing this manually with a user with 'administer nodes' permission gives us a 403 on the autocomplete field.
We're on 7.x-dev so could someone give this a try on CVS HEAD, and if it's still not working file a bug on core?

Here's the patch with the test.

damien tournoud’s picture

Status: Needs review » Needs work

You will need the 'access user profiles' permission to use the user autocomplete.

dries’s picture

Status: Needs work » Needs review

It seems like you need to have the 'access user profiles' permission:

  $items['user/autocomplete'] = array(
    'title' => 'User autocomplete',
    'page callback' => 'user_autocomplete',
    'access callback' => 'user_access',
    'access arguments' => array('access user profiles'),
    'type' => MENU_CALLBACK,
  );
catch’s picture

catch’s picture

Title: TestingParty08: User autocomplete » User autocomplete gives 403 errors with certain combinations of permissions
Component: tests » node.module
Status: Needs review » Needs work

Actually that's a different but somewhat related issue however the appoach taken there - to disable autocomplete if the permission isn't available, seems like a sane approach, better than a 403 when you're typing at least. I'm hijacking this for the core bug so we can put test and fix in together. I can think of certain situations where these permissions wouldn't be given together, so makes sense to account for it.

dave reid’s picture

Title: User autocomplete gives 403 errors with certain combinations of permissions » CUser autocomplete gives 403 errors with certain combinations of permissions

I posted a patch and a test to fix the bigger problem in #284887: Check for access to autocomplete paths during form building

dave reid’s picture

Title: CUser autocomplete gives 403 errors with certain combinations of permissions » User autocomplete gives 403 errors with certain combinations of permissions

Arg...did not mean to change title at all...

dave reid’s picture

Status: Needs work » Closed (duplicate)

Test for user autocomplete is in the patch with #284887: Check for access to autocomplete paths during form building. Marking this as a duplicate.