add new users to default collectivity
This commit is contained in:
parent
777eb2f1d6
commit
b1ed899f50
|
@ -24,6 +24,8 @@ import lasso
|
|||
|
||||
from mellon.adapters import DefaultAdapter
|
||||
from authentic2.models import Attribute
|
||||
from authentic2.a2_rbac.utils import get_default_ou
|
||||
|
||||
|
||||
class AuthenticAdapter(DefaultAdapter):
|
||||
def lookup_user(self, idp, saml_attributes):
|
||||
|
@ -35,7 +37,11 @@ class AuthenticAdapter(DefaultAdapter):
|
|||
saml_attributes['name_id_content_orig'] = saml_attributes['name_id_content']
|
||||
saml_attributes['name_id_content'] = saml_attributes['urn:be:fedict:iam:attr:fedid'][0]
|
||||
saml_attributes['name_id_format'] = lasso.SAML2_NAME_IDENTIFIER_FORMAT_UNSPECIFIED
|
||||
return super(AuthenticAdapter, self).lookup_user(idp, saml_attributes)
|
||||
user = super(AuthenticAdapter, self).lookup_user(idp, saml_attributes)
|
||||
if not user.ou_id:
|
||||
user.ou = get_default_ou()
|
||||
user.save()
|
||||
return user
|
||||
|
||||
def create_user(self, user_class):
|
||||
return user_class.objects.create()
|
||||
|
|
Loading…
Reference in New Issue