pref: 添加 perm token

pull/9075/head
ibuler 2022-11-14 14:03:58 +08:00
parent 0044f11262
commit 4f135bc349
4 changed files with 24 additions and 9 deletions

View File

@ -1,31 +1,31 @@
import os
import abc
import json
import time
import base64
import json
import os
import time
import urllib.parse
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from rest_framework.request import Request
from rest_framework import status
from rest_framework.exceptions import PermissionDenied
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.exceptions import PermissionDenied
from rest_framework.request import Request
from rest_framework.response import Response
from common.drf.api import JMSModelViewSet
from common.http import is_true
from orgs.mixins.api import RootOrgViewMixin
from perms.models import ActionChoices
from terminal.models import EndpointRule
from ..models import ConnectionToken
from ..serializers import (
ConnectionTokenSerializer, ConnectionTokenSecretSerializer,
SuperConnectionTokenSerializer, ConnectionTokenDisplaySerializer,
)
from ..models import ConnectionToken
__all__ = ['ConnectionTokenViewSet', 'SuperConnectionTokenViewSet']
# ExtraActionApiMixin

View File

@ -1,5 +1,6 @@
# coding: utf-8
#
from .permed_node import *
from .asset_permission import *
from .perm_node import *
from .perm_token import *

View File

@ -0,0 +1,14 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
class PermToken(models.Model):
user = models.ForeignKey('users.User', on_delete=models.CASCADE, verbose_name=_('User'))
asset = models.ForeignKey('assets.Asset', on_delete=models.CASCADE, verbose_name=_('Asset'))
account = models.CharField(max_length=128, verbose_name=_('Account'))
secret = models.CharField(max_length=1024, verbose_name=_('Secret'))
protocol = models.CharField(max_length=32, verbose_name=_('Protocol'))
connect_method = models.CharField(max_length=32, verbose_name=_('Connect method'))
class Meta:
abstract = True