Adapters¶
Adapters are used to convert the data model described by the SCIM 2.0 specification to a data model that fits the data provided by the application implementing a SCIM api.
For example, in a Django app, there are User and Group models that do
not have the same attributes/fields that are defined by the SCIM 2.0
specification. The Django User model has both first_name
and last_name
attributes but the SCIM speicifcation requires this same data be sent under
the names givenName
and familyName
respectively.
An adapter is instantiated with a model instance. Eg:
user = get_user_model().objects.get(id=1)
scim_user = SCIMUser(user)
...
-
class
django_scim.adapters.
SCIMGroup
(obj, request=None)[source]¶ Adapter for adding SCIM functionality to a Django Group object.
This adapter can be overriden; see the
GROUP_ADAPTER
setting for details.-
display_name
¶ Return the displayName of the group per the SCIM spec.
-
from_dict
(d)[source]¶ Consume a
dict
conforming to the SCIM Group Schema, updating the internal group object with data from thedict
.Please note, the group object is not saved within this method. To persist the changes made by this method, please call
.save()
on the adapter. Eg:scim_group.from_dict(d) scim_group.save()
-
members
¶ Return a list of user dicts (ready for serialization) for the members of the group.
Return type: list
-
meta
¶ Return the meta object of the group per the SCIM spec.
-
-
class
django_scim.adapters.
SCIMUser
(obj, request=None)[source]¶ Adapter for adding SCIM functionality to a Django User object.
This adapter can be overriden; see the
USER_ADAPTER
setting for details.-
display_name
¶ Return the displayName of the user per the SCIM spec.
-
emails
¶ Return the email of the user per the SCIM spec.
-
from_dict
(d)[source]¶ Consume a
dict
conforming to the SCIM User Schema, updating the internal user object with data from thedict
.Please note, the user object is not saved within this method. To persist the changes made by this method, please call
.save()
on the adapter. Eg:scim_user.from_dict(d) scim_user.save()
-
groups
¶ Return the groups of the user per the SCIM spec.
-
meta
¶ Return the meta object of the user per the SCIM spec.
-