- Synchronization of External Applications with ECM
Synchronization of External Applications with ECM¶
ECM has a binding system that allows external applications (such as forums, wikis, killboards, etc.) to fetch their security access configuration (basically which users are in which groups) from ECM.
How does it work?¶
First, you must note that ECM has its own user database with their passwords. The users are automatically assigned to groups by the scheduler so that group assignations match the In-Game titles of the characters owned by each user.
To make it simple: *One In-Game title <
One ECM group*. Users have all groups that match the titles of the characters they own.
ECM database also contains a table where you can add external applications (common_externalapplication). With this table, two other tables == common_groupbinding ==, `common_userbinding` allow the association of one ECM internal user or group with an external id.
With this information, ECM can easily provide a translation of its internal security access configuration (which users are in which groups) for any external application that has group & user bindings.
As a schema is often better than an explanation:
(1) You must provide a HTTP front-end (php, python, perl script) which will return a user_id of the external application when requested with a username and password. You will find more information about this [ExternalAppsSync#Prepare_and_install_a_script_attached_to_your_external_applicati here].
(2) You must provide a script that will fetch JSON data from ECM and update the external application user_groups table from this data. There is an example script for PHPBB3 in ECM package.
Kewl, how do I use this? (Example)¶
Here is a detailed example on how to setup sync between ECM and a PHPBB forum. Let's say we want five PHPBB groups to be synchronized with In-Game titles.
Create an External Application¶
Let's login to the administration panel in ECM via [http://ecm.myserver.com/admin/]. Here, you can manage most of the objects stored in ECM database. We will focus on the Common frame for this tutorial.
First thing we want to do is create an external application, click on the corresponding Add button, and fill the fields.
- name: An internal name for your application in ECM. This name will be displayed when members activate the binding of their account.
- url: An URL accessible from ECM server. This URL should return a user_id when challenged with a username and password. More information on this in the next section.
When you are done, click Save.
= Prepare and install a script attached to your external application¶
The URL you gave in the previous step points to a php script. This script should accept POST requests with 2 parameters: username and password. If the username is present in the forum's database and matches with the password, the script should return a simple response with the user_id corresponding to the username.
You will find an example script for PHPBB3 embedded in ECM installation. Depending on the version of PHPBB you use (or if you don't use PHPBB), the script may vary (could be a perl script, CGI, python, whatever...). It just needs to be accessible through an HTTP POST request and comply to the spec above.
Look at [ExternalAppsSync#How_does_it_work? the schema at the beginning] around the yellow (1) mark for an illustration.
Create group bindings¶
Next step is to create group bindings. We want some PHPBB groups to be associated with multiple In-Game titles. This way, if a player owns a character that has at least one of these titles, she/he will be put in the associated PHPBB group.
Here are the associations we want to have:
|ECM group (In-Game title)||PHPBB group||PHPBB group_id|
|Junior Member||Corp Members||5|
|Senior Member||Corp Members||5|
|Cap Pilot||Cap Pilots||45|
|Production Officer||Production Manager||167|
|Production Director||Production Manager||167|
|HR Officer||HR Team||457|
In ECM administration panel, you can create Group bindings to reflect the table above.
Ask users to activate the binding of their accounts¶
Once the group bindings are created, you must ask users to activate the binding of their accounts with the external application. In order to do that, they must log-in to ECM, go to their profile and follow these steps:
- Click on Bind
- Enter their username and password of the external application (forum) and
- Hit Bind again :) If they provided valid information, and that the script we talked about earlier is working, they should see this
MORE TO COME... :)