2022-07-04 10:54:47 +00:00
|
|
|
from assets.api.accounts import (
|
|
|
|
AccountFilterSet, AccountViewSet, AccountSecretsViewSet
|
|
|
|
)
|
|
|
|
from common.mixins import RecordViewLogMixin
|
|
|
|
from .. import serializers
|
2022-07-14 02:56:09 +00:00
|
|
|
from ..models import Account
|
2022-07-04 10:54:47 +00:00
|
|
|
|
|
|
|
__all__ = ['AccountHistoryViewSet', 'AccountHistorySecretsViewSet']
|
|
|
|
|
|
|
|
|
|
|
|
class AccountHistoryFilterSet(AccountFilterSet):
|
|
|
|
class Meta:
|
2022-07-14 02:56:09 +00:00
|
|
|
model = Account.history.model
|
2022-07-04 10:54:47 +00:00
|
|
|
fields = AccountFilterSet.Meta.fields
|
|
|
|
|
|
|
|
|
|
|
|
class AccountHistoryViewSet(AccountViewSet):
|
2022-07-14 02:56:09 +00:00
|
|
|
model = Account.history.model
|
2022-07-04 10:54:47 +00:00
|
|
|
filterset_class = AccountHistoryFilterSet
|
|
|
|
serializer_classes = {
|
|
|
|
'default': serializers.AccountHistorySerializer,
|
|
|
|
}
|
|
|
|
rbac_perms = {
|
|
|
|
'list': 'assets.view_assethistoryaccount',
|
|
|
|
'retrieve': 'assets.view_assethistoryaccount',
|
|
|
|
}
|
|
|
|
http_method_names = ['get', 'options']
|
|
|
|
|
|
|
|
|
|
|
|
class AccountHistorySecretsViewSet(RecordViewLogMixin, AccountHistoryViewSet):
|
|
|
|
serializer_classes = {
|
|
|
|
'default': serializers.AccountHistorySecretSerializer
|
|
|
|
}
|
|
|
|
http_method_names = ['get']
|
|
|
|
permission_classes = AccountSecretsViewSet.permission_classes
|
|
|
|
rbac_perms = {
|
|
|
|
'list': 'assets.view_assethistoryaccountsecret',
|
|
|
|
'retrieve': 'assets.view_assethistoryaccountsecret',
|
|
|
|
}
|