Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
A number of small questions that should be easy to answer...
-Users on my site can change their username. How can I have Vanilla automatically recognize that a user has changed their user or email based on the proxy, so that the forums don't have their user and email out of date?
-Can I remove users' ability to change their email and password? Changing these in vanilla would be pointless because they need to change in the actual website database to be effective.
Thanks!
-Can I remove users' ability to change their email and password? Changing these in vanilla would be pointless because they need to change in the actual website database to be effective.
Thanks!
Tagged:
0
Comments
However - it is in between logging in that I suspect you are interested in. If a user changes their email address in the proxy, but does *not* visit the Vanilla forum, then Vanilla will not know about this change and so email alerts will keep being sent to the old address.
The only solution, so far as I can see, is to update the usernames and email addresses manually. I have done something similar to create users - the proxy regularly compares the users on the proxy CMS and Vanilla. If a user does not yet exist on Vanilla, then they will be created immediately. I only need to create a user record with a name and email address, link that user to a role, and also link the user to the proxy authenticator based on the proxy unique ID. Everything else is left at default values. When the user logs in for the first time, then the record gets tidied up and completed by Vanilla.
I needed to do that because I needed people to be able to start conversations with people who have not yet used the forum or logged in (it's a closed group).
One thing that was frustrating, is that there seems not to be a set of APIs for creating and updating users. Creation of a user is spread over a number of controllers and is not all in one place, hence my completely custom solution.
My next step will be updating the users when they get out of sync, and that should also be a relatively simple SQL update.
The approach I have taken - and this works only because the proxy CMS and Vanilla are on the same database - is to create views to list any users that are out of sync. The update scripts then are driven by those views.
Let me know if you are interested in the code for this. It's not a simple module for installing, so will need some programming to implement.
Because the public name was not necessarily unique, and yet needed to be unique when being sent to Vanilla, I select the public name in the CMS through a custom filter. The filter basically checks whether the name has been used by another user, and then adds a numeric suffix (1, 2, 4 etc) if it has, to make it different. The names are then cached so that the same username can be passed each time. If the user changes their name on the CMS, then the same process is again used to ensure that the new name is unique, caching that and marking the old username as "used".
Add Pages to Vanilla with the Basic Pages app
Next I insert a couple of roles based on the primary key generated from the first insert and the Vanilla role IDs derived from the CMS: The last thing to do is to link that new user to the CMS user: The ForeigKey is the ID of the user on the CMS. The UserID is the primary key of the user inserted above. The ProviderKey is the md5 key selected from the AuthenticationProviders table for the "proxy" provider.
Creating the above data in the Vanilla database gives enough of a user account to see the user, add attributes and photos, and start conversations with them, When the user logs in via ProxyConnect, they will be in instantly with no further effort, and all the NULL columns on the User table get populated with the stuff that Vanilla needs.
-- Jason
The PHP code I use is very specific to the framework I use, so I have not posted that here, and you will need to work out how to execute those queries.
It probably would be nice to turn this into a "synchronise" Vanilla plugin. The plugin would handle all the user creation and updating queries, and just needs to get its feed from somewhere - perhaps a web service on the CMS to return all users that need migrating (and locked to localhost so it cannot be accessed publicly).