reactor&remove: 重构applications模块 & 移除applications、perms中已不再使用的模块 (#5374)

* reactor: 重构applications模块 & 删除applications、perms中已不再使用的模块

 * reactor: 1. 针对application.attrs字段的view-serializer映射逻辑,采用DynamicMapping的方案重写;
 * reactor: 2. 删除applications和perms模块中已不再使用的database-app/k8s-app/remote-app模块;

* reactor: 添加迁移文件(删除perms/databaseperrmission/remoteapppermission/k8sapppermission)

* reactor: 修改细节

Co-authored-by: Bai <bugatti_it@163.com>
This commit is contained in:
fit2bot
2021-01-04 05:27:03 +08:00
committed by GitHub
parent 428e8bf2a0
commit 7e7e24f51f
98 changed files with 934 additions and 3109 deletions

View File

@@ -205,16 +205,15 @@ class SystemUser(BaseUser):
return assets
@classmethod
def get_protocol_by_application_type(cls, application_type):
from applications.models import Category
remote_app_types = list(dict(Category.get_type_choices(Category.remote_app)).keys())
if application_type in remote_app_types:
def get_protocol_by_application_type(cls, app_type):
from applications.const import ApplicationTypeChoices
if app_type in ApplicationTypeChoices.remote_app_types():
return cls.PROTOCOL_RDP
cloud_types = list(dict(Category.get_type_choices(Category.cloud)).keys())
db_types = list(dict(Category.get_type_choices(Category.db)).keys())
other_types = [*cloud_types, *db_types]
if application_type in other_types:
return application_type
protocol = None
other_types = [*ApplicationTypeChoices.db_types(), *ApplicationTypeChoices.cloud_types()]
if app_type in other_types and app_type in cls.APPLICATION_CATEGORY_PROTOCOLS:
protocol = app_type
return protocol
class Meta:
ordering = ['name']