#to check user assigned to roles
SELECT * FROM user_roles;

#to check roles
SELECT * FROM roles;

#to check group roles
SELECT * FROM group_roles;

#to check employee
SELECT * FROM proll_employee pe WHERE pe.id = 58499;

#insert group roles, please update number as which role you want to replicate menus in group_role_id in selection
#and roles and group roles id from which you want to copy the menus

INSERT INTO group_role_menu (`menus_id`, `group_role_id`, `component_name`, `file_name`, `description`, `delete`, `right`, `update`, `view`, `portal_type`, `status`)
SELECT 
grm.menus_id, 
(5) as group_role_id, 
grm.component_name, 
grm.file_name, 
grm.description,
grm.`delete`,
grm.right,
grm.`update`,
grm.view,
grm.portal_type,
grm.`status`
FROM group_roles gr 
INNER JOIN user_roles ur ON ur.group_role_id = gr.id
INNER JOIN roles r ON r.id = ur.role_id
INNER JOIN group_role_menu grm ON grm.group_role_id = gr.id
INNER JOIN menu m ON m.id = grm.menus_id
WHERE gr.id = 3 AND r.id = 3 GROUP BY m.id;

#checking copy menus

SELECT 
grm.menus_id, 
grm.group_role_id, 
grm.component_name, 
grm.file_name, 
grm.description,
grm.`delete`,
grm.right,
grm.`update`,
grm.view,
grm.portal_type,
grm.`status`
FROM group_roles gr 
INNER JOIN user_roles ur ON ur.group_role_id = gr.id
INNER JOIN roles r ON r.id = ur.role_id
INNER JOIN group_role_menu grm ON grm.group_role_id = gr.id
INNER JOIN menu m ON m.id = grm.menus_id
WHERE gr.id = 5 AND r.id = 5 GROUP BY m.id;

#assigned menu to user

INSERT INTO user_roles (`user_id`, `group_role_id`, `role_id`, `cid`, `status`)
VALUES('', '5', '5', '48', '1');