Retrieving roles with web services

jkreuzig's Avatar

jkreuzig

07 Jan, 2016 09:14 PM

I'm running into the same problem that others have found with users and groups: There is an upper limit to the number of roles (250) that one can retrieve with the search. I have 287 groups, and I can only retrieve 250 using the search in web services.

I don't have any spaces in any roles, so the known issue doesn't affect me, but I imagine that it's the same with roles as well as users and groups.

Here's what I've tried:

  1. Rebuild the search index.
  2. Try and retrieve all 287 roles via a web services search. Only 250 are returned.
  3. The 37 roles that cannot be read are always the same 37 roles. They are scattered throughout the last 145 roles.

If I try and read any role directly, it works. The problem here is that I want to dynamically generate a list of role id's and then get the role information. If I try and use the web services search to generate a list of role id's, I run into the 250 role limit. If I try a web services search for one of the 37 roles that it doesn't return, it fails. So not only does it have a 250 return limit, the search index seems to exclude anything other than the 250 that it does return.

I also can't seem to edit a role without it doing something to the web services search. Another test:

  1. Rebuild the search index.
  2. Perform a web services search for the entire list of roles. Only 250 will be returned.
  3. Choose any role id of those that returned properly.
  4. Perform a web services search for that specific role id. It will be returned.
  5. In the Cascade interface, edit that role. Submit your edit with or without actual changes.
  6. Once again, perform a web services search for that specific role id. It will throw an error that in effect says the role doesn't exist. If you access the role asset directly, it will return properly.
  7. Perform a web services search for the entire list of roles. Only 249 will be returned.
  8. Rebuild the search index.
  9. The role that "disappeared" after edit will now show up in a web services search.

I've been using Wing's PHP library, as well as some code I've written myself to test. I have yet to find a bug in Wing's code. His implementation of search seems to be really clean, because it works properly for everything else, so I'm sure it's not his codebase.

Like I said before, I want to dynamically generate a list of role id's via web services but this seems to be a blocker for me. Anybody have any ideas?

Jim

  1. 1 Posted by Ryan Griffith on 08 Jan, 2016 03:08 PM

    Ryan Griffith's Avatar

    Hi Jim,

    Thank you for reporting this behavior, and my apologies for the inconvenience it may be causing.

    I ran a simple test in my local instance and was able to reproduce the behavior you outlined at the end of your comment. That is:

    • perform a wildcard search for users, got the 250
    • manually updated the last user
    • re-ran the search and confirmed the user was no longer in the results
    • ran a search for the specific username and confirmed a result was listed
    • rebuilt the search indexes
    • confirmed the user was listed again

    My guess is the update is invalidating the index item since there was "a change." Let me run this by a developer to see if I can gather some additional information on this behavior and whether there are any ideas for a workaround to the limit

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by jkreuzig on 12 Jan, 2016 09:06 PM

    jkreuzig's Avatar

    I'm curious why the limit on the number of search results is so small. I do understand it could possibly affect the server performance. I've been over 250 users, 250 groups and 250 roles for quite some time now.

    Is there something special about how roles, groups, and users are indexed and searched?

    Jim

  3. 3 Posted by Ryan Griffith on 12 Jan, 2016 09:54 PM

    Ryan Griffith's Avatar

    Hi Jim,

    My apologies for not responding sooner.

    As you indicated, the limit is put in place for performance reasons and there is currently no way around that.

    After speaking with the developers, the reason your role is not listed after editing is because after the asset is updated it is placed at the end of the index. Only when the index is rebuilt it will be placed into the previous order, since I'm pretty sure that's alphabetical because user and group IDs are currently their name.

    Perform a web services search for the entire list of roles. Only 249 will be returned.

    This behavior you listed is interesting. During my testing, I was still seeing 250 results, only the asset I was looking for was replaced by the one preceding it in the index.

    When you have a moment, please attach your web services script so I can get some more context as to what it is doing.

    Please let me know if you have any questions.

    Thanks!

  4. Ryan Griffith closed this discussion on 05 Feb, 2016 04:09 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac