[IMP] base: add _is_internal method to res.users

No method was readily available to know if a user is `internal` (has
group `base.group_user`), which was inconsistent with other base groups.

_is_internal is now used in the codebase where it is clear that
`.has_group('base.group_user')` is called on a single record.

Part-of: odoo/odoo#85703
This commit is contained in:
Florian Charlier
2022-06-14 09:35:57 +02:00
parent b5f3433adc
commit dae28c4b46
27 changed files with 36 additions and 32 deletions
+1 -1
View File
@@ -149,7 +149,7 @@ class OAuthController(http.Controller):
resp.autocorrect_location_header = False
# Since /web is hardcoded, verify user has right to land on it
if werkzeug.urls.url_parse(resp.location).path == '/web' and not request.env.user.has_group('base.group_user'):
if werkzeug.urls.url_parse(resp.location).path == '/web' and not request.env.user._is_internal():
resp.location = '/'
return resp
except AttributeError: