Posted on: 2010/10/27 13:49
Re: Get userid from user's name (nickname)
Thanks so much everyone.
I suspected that I'd have to bring in the list of users and check each one for the appropriate account (or just do a direct query myself), but I was hoping that there was a neat little method somewhere already in the api that I was just overlooking.
Although I'm curious - how did you end up knowing the nickname without knowing the 'uid' ?
Well, it's a long story, but maybe someone will find it interesting?? Anyway, this server also hosts lots of SVN Repositories (close to a thousand and growing). We have a neat little web-top going that allows folks to browse through the repositories and check-out, or simply download, whatever they'd like to work on.
We've been adding new features to this. For instance, Illustrators can now use SVN meta-data to mark a directory for automated uploading into our CMS database (not Xoops, something else) whenever they check-in changes via SVN. We also automatically generate thumbnails of graphics and show them while browsing around the web-top interface.
The final thing we were gonna do was add a sort of search. We don't need a complete indexing of all the content in SVN, since most of the 'stuff' that we'd want to search for is already hosted in that other CMS that I mentioned. But it would be nice if you were an Illustrator and could search/find the location of "really-cool-graphic.eps" across all our repositories.
So, I thought that it might be nice to perform an indexing operation after every repository commit action that would gather and store the path, author, revision #, revision date, and log information for each repository item. This information is getting stored directly into xoops tables for a module that I'm also writing. This module is very simple in that it really only implements the search feature of modules. There is no admin interface, main menu presence, or even general-purpose module pages for a user to view. They will, however, be able to search across filenames and log data. The search results will take them to the associated pages in our web-top. And, finally, the stylesheets for all this stuff is set up so that users of our site can't really tell that they're bouncing around amongst various websites on the same server. It'll all looks like they're in Xoops the whole time.
Now, to answer your question. SVN stores what we call the shortnames of folks who commit changes to the repositories. We've hooked Xoops to LDAP for authentication, so these very same shortnames are the Xoops nicknames on their accounts. So, during this search action, I need to go from nickname to userid so that I can pass that back. The Xoops search engine will then convert that into a clickable author link on the search results page. It's a small detail, but one I'd like to go ahead and implement.
Thanks again everyone for your help on this. Greatly appreciated!!!
Oh, and now that I'm thinking about it, I'll probably want to do this action during the indexing operation itself by just directly looking up the information with a MySQL query. That way, the work will be done during the batch indexing operation that nobody is waiting for rather than the search results algorithm that someone *is* waiting for.