[IMP] runbot: allow only advanced users to wake up a child

As it happens that some users are waking up child builds, let's only
allow advanced users to do that.
This commit is contained in:
Christophe Monniez 2023-06-27 11:56:50 +02:00 committed by xdo
parent 503afda3b6
commit 1cc73a606d
2 changed files with 3 additions and 1 deletions

View File

@ -996,6 +996,8 @@ class BuildResult(models.Model):
self._log('wake_up', f'Wake up initiated by {user.name}')
if self.local_state != 'done':
self._log('wake_up', 'Impossibe to wake up, state is not done')
elif self.parent_id and not user.has_group('runbot.group_runbot_advanced_user'):
self._log('wake_up', 'Waking up child builds is for advanced users only')
else:
self.requested_action = 'wake_up'

View File

@ -219,7 +219,7 @@
<a t-if="bu.static_run" t-att-href="bu.static_run" class="btn btn-info" title="View result" aria-label="View result">
<i class="fa fa-sign-in"/>
</a>
<a groups="base.group_user" t-if="bu.local_state=='done' and bu.requested_action != 'wake_up' and bu.database_ids" href="#" data-runbot="wakeup" t-att-data-runbot-build="bu.id" class="btn btn-default" title="Wake up this build" aria-label="Wake up this build">
<a groups="base.group_user" t-if="bu.local_state=='done' and (not bu.parent_id or user_id.has_group('runbot.group_runbot_advanced_user')) and bu.requested_action != 'wake_up' and bu.database_ids" href="#" data-runbot="wakeup" t-att-data-runbot-build="bu.id" class="btn btn-default" title="Wake up this build" aria-label="Wake up this build">
<i class="fa fa-coffee"/>
</a>
<a t-attf-href="/runbot/build/{{bu['id']}}" class="btn btn-default" title="Build details" aria-label="Build details">