-
- Downloads
[FIX] base: has_group behaviour under the new API
While the signature makes sense in an old API context (sort-of) it's very easy to misuse in a new API context as one'd expect `has_group` to use the subject (recordset), not the user in the environment, compounded by ``env.user`` being browsed as administrator, resulting in the "obvious" ``env.user.has_group(foo)`` checking if the administrator (rather than the current user) has the specified group. Adds a divergent v8 version of has_group which first checks if it's called on a non-empty recordset, and in that case use the recordset id, otherwise fallback on the context user (to handle new API conversions which used the "correct" call convention rather than the obvious one). fixes #9649
Showing
- openerp/addons/base/res/res_users.py 15 additions, 1 deletionopenerp/addons/base/res/res_users.py
- openerp/addons/base/tests/__init__.py 1 addition, 0 deletionsopenerp/addons/base/tests/__init__.py
- openerp/addons/base/tests/test_user_has_group.py 49 additions, 0 deletionsopenerp/addons/base/tests/test_user_has_group.py
Loading
Please register or sign in to comment