We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
L'ajout automatique d'un utilisateur dans un acessgroup est prévu lors d'un authentification CAS ou LDAP mais pas pour OIDC.
Le fichier à modifier est /pod/authentication/backends.py
Ajouts => OIDC_CLAIM_AFFILIATION = getattr(settings, "OIDC_CLAIM_AFFILIATION", "affiliations") class OIDCBackend(OIDCAuthenticationBackend): def create_user(self, claims): affiliations = claims.get(OIDC_CLAIM_AFFILIATION, "") if affiliations: for affiliation in affiliations: if CREATE_GROUP_FROM_AFFILIATION: accessgroup, group_created = AccessGroup.objects.get_or_create(code_name=affiliation) if group_created: accessgroup.display_name = affiliation accessgroup.auto_sync = True accessgroup.sites.add(Site.objects.get_current()) accessgroup.save() user.owner.accessgroup_set.add(accessgroup) else: user.owner.accessgroup_set.add(accessgroup) else: user.owner.affiliation = OIDC_DEFAULT_AFFILIATION for code_name in OIDC_DEFAULT_ACCESS_GROUP_CODE_NAMES: try: user.owner.accessgroup_set.add(AccessGroup.objects.get(code_name=code_name)) except ObjectDoesNotExist: pass
def update_user(self, user, claims):
if affiliations: for affiliation in affiliations: if CREATE_GROUP_FROM_AFFILIATION: accessgroup, group_created = AccessGroup.objects.get_or_create(code_name=affiliation) if group_created: accessgroup.display_name = affiliation accessgroup.auto_sync = True accessgroup.sites.add(Site.objects.get_current()) accessgroup.save() user.owner.accessgroup_set.add(accessgroup) else: user.owner.accessgroup_set.add(accessgroup) else: user.owner.affiliation = OIDC_DEFAULT_AFFILIATION for code_name in OIDC_DEFAULT_ACCESS_GROUP_CODE_NAMES: try: user.owner.accessgroup_set.add(AccessGroup.objects.get(code_name=code_name)) except ObjectDoesNotExist: pass
The text was updated successfully, but these errors were encountered:
No branches or pull requests
L'ajout automatique d'un utilisateur dans un acessgroup est prévu lors d'un authentification CAS ou LDAP mais pas pour OIDC.
Le fichier à modifier est /pod/authentication/backends.py
Ajouts =>
OIDC_CLAIM_AFFILIATION = getattr(settings, "OIDC_CLAIM_AFFILIATION", "affiliations")
class OIDCBackend(OIDCAuthenticationBackend):
def create_user(self, claims):
affiliations = claims.get(OIDC_CLAIM_AFFILIATION, "")
if affiliations:
for affiliation in affiliations:
if CREATE_GROUP_FROM_AFFILIATION:
accessgroup, group_created = AccessGroup.objects.get_or_create(code_name=affiliation)
if group_created:
accessgroup.display_name = affiliation
accessgroup.auto_sync = True
accessgroup.sites.add(Site.objects.get_current())
accessgroup.save()
user.owner.accessgroup_set.add(accessgroup)
else:
user.owner.accessgroup_set.add(accessgroup)
else:
user.owner.affiliation = OIDC_DEFAULT_AFFILIATION
for code_name in OIDC_DEFAULT_ACCESS_GROUP_CODE_NAMES:
try:
user.owner.accessgroup_set.add(AccessGroup.objects.get(code_name=code_name))
except ObjectDoesNotExist:
pass
if affiliations:
for affiliation in affiliations:
if CREATE_GROUP_FROM_AFFILIATION:
accessgroup, group_created = AccessGroup.objects.get_or_create(code_name=affiliation)
if group_created:
accessgroup.display_name = affiliation
accessgroup.auto_sync = True
accessgroup.sites.add(Site.objects.get_current())
accessgroup.save()
user.owner.accessgroup_set.add(accessgroup)
else:
user.owner.accessgroup_set.add(accessgroup)
else:
user.owner.affiliation = OIDC_DEFAULT_AFFILIATION
for code_name in OIDC_DEFAULT_ACCESS_GROUP_CODE_NAMES:
try:
user.owner.accessgroup_set.add(AccessGroup.objects.get(code_name=code_name))
except ObjectDoesNotExist:
pass
The text was updated successfully, but these errors were encountered: