unauthorized course content
Display a user-friendly error message when a user access an unauthorized
course content.
Specifications:
When a non-authorized course content is accessed, instead of a 403 error page,
redirect to the course page with a small notification saying
"You need to join this course to access ContentName"
Technical remarks:
As the slide URL may lead to a 403 if the user has not access to the course and
we didn't want to change that route, we have decided to share URL with a
specific route when the resource is protected (is_preview = False):
slides/slide/<int:slide_id>/share
To make available that new URL in the templates and to the client, a computed
field website_share_url has been added to the channel and slide model.
Note that when checking the access rule, a MissingError can be triggered if for
example the content has been deleted. In that case the user will be redirected
to a 404 and 2 reads are performed but the code is more generic.
Task 2742087
closesodoo/odoo#83935
Related: odoo/upgrade#3280
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>