
SET @admin_role_id := (SELECT `id` FROM ohrm_user_role WHERE `name` = 'Admin');  
SET @ldap_configuration_screen_id := (SELECT `id` FROM ohrm_screen WHERE `name`='LDAP Configuration' AND `action_url`='configureLDAPAuthentication');  

INSERT INTO `ohrm_data_group` ( `name`, `description`, `can_read`, `can_create`, `can_update`, `can_delete`) VALUES
('ldap_configuration', 'HR Administration - LDAP Configuration', 1, 0, 1, 0);

SET @ldap_configuration_data_group_id := (SELECT LAST_INSERT_ID());

INSERT INTO `ohrm_user_role_data_group` (`user_role_id`, `data_group_id`, `can_read`, `can_create`, `can_update`, `can_delete`, `self`) VALUES
(@admin_role_id, @ldap_configuration_data_group_id, 1, 1, 1, 0, 0);

SET @view_admin_module_id := (SELECT `id` FROM `ohrm_screen` WHERE `module_id` =2 AND `action_url` = 'viewAdminModule');

INSERT INTO `ohrm_data_group_screen`(`data_group_id`, `screen_id`, `permission`) VALUES
(@ldap_configuration_data_group_id, @ldap_configuration_screen_id, 1),
(@ldap_configuration_data_group_id, @view_admin_module_id, 1),
(@ldap_configuration_data_group_id, @ldap_configuration_screen_id, 3);


INSERT INTO `ohrm_user_role_type_data_group` VALUES 
(@admin_role_id, @ldap_configuration_data_group_id);

