From ddcd748b000164e9b1f9d333025299ede397e25d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 23 Feb 2024 09:27:18 +0100 Subject: [PATCH] simplify initial_datas --- idhub/management/commands/initial_datas.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/idhub/management/commands/initial_datas.py b/idhub/management/commands/initial_datas.py index 40cfa8b..8205918 100644 --- a/idhub/management/commands/initial_datas.py +++ b/idhub/management/commands/initial_datas.py @@ -22,8 +22,6 @@ class Command(BaseCommand): def handle(self, *args, **kwargs): ADMIN_EMAIL = config('ADMIN_EMAIL', 'admin@example.org') ADMIN_PASSWORD = config('ADMIN_PASSWORD', '1234') - KEY_DIDS = config('KEY_DIDS') - cache.set("KEY_DIDS", KEY_DIDS, None) self.create_admin_users(ADMIN_EMAIL, ADMIN_PASSWORD) if settings.CREATE_TEST_USERS: @@ -37,6 +35,7 @@ class Command(BaseCommand): f = csv.reader(csvfile, delimiter=';', quotechar='"') for r in f: self.create_organizations(r[0].strip(), r[1].strip()) + if settings.SYNC_ORG_DEV == 'y': self.sync_credentials_organizations("pangea.org", "somconnexio.coop") self.sync_credentials_organizations("local 8000", "local 9000") @@ -44,17 +43,13 @@ class Command(BaseCommand): def create_admin_users(self, email, password): su = User.objects.create_superuser(email=email, password=password) - su.set_encrypted_sensitive_data() su.save() - self.create_defaults_dids(su) def create_users(self, email, password): u = User.objects.create(email=email, password=password) u.set_password(password) - u.set_encrypted_sensitive_data() u.save() - self.create_defaults_dids(u) def create_organizations(self, name, url): @@ -70,11 +65,6 @@ class Command(BaseCommand): org1.save() org2.save() - def create_defaults_dids(self, u): - did = DID(label="Default", user=u, type=DID.Types.WEB) - did.set_did() - did.save() - def create_schemas(self): schemas_files = os.listdir(settings.SCHEMAS_DIR) for x in schemas_files: