From b5d78f6294e63c81b32aae947f6f755e2ee6ca62 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Tue, 9 Aug 2016 07:57:31 +0200 Subject: [PATCH] [RFR] Explicit access rights so that tests can run Fixes #505 --- database_cleanup/README.rst | 3 ++- database_cleanup/models/purge_wizard.py | 8 ++++---- database_cleanup/views/menu.xml | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/database_cleanup/README.rst b/database_cleanup/README.rst index 2adbf2b4a7f..42222ae545c 100644 --- a/database_cleanup/README.rst +++ b/database_cleanup/README.rst @@ -20,7 +20,8 @@ Usage ===== After installation of this module, go to the Settings menu -> Technical -> -Database cleanup. Go through the modules, models, columns and tables +Database cleanup. This menu is only available to members of the *Access Rights* +group. Go through the modules, models, columns and tables entries under this menu (in that order) and find out if there is orphaned data in your database. You can either delete entries by line, or sweep all entries in one big step (if you are *really* confident). diff --git a/database_cleanup/models/purge_wizard.py b/database_cleanup/models/purge_wizard.py index aa44ffe84e9..0e1645adc76 100644 --- a/database_cleanup/models/purge_wizard.py +++ b/database_cleanup/models/purge_wizard.py @@ -24,8 +24,8 @@ def purge(self): @api.model def create(self, values): # make sure the user trying this is actually supposed to do it - if not self.env.ref('database_cleanup.menu_database_cleanup')\ - .parent_id._filter_visible_menus(): + if self.env.ref( + 'base.group_erp_manager') not in self.env.user.groups_id: raise AccessDenied return super(CleanupPurgeLine, self).create(values) @@ -86,8 +86,8 @@ def name_get(self): @api.model def create(self, values): # make sure the user trying this is actually supposed to do it - if not self.env.ref('database_cleanup.menu_database_cleanup')\ - .parent_id._filter_visible_menus(): + if self.env.ref( + 'base.group_erp_manager') not in self.env.user.groups_id: raise AccessDenied return super(PurgeWizard, self).create(values) diff --git a/database_cleanup/views/menu.xml b/database_cleanup/views/menu.xml index 82577bdc964..0796f907b07 100644 --- a/database_cleanup/views/menu.xml +++ b/database_cleanup/views/menu.xml @@ -7,6 +7,7 @@ +