perf: Account push

pull/14617/head
feng 2024-12-09 11:17:36 +08:00 committed by feng626
parent 709b676ec7
commit 36301503e9
4 changed files with 37 additions and 3 deletions

View File

@ -30,6 +30,7 @@ class PushAccountExecutionViewSet(AutomationExecutionViewSet):
("list", "accounts.view_pushaccountexecution"),
("retrieve", "accounts.view_pushaccountexecution"),
("create", "accounts.add_pushaccountexecution"),
("report", "accounts.view_pushaccountexecution"),
)
tp = AutomationTypes.push_account
@ -44,9 +45,15 @@ class PushAccountRecordViewSet(ChangeSecretRecordViewSet):
serializer_class = serializers.ChangeSecretRecordSerializer
tp = AutomationTypes.push_account
rbac_perms = {
'list': 'accounts.view_pushsecretrecord',
'execute': 'accounts.add_pushsecretexecution',
'secret': 'accounts.view_pushsecretrecord',
}
def get_queryset(self):
qs = ChangeSecretRecord.get_valid_records()
return qs.objects.filter(
return qs.filter(
execution__automation__type=self.tp
)

View File

@ -0,0 +1,24 @@
# Generated by Django 4.1.13 on 2024-12-09 03:15
from django.db import migrations
import private_storage.fields
import private_storage.storage.files
class Migration(migrations.Migration):
dependencies = [
('accounts', '0021_remove_pushaccountautomation_action_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='changesecretrecord',
options={'permissions': [('view_pushsecretrecord', 'Can view change secret execution'), ('add_pushsecretexecution', 'Can add change secret execution')], 'verbose_name': 'Change secret record'},
),
migrations.AlterField(
model_name='integrationapplication',
name='logo',
field=private_storage.fields.PrivateImageField(max_length=128, storage=private_storage.storage.files.PrivateFileSystemStorage(), upload_to='images', verbose_name='Logo'),
),
]

View File

@ -45,8 +45,11 @@ class ChangeSecretRecord(JMSBaseModel):
error = models.TextField(blank=True, null=True, verbose_name=_('Error'))
class Meta:
ordering = ('-date_created',)
verbose_name = _("Change secret record")
permissions = [
('view_pushsecretrecord', _('Can view change secret execution')),
('add_pushsecretexecution', _('Can add change secret execution')),
]
def __str__(self):
return f'{self.account.username}@{self.asset}'

View File

@ -1,7 +1,7 @@
{% load i18n %}
<div class='summary'>
<p>{% trans 'The following is a summary of account change secret tasks, please review and handle them' %}</p>
<p>{% trans 'The following is a summary of account change secret or push tasks, please read and process' %}</p>
<table>
<caption></caption>
<thead>