OrangeHRM Integration

Purpose of this post is to leave some insights in to the possible simple integration to have a single sign on system up which would work within the realms of the custom or third party application you might be already using.

Scenario: OrangeHRM  needs to be integrated to the architecture of  Health related clinic website done in HTML + PHP + MySQL. The orangehrm doesnt need any user management functionalities and the users in the clinic website would be admin and accessible group for orangehrm.

Integration Efforts guideline:
1. Third Party Application Architecture:
The Application had an architecture where the classess comprised mainly of system classess and is instantiated with autoload. The core functionals were modulared and supporting system functionals like system, user, module classes in the includes, and a library of function files. The first was to extend the modular hook to my wrapper module for orangehrm from the module, action call request from the user.

Module Wrapper actually handled the request, created the sub menus for the orangehrm and loaded a frame with request. Login and Install redirection needed to be stripped and so I added a hook to the index file for connecting the orangehrm database and tables and creating the required sessions. Change Password, Add User, Edit User were all removed ( made hidden ) as integration needed to work as single sign-on.

2. Autoload  on instantiation on fly in clinic system came as a stumble block but it was overcome by adding the below class to system class directory for use for all plugins or 3rd party applications that is going to be integrated.
class sys_bot {
private $classes = array (
‘Conf’ => “modules/orangehrm/lib/confs/Conf.php”,
public $Conf; // Accessible by other classes

public function __construct($load=false){
foreach($load as $class){
$this->$class = new $class($this);
} else {
foreach($this->classes as $class => $path){
$this->$class = new $class($this);

3. Clinic User Manager
Add , Edit , Delete User in clinic would include a wrapper action files to populate the users as admin in the orangehrm.
Add Action:
Clinic system creates the user on user add form submission
The orangehrm conf file in lib/confs/conf.php is checked for existence
If yes, include the add wrapper.
Add Wrapper file should prepare the connection to insert the user as alphanumeric ‘USRXXX’ indexed with submitted data to user table
We need to hold on the mysql_insert_id to get clinic system user insertion id for use in orangehrm insertion.

Edit and Delete Action :
Edit and Delete Action in the custom clinic system was based on the user ID
I prefered to make use of the username and had to retrieve the username to make use of as edit was opening up the user username and password also for editing.
Same with delete action.

4. To cross check the Logged in user in clinic who was automatically tried to log in to the hrm but added to module access check, we restricted the user to role provision in the clinic system with a XML file. This XML file was a dump build from the clinic system and comprised of the role name and roleid. This XML file is included and parsed with the core wrapper file while the session settings in the wrapper takes driver seat.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: