[Solved] How do I get role synchronisation working with jsConnect?
Hi
I have just setup Vanilla 2.0.18.9 which works brilliantly. I want SSL with our site on the same domain but as I was hoping to give different roles to different types of user, I opted for the jsConnect plugin. In the jsConnect documentation at http://blog.vanillaforums.com/jsconnect-technical-documentation/ it shows that it is possible to configure jsConnect to synchronise roles;
"roles": "member,administrator", // OPTIONAL. You can configure jsconnect to synchronise roles
Everything else is working perfectly - however the roles are not being taken into account. I cannot see anywhere in the jsConnect configuration screen which allows me to turn this feature on.
Has anyone managed to get this working? If so, please let me know how!
Thanks in advance,
Aaron
Answers
search and you will find
http://vanillaforums.org/discussion/24464/user-roles-in-jsconnect-being-ignored
http://vanillaforums.org/discussion/19263/automatic-assigning-roles
grep is your friend.
Thanks for that. I'm new here and did try to search for "jsconnect" and "roles" - but obviosuly not well enough!
However - I still can't get the role synchronisation working. I tried Webkadabra's solution for 2.0.18 Vanilla but that does not work for me - and it prevents users being logged in with jsconnect.
I also attempted installing a clean install of 2.1b but the installation gives me errors (invalid data type on one of the db insert statements)... so no joy on that front either.
Is there any other way of doing SSO with role synchronisation that anybody knows of?
I have managed to get this going. If anybody else has the same problems I did, then follow Webkadabra's solution for 2.0.18 Vanilla here:
http://vanillaforums.org/discussion/comment/191937#Comment_191937
The problem I was having is that the RoleIDs (taken from the database table gdn_role) need to be passed as an array - so I set them in the JSON as a comma seperated list of ids and then altered Webkadabra's code just slightly in the InsertForBasic function to;
$syncRoles = Gdn::Config('Garden.SSO.SyncRoles');
if($syncRoles ) {
$RoleIDs = (isset($FormPostValues['Roles']) ? explode(",",$FormPostValues['Roles']) : Gdn::Config('Garden.Registration.DefaultRoles'));
} else {
$RoleIDs = Gdn::Config('Garden.Registration.DefaultRoles');
}
It is just the bold explode which converts the comma separated string into an array.
This works perfectly for me now.