Skip to content

Commit

Permalink
[IMP] auth_oidc: use Command.LINK/UNLINK instead of raw numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
OdyX committed Sep 6, 2024
1 parent 3e0bcb5 commit 18305ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions auth_oidc/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from odoo import api, models
from odoo.exceptions import AccessDenied
from odoo.fields import Command
from odoo.http import request

_logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -98,10 +99,10 @@ def _auth_oauth_signin(self, provider, validation, params):
):
if group_line._eval_expression(user, validation):
if group_line.group_id not in user.groups_id:
group_updates.append((4, group_line.group_id.id))
group_updates.append((Command.LINK, group_line.group_id.id))
else:
if group_line.group_id in user.groups_id:
group_updates.append((3, group_line.group_id.id))
group_updates.append((Command.UNLINK, group_line.group_id.id))
if group_updates:
user.write({"groups_id": group_updates})
return login

0 comments on commit 18305ea

Please sign in to comment.