mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: log manual batch and redirect
1. Log who started a manull build 2. redirect if the batch given in a build url is not containing this build (manual url)
This commit is contained in:
parent
af8a5b8e8e
commit
a52c14957e
@ -280,6 +280,10 @@ class Runbot(Controller):
|
||||
|
||||
if from_batch:
|
||||
from_batch = request.env['runbot.batch'].browse(int(from_batch))
|
||||
if build_id not in from_batch.with_context(active_test=False).slot_ids.build_id.ids:
|
||||
# the url may have been forged replacing the build id, redirect to hide the batch
|
||||
return werkzeug.utils.redirect('/runbot/build/%s' % build_id)
|
||||
|
||||
from_batch = from_batch.with_context(batch=from_batch)
|
||||
Build = request.env['runbot.build'].with_context(batch=from_batch)
|
||||
|
||||
|
@ -455,5 +455,6 @@ class BatchSlot(models.Model):
|
||||
self.ensure_one()
|
||||
if self.build_id:
|
||||
return self.build_id
|
||||
self.batch_id._log(f'Trigger {self.trigger_id.name} was started by {self.env.user.name}')
|
||||
self.link_type, self.build_id = self.batch_id._create_build(self.params_id)
|
||||
return self.build_id
|
||||
|
Loading…
Reference in New Issue
Block a user