SET @admin_role_id := (SELECT `id` FROM ohrm_user_role WHERE `name` = 'Admin');  
      
INSERT INTO `ohrm_module` (`name`, `status`) VALUES ('ldapAuthentication', 1);  
      
SET @module_id := (SELECT LAST_INSERT_ID());  
      
INSERT INTO ohrm_screen (`name`, `module_id`, `action_url`) VALUES  
('LDAP Configuration', @module_id, 'configureLDAPAuthentication');  
      
SET @ldap_configuration_screen_id := (SELECT LAST_INSERT_ID());  
      
SET @admin_menu_id := (SELECT `id` FROM ohrm_menu_item WHERE `menu_title` = 'Admin' AND `level` = 1);

SET @authentication_menu_id := (SELECT id FROM ohrm_menu_item where menu_title = 'Authentication');

-- SET @ldap_configuration_order_hint := (SELECT max(`order_hint`)+100 FROM `ohrm_menu_item` WHERE `parent_id`= @admin_menu_id AND `level` = 2 );   
      
INSERT INTO ohrm_menu_item (`menu_title`, `screen_id`, `parent_id`, `level`, `order_hint`, `url_extras`, `status`) VALUES  
('LDAP Configuration', @ldap_configuration_screen_id, @authentication_menu_id, 3, 1103, '', 1);  
      
INSERT INTO ohrm_user_role_screen (user_role_id, screen_id, can_read, can_create, can_update, can_delete) VALUES  
(@admin_role_id, @ldap_configuration_screen_id, 1, 1, 1, 0); 