mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: get_active_properties overwrite cookies
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# Copyright 2019 Pablo Quesada
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import AccessError
|
||||
from odoo import api, fields, models
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
@@ -39,7 +38,8 @@ class ResUsers(models.Model):
|
||||
active_property_ids = list(
|
||||
map(int, request.httprequest.cookies.get("pms_pids", "").split(","))
|
||||
)
|
||||
if any(pid not in user_property_ids for pid in active_property_ids):
|
||||
raise AccessError(_("Access to unauthorized or invalid properties."))
|
||||
active_property_ids = [
|
||||
pid for pid in active_property_ids if pid in user_property_ids
|
||||
]
|
||||
return self.env["pms.property"].browse(active_property_ids).ids
|
||||
return user_property_ids
|
||||
|
||||
Reference in New Issue
Block a user