add main to organization
This commit is contained in:
parent
35c04b0e39
commit
27f84c30e7
|
@ -35,9 +35,6 @@ class Command(BaseCommand):
|
||||||
for r in f:
|
for r in f:
|
||||||
self.create_organizations(r[0].strip(), r[1].strip())
|
self.create_organizations(r[0].strip(), r[1].strip())
|
||||||
|
|
||||||
# You need to confirm than your Organization is created
|
|
||||||
assert Organization.objects.filter(name=settings.ORGANIZATION).exists()
|
|
||||||
|
|
||||||
if settings.SYNC_ORG_DEV == 'y':
|
if settings.SYNC_ORG_DEV == 'y':
|
||||||
self.sync_credentials_organizations("pangea.org", "somconnexio.coop")
|
self.sync_credentials_organizations("pangea.org", "somconnexio.coop")
|
||||||
self.sync_credentials_organizations("local 8000", "local 9000")
|
self.sync_credentials_organizations("local 8000", "local 9000")
|
||||||
|
@ -55,7 +52,10 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
|
|
||||||
def create_organizations(self, name, url):
|
def create_organizations(self, name, url):
|
||||||
Organization.objects.create(name=name, response_uri=url)
|
if url == settings.RESPONSE_URI:
|
||||||
|
Organization.objects.create(name=name, response_uri=url, main=True)
|
||||||
|
else:
|
||||||
|
Organization.objects.create(name=name, response_uri=url)
|
||||||
|
|
||||||
def sync_credentials_organizations(self, test1, test2):
|
def sync_credentials_organizations(self, test1, test2):
|
||||||
org1 = Organization.objects.get(name=test1)
|
org1 = Organization.objects.get(name=test1)
|
||||||
|
|
|
@ -475,7 +475,7 @@ class DID(models.Model):
|
||||||
return json.loads(self.key_material)
|
return json.loads(self.key_material)
|
||||||
|
|
||||||
def get_organization(self):
|
def get_organization(self):
|
||||||
return Organization.objects.get(name=settings.ORGANIZATION)
|
return Organization.objects.get(main=True)
|
||||||
|
|
||||||
class Schemas(models.Model):
|
class Schemas(models.Model):
|
||||||
type = models.CharField(max_length=250)
|
type = models.CharField(max_length=250)
|
||||||
|
@ -697,6 +697,8 @@ class VerificableCredential(models.Model):
|
||||||
sid
|
sid
|
||||||
)
|
)
|
||||||
|
|
||||||
|
org = Organization.objects.get(main=True)
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'id_credential': str(self.id),
|
'id_credential': str(self.id),
|
||||||
'vc_id': url_id,
|
'vc_id': url_id,
|
||||||
|
@ -706,7 +708,7 @@ class VerificableCredential(models.Model):
|
||||||
'firstName': self.user.first_name or "",
|
'firstName': self.user.first_name or "",
|
||||||
'lastName': self.user.last_name or "",
|
'lastName': self.user.last_name or "",
|
||||||
'email': self.user.email,
|
'email': self.user.email,
|
||||||
'organisation': settings.ORGANIZATION or '',
|
'organisation': org.name or '',
|
||||||
}
|
}
|
||||||
context.update(d)
|
context.update(d)
|
||||||
return context
|
return context
|
||||||
|
|
|
@ -47,9 +47,11 @@ class Organization(models.Model):
|
||||||
want to connect to this organization. (send a request)
|
want to connect to this organization. (send a request)
|
||||||
For use the packages requests we need use my_client_id
|
For use the packages requests we need use my_client_id
|
||||||
For use in the get or post method of a View, then we need use client_id
|
For use in the get or post method of a View, then we need use client_id
|
||||||
and secret_id
|
and secret_id.
|
||||||
|
main is a field which indicates the organization of this idhub
|
||||||
"""
|
"""
|
||||||
name = models.CharField(max_length=250)
|
name = models.CharField(max_length=250)
|
||||||
|
main = models.BooleanField(default=False)
|
||||||
client_id = models.CharField(
|
client_id = models.CharField(
|
||||||
max_length=24,
|
max_length=24,
|
||||||
default=set_client_id,
|
default=set_client_id,
|
||||||
|
|
|
@ -104,20 +104,6 @@ class SelectWalletView(FormView):
|
||||||
template_name = "select_wallet.html"
|
template_name = "select_wallet.html"
|
||||||
form_class = WalletForm
|
form_class = WalletForm
|
||||||
success_url = reverse_lazy('promotion:select_wallet')
|
success_url = reverse_lazy('promotion:select_wallet')
|
||||||
def get(self, request, *args, **kwargs):
|
|
||||||
if settings.ORGANIZATION == 'Setem':
|
|
||||||
self.template_name = "select_wallet_setem.html"
|
|
||||||
return super().get(request, *args, **kwargs)
|
|
||||||
|
|
||||||
# self.context = {'form': fo}
|
|
||||||
# template = get_template(
|
|
||||||
# self.template_name,
|
|
||||||
# # context
|
|
||||||
# ).render()
|
|
||||||
# return HttpResponse(template)
|
|
||||||
|
|
||||||
# def post(self, request, *args, **kwargs):
|
|
||||||
# super().post(request, *args, **kwargs)
|
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
kwargs = super().get_form_kwargs()
|
kwargs = super().get_form_kwargs()
|
||||||
|
|
|
@ -220,7 +220,6 @@ LOGGING = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ORGANIZATION = config('ORGANIZATION', 'Pangea')
|
|
||||||
SYNC_ORG_DEV = config('SYNC_ORG_DEV', 'y')
|
SYNC_ORG_DEV = config('SYNC_ORG_DEV', 'y')
|
||||||
ORG_FILE = config('ORG_FILE', 'examples/organizations.csv')
|
ORG_FILE = config('ORG_FILE', 'examples/organizations.csv')
|
||||||
ENABLE_EMAIL = config('ENABLE_EMAIL', default=True, cast=bool)
|
ENABLE_EMAIL = config('ENABLE_EMAIL', default=True, cast=bool)
|
||||||
|
|
Loading…
Reference in New Issue