mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 15:11:27 +00:00
perf: remove OrganizationMember model
This commit is contained in:
@@ -14,7 +14,4 @@ class Migration(migrations.Migration):
|
||||
name='organization',
|
||||
options={'permissions': (('view_rootorg', 'Can view root org'), ('view_alljoinedorg', 'Can view all joined org')), 'verbose_name': 'Organization'},
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='OrganizationMember',
|
||||
),
|
||||
]
|
||||
|
@@ -27,4 +27,7 @@ class Migration(migrations.Migration):
|
||||
field=models.BooleanField(default=False, verbose_name='Builtin'),
|
||||
),
|
||||
migrations.RunPython(update_builtin_org),
|
||||
migrations.DeleteModel(
|
||||
name='OrganizationMember',
|
||||
),
|
||||
]
|
||||
|
@@ -871,7 +871,7 @@ class User(AuthMixin, TokenMixin, RoleMixin, MFAMixin, AbstractUser):
|
||||
def delete(self, using=None, keep_parents=False):
|
||||
if self.pk == 1 or self.username == 'admin':
|
||||
return
|
||||
return super(User, self).delete()
|
||||
return super(User, self).delete(using=using, keep_parents=keep_parents)
|
||||
|
||||
@classmethod
|
||||
def get_user_allowed_auth_backend_paths(cls, username):
|
||||
|
@@ -25,15 +25,6 @@ class UserGenerator(FakeDataGenerator):
|
||||
def pre_generate(self):
|
||||
self.group_ids = list(UserGroup.objects.all().values_list('id', flat=True))
|
||||
|
||||
def set_org(self, users):
|
||||
relations = []
|
||||
for u in users:
|
||||
relations.append(OrganizationMember(
|
||||
org_id=self.org.id,
|
||||
user_id=u.id,
|
||||
))
|
||||
OrganizationMember.objects.bulk_create(relations, ignore_conflicts=True)
|
||||
|
||||
def set_groups(self, users):
|
||||
relations = []
|
||||
for i in users:
|
||||
@@ -55,5 +46,4 @@ class UserGenerator(FakeDataGenerator):
|
||||
)
|
||||
users.append(u)
|
||||
users = User.objects.bulk_create(users, ignore_conflicts=True)
|
||||
self.set_org(users)
|
||||
self.set_groups(users)
|
||||
|
Reference in New Issue
Block a user