From 4f04924e29b3fdda53aab431411868dc117607f2 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 24 Oct 2018 14:33:44 +0200 Subject: Privileges: grant user work log permissions to shikos & cleanup Closes #478 (Make user work log available) --- .../2018_01_01_000004_cleanup_group_privileges.php | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 db/migrations/2018_01_01_000004_cleanup_group_privileges.php (limited to 'db') diff --git a/db/migrations/2018_01_01_000004_cleanup_group_privileges.php b/db/migrations/2018_01_01_000004_cleanup_group_privileges.php new file mode 100644 index 00000000..aead4422 --- /dev/null +++ b/db/migrations/2018_01_01_000004_cleanup_group_privileges.php @@ -0,0 +1,66 @@ +schema->hasTable('GroupPrivileges')) { + return; + } + + $connection = $this->schema->getConnection(); + + // Add permissions to shikos to assign worklog entries + $connection->insert( + ' + INSERT INTO `GroupPrivileges` (`group_id`, `privilege_id`) + VALUES (?, ?) + ', + [ + -40, // Shift Coordinator + 43, // admin_user_worklog + ] + ); + + // Delete unused privileges + $connection->delete(' + DELETE FROM `Privileges` + WHERE `name` IN( + \'user_wakeup\', + \'faq\', + \'credits\' + ) + '); + } + + /** + * Reverse the migration + */ + public function down() + { + if (!$this->schema->hasTable('GroupPrivileges')) { + return; + } + + // Add permissions to shikos to assign worklog entries + $this->schema->getConnection()->delete( + ' + DELETE FROM `GroupPrivileges` + WHERE + group_id = ? + AND privilege_id = ? + ', + [ + -40, // Shift Coordinator + 43, // admin_user_worklog + ] + ); + } +} -- cgit v1.2.3-54-g00ecf