From 56edf132765a8d652f3ec30c729b04d92e4a9ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Thu, 18 Jan 2018 16:30:56 +0100 Subject: [PATCH] [FIX] website_shift: 403 when subscribing Fix the case when an irregular worker that doesn't have write access to beesdoo.shift.shift try to subscribe to a shift and got a 403 error. --- beesdoo_website_shift/controllers/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/beesdoo_website_shift/controllers/main.py b/beesdoo_website_shift/controllers/main.py index 080e3a5..83433de 100644 --- a/beesdoo_website_shift/controllers/main.py +++ b/beesdoo_website_shift/controllers/main.py @@ -61,8 +61,8 @@ class WebsiteShiftController(http.Controller): {} ) - @http.route('/shift//subscribe', auth='user', website=True) - def subscribe_to_shift(self, shift=None, **kw): + @http.route('/shift//subscribe', auth='user', website=True) + def subscribe_to_shift(self, shift_id=-1, **kw): """ Subscribe the current connected user into the given shift This is done only if : @@ -73,6 +73,8 @@ class WebsiteShiftController(http.Controller): """ # Get current user cur_user = request.env['res.users'].browse(request.uid) + # Get the shift + shift = request.env['beesdoo.shift.shift'].sudo().browse(shift_id) # Get config irregular_enable_sign_up = literal_eval(request.env['ir.config_parameter'].get_param( 'beesdoo_website_shift.irregular_enable_sign_up'))