[IMP] runbot_merge: log ACL error in PR controller

Currently this just silently returns a 404. Since repos are gated by
default (only accessible to internal users) this can get very
confusing when trying to setup a new repo or when forgetting this
information when writing tests.
This commit is contained in:
Xavier Morel 2024-06-12 11:14:44 +02:00
parent 2ab06ca96b
commit d2e730c39b

View File

@ -7,6 +7,7 @@ import colorsys
import hashlib import hashlib
import io import io
import json import json
import logging
import math import math
import pathlib import pathlib
from email.utils import formatdate from email.utils import formatdate
@ -22,6 +23,9 @@ from PIL import Image, ImageDraw, ImageFont
from odoo.http import Controller, route, request from odoo.http import Controller, route, request
from odoo.tools import file_open from odoo.tools import file_open
_logger = logging.getLogger(__name__)
LIMIT = 20 LIMIT = 20
class MergebotDashboard(Controller): class MergebotDashboard(Controller):
@route('/runbot_merge', auth="public", type="http", website=True, sitemap=True) @route('/runbot_merge', auth="public", type="http", website=True, sitemap=True)
@ -101,6 +105,12 @@ class MergebotDashboard(Controller):
if not pr_id: if not pr_id:
raise werkzeug.exceptions.NotFound() raise werkzeug.exceptions.NotFound()
if not pr_id.repository.group_id <= request.env.user.groups_id: if not pr_id.repository.group_id <= request.env.user.groups_id:
_logger.warning(
"Access error: %s (%s) tried to access %s but lacks access",
request.env.user.login,
request.env.user.name,
pr_id.display_name,
)
raise werkzeug.exceptions.NotFound() raise werkzeug.exceptions.NotFound()
if png: if png: