Browse Source

[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.
pull/33/head
Rémy Taymans 6 years ago
parent
commit
56edf13276
  1. 6
      beesdoo_website_shift/controllers/main.py

6
beesdoo_website_shift/controllers/main.py

@ -61,8 +61,8 @@ class WebsiteShiftController(http.Controller):
{}
)
@http.route('/shift/<model("beesdoo.shift.shift"):shift>/subscribe', auth='user', website=True)
def subscribe_to_shift(self, shift=None, **kw):
@http.route('/shift/<int:shift_id>/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'))

Loading…
Cancel
Save