Skip to content

Commit 1cce1e1

Browse files
StefanRijnhartjjscarafia
authored andcommitted
[RFR] Explicit access rights so that tests can run
Fixes OCA#505
1 parent ea13b37 commit 1cce1e1

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

database_cleanup/README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Usage
2020
=====
2121

2222
After installation of this module, go to the Settings menu -> Technical ->
23-
Database cleanup. Go through the modules, models, columns and tables
23+
Database cleanup. This menu is only available to members of the *Access Rights*
24+
group. Go through the modules, models, columns and tables
2425
entries under this menu (in that order) and find out if there is orphaned data
2526
in your database. You can either delete entries by line, or sweep all entries
2627
in one big step (if you are *really* confident).

database_cleanup/models/purge_wizard.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def purge(self):
2424
@api.model
2525
def create(self, values):
2626
# make sure the user trying this is actually supposed to do it
27-
if not self.env.ref('database_cleanup.menu_database_cleanup')\
28-
.parent_id._filter_visible_menus():
27+
if self.env.ref(
28+
'base.group_erp_manager') not in self.env.user.groups_id:
2929
raise AccessDenied
3030
return super(CleanupPurgeLine, self).create(values)
3131

@@ -86,8 +86,8 @@ def name_get(self):
8686
@api.model
8787
def create(self, values):
8888
# make sure the user trying this is actually supposed to do it
89-
if not self.env.ref('database_cleanup.menu_database_cleanup')\
90-
.parent_id._filter_visible_menus():
89+
if self.env.ref(
90+
'base.group_erp_manager') not in self.env.user.groups_id:
9191
raise AccessDenied
9292
return super(PurgeWizard, self).create(values)
9393

database_cleanup/views/menu.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<field name="sequence" eval="10" />
88
<!-- attach to Settings -> Technical -->
99
<field name="parent_id" ref="base.menu_custom"/>
10+
<field name="groups_id" eval="[(6,0, [ref('base.group_erp_manager')])]"/>
1011
</record>
1112

1213
<record model="ir.ui.menu" id="menu_purge_modules">

0 commit comments

Comments
 (0)