Open thejoeejoee opened 2 years ago
my extra data
{
"mail": "jiso3@seznam.cz",
"sc": "CZ-BRNO-VUT",
"first": "Jiří",
"last": "Soukup",
"nationality": "CZ",
"picture": "https://accounts.esn.org/sites/default/files/avatars/2021-05/86e6647c4bf99c5ac11ae298e9bc8624fccdcffa4a6380b7492c186cbb10055a.jpg",
"section": "ESN VUT Brno",
"country": "ESN Czech Republic",
"uid": "jiri_soukup"
}
@samuelsimun battleplan:
class ESNAccountsSectionsImporter
in apps/sections/importer.py
url
parameter in constructor, which will be the target JSON endpointsync(only=None)
will start synchronisation from endpoint to Section modelonly
with None
means sync everythingonly='<SECTION-CODE>'
means synchronize only that single one section (eg CZ-BRNO-VUT
)only=section_object
means synchronize only that single one sectiononly=section_queryset
means synchronize listed sections from querysetonly=['SECTION-CODE1', 'SECTION-CODE2']
means synchronize only that listed sectionsstate=active
are taken to synchronizationcode
-- Secton.code should be unique=True
label
is our name
country/cc
are redundant, sync to one attributecities
, updated
address/geolocation
sync to JSONField -- see ESNcardApplication.history
university_*
sync to University model (create/update based on _name
) and link to section via SectionUniversity
Section
modelsections
appSynchronizer
btw. max_length
for Section
attributes could be taken from https://git.esn.org/composer/drupal-modules/esn-accounts-api/-/blob/master/esn_accounts_api.install#L32-93
would be nice to have authentication via ESN Accounts CAS
https://accounts.esn.org/cas/login?service=https://fiesta.localhost/casTicket?dev=true
https://accounts.esn.org/cas/serviceValidate
django-allauth-cas
, logged extra-data:some of the synchronisation from ESN sources is needed:
https://accounts.esn.org/api/v2/sections
https://accounts.esn.org/api/v2/countries