mirror of https://github.com/jumpserver/jumpserver
perf: 添加到默认组织中
parent
dbfb9db5c5
commit
b55eb1236f
|
@ -13,7 +13,7 @@ class AccountFilterSet(BaseFilterSet):
|
|||
hostname = drf_filters.CharFilter(field_name='name', lookup_expr='exact')
|
||||
username = drf_filters.CharFilter(field_name="username", lookup_expr='exact')
|
||||
address = drf_filters.CharFilter(field_name="asset__address", lookup_expr='exact')
|
||||
asset = drf_filters.CharFilter(field_name="asset_id", lookup_expr='exact')
|
||||
asset_id = drf_filters.CharFilter(field_name="asset", lookup_expr='exact')
|
||||
assets = drf_filters.CharFilter(field_name='asset_id', lookup_expr='exact')
|
||||
nodes = drf_filters.CharFilter(method='filter_nodes')
|
||||
node_id = drf_filters.CharFilter(method='filter_nodes')
|
||||
|
@ -45,7 +45,7 @@ class AccountFilterSet(BaseFilterSet):
|
|||
|
||||
class Meta:
|
||||
model = Account
|
||||
fields = ['id', 'asset_id', 'source_id', 'secret_type']
|
||||
fields = ['id', 'asset', 'source_id', 'secret_type']
|
||||
|
||||
|
||||
class GatheredAccountFilterSet(BaseFilterSet):
|
||||
|
|
|
@ -103,8 +103,12 @@ def on_user_created_set_default_org(sender, instance, created, **kwargs):
|
|||
return
|
||||
if instance.orgs.count() > 0:
|
||||
return
|
||||
with tmp_to_org(Organization.default()):
|
||||
Organization.default().add_member(instance)
|
||||
default_org = Organization.default()
|
||||
with tmp_to_org(default_org):
|
||||
default_org.add_member(instance)
|
||||
default_group = UserGroup.objects.filter(name='Default').first()
|
||||
if default_group:
|
||||
default_group.users.add(instance)
|
||||
|
||||
|
||||
def _remove_user_resource(model, users, org, user_field_name='users'):
|
||||
|
|
Loading…
Reference in New Issue