[IMP] use sets to check for groups/ACL

rco notes that group tests are generally intersections, if the user has *any*
group set on the object he can see/use it. This change is a literal
translation of the original semantics, which may be wrong.
This commit is contained in:
Xavier Morel 2014-05-27 11:33:12 +02:00
parent 4e3864c1fb
commit b5cce44dd2
1 changed files with 3 additions and 3 deletions

View File

@ -218,14 +218,14 @@ class Website(openerp.addons.web.controllers.main.Home):
request.cr, request.uid, 'website', 'theme')
user = request.registry['res.users'].browse(request.cr, request.uid, request.uid, request.context)
group_ids = [g.id for g in user.groups_id]
user_groups = set(user.groups_id)
view = request.registry.get("ir.ui.view")
view = request.registry["ir.ui.view"]
views = view._views_get(request.cr, request.uid, xml_id, context=request.context)
done = {}
result = []
for v in views:
if v.groups_id and [g for g in v.groups_id if g.id not in group_ids]:
if not user_groups.issuperset(v.groups_id):
continue
if v.inherit_option_id and v.inherit_option_id.id != view_theme_id or not optional:
if v.inherit_option_id.id not in done: