Skip to content

Commit

Permalink
migration. added new profiles permissions tree
Browse files Browse the repository at this point in the history
  • Loading branch information
edospadoni committed Nov 24, 2023
1 parent 29f3e44 commit 86b5192
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
30 changes: 30 additions & 0 deletions freepbx/initdb.d/migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,33 @@
$db->query($sql);
$stmt = $db->prepare($sql);
$stmt->execute($extensions);

# migrate profiles, macro_permissions and permissions scheme to new format
$db->query("INSERT INTO `rest_cti_macro_permissions` VALUES (12,'nethvoice_cti','NethVoice CTI','Enables access to NethVoice CTI application')");
$db->query("INSERT INTO `rest_cti_profiles_macro_permissions` (`profile_id`,`macro_permission_id`) VALUES (1,12)");
$db->query("INSERT INTO `rest_cti_profiles_macro_permissions` (`profile_id`,`macro_permission_id`) VALUES (2,12)");
$db->query("INSERT INTO `rest_cti_profiles_macro_permissions` (`profile_id`,`macro_permission_id`) VALUES (3,12)");
# move pickup from presence_panel to settings
$db->query("DELETE FROM `rest_cti_macro_permissions_permissions` WHERE `macro_permission_id` = 5 AND `permission_id` = 18");
$db->query("INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`, `permission_id`) VALUES (1,18);");
# move spy from presence_panel to settings
$db->query("DELETE FROM `rest_cti_macro_permissions_permissions` WHERE `macro_permission_id` = 5 AND `permission_id` = 15");
$db->query("INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`, `permission_id`) VALUES (1,15);");
# move intrude from presence_panel to settings
$db->query("DELETE FROM `rest_cti_macro_permissions_permissions` WHERE `macro_permission_id` = 5 AND `permission_id` = 16");
$db->query("INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`, `permission_id`) VALUES (1,16);");
# move phone_buttons from settings to nethvoice_cti
$db->query("DELETE FROM `rest_cti_macro_permissions_permissions` WHERE `macro_permission_id` = 1 AND `permission_id` = 2000");
$db->query("INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`, `permission_id`) VALUES (12,2000);");
# move privacy from settings to nethvoice_cti
$db->query("DELETE FROM `rest_cti_macro_permissions_permissions` WHERE `macro_permission_id` = 1 AND `permission_id` = 9");
$db->query("INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`, `permission_id`) VALUES (12,9);");
# move chat from settings to nethvoice_cti
$db->query("DELETE FROM `rest_cti_macro_permissions_permissions` WHERE `macro_permission_id` = 1 AND `permission_id` = 8");
$db->query("INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`, `permission_id`) VALUES (12,8);");
# move screen_sharing from settings to nethvoice_cti
$db->query("DELETE FROM `rest_cti_macro_permissions_permissions` WHERE `macro_permission_id` = 1 AND `permission_id` = 1000");
$db->query("INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`, `permission_id`) VALUES (12,1000);");
# move video_conference from settings to nethvoice_cti
$db->query("DELETE FROM `rest_cti_macro_permissions_permissions` WHERE `macro_permission_id` = 1 AND `permission_id` = 3000");
$db->query("INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`, `permission_id`) VALUES (12,3000);");
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ INSERT INTO `rest_cti_macro_permissions` (`id`,`name`,`displayname`,`description
(9,"remote_sites","Remote Sites","Allow to view Remote Sites information"),
(10,"qmanager","Queue Manager","Allow to view and manage queues in real time"),
(11,"operator_panel","Operator Panel","Enables Operator Panel interface for operators");
(12,"nethvoice_cti","NethVoice CTI","Enables access to NethVoice CTI application");
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@ INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`,`per
(1,4),
(1,5),
(1,6),
(1,8),
(1,9),
(1,1000),
(1,2000),
(1,3000),
(1,15),
(1,16),
(1,18),
(2,12),
(3,13),
(3,4000),
(5,15),
(5,16),
(5,17),
(5,18),
(5,19),
(5,20),
(5,21),
Expand All @@ -28,4 +23,9 @@ INSERT INTO `rest_cti_macro_permissions_permissions` (`macro_permission_id`,`per
(6,23),
(6,24),
(8,25),
(8,27);
(8,27),
(12,8),
(12,9),
(12,1000),
(12,2000),
(12,3000);
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ INSERT INTO `rest_cti_profiles_macro_permissions` (`profile_id`,`macro_permissio
(1,4),
(1,5),
(1,6),
(1,12),
(2,1),
(2,2),
(2,3),
(2,4),
(2,5),
(2,6),
(2,8),
(2,12),
(3,1),
(3,2),
(3,3),
Expand All @@ -25,3 +27,4 @@ INSERT INTO `rest_cti_profiles_macro_permissions` (`profile_id`,`macro_permissio
(3,7),
(3,8),
(3,9);
(3,12),

0 comments on commit 86b5192

Please sign in to comment.