[MOV]hide_portal_module_by_user: from elabore-addons to ux-tools
This commit is contained in:
19
hide_portal_module_by_user/controllers/main.py
Normal file
19
hide_portal_module_by_user/controllers/main.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright 2026 Munin
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.http import request
|
||||
from odoo.addons.portal.controllers.portal import CustomerPortal
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
WHITELISTED_ROUTES = ['/my/home', '/my', '/my/account', '/my/security', '/my/payment_method']
|
||||
|
||||
|
||||
class CustomerPortalPolicy(CustomerPortal):
|
||||
def _prepare_portal_layout_values(self):
|
||||
vals = super()._prepare_portal_layout_values()
|
||||
current_path = request.httprequest.path
|
||||
if request.env.user.validate_portal_url(current_path) or current_path in WHITELISTED_ROUTES:
|
||||
return vals
|
||||
if '/my/' not in current_path:
|
||||
return vals
|
||||
raise NotFound()
|
||||
Reference in New Issue
Block a user