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)[source]

Adapter for adding SCIM functionality to a Django Group object.

This adapter can be overriden; see the DJANGO_SCIM_GROUP_ADAPTER setting for details.

display_name

Return the displayName of the user 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 the dict.

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()
handle_add(operation)[source]

Handle add operations.

handle_remove(operation)[source]

Handle remove operations.

handle_replace(operation)[source]

Handle the replace operations.

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 user per the SCIM spec.

classmethod resource_type_dict()[source]

Return a dict containing ResourceType metadata for the group object.

to_dict()[source]

Return a dict conforming to the SCIM User Schema, ready for conversion to a JSON object.

class django_scim.adapters.SCIMUser(obj)[source]

Adapter for adding SCIM functionality to a Django User object.

This adapter can be overriden; see the DJANGO_SCIM_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 the dict.

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.

handle_replace(operation)[source]

Handle the replace operations.

meta

Return the meta object of the user per the SCIM spec.

classmethod resource_type_dict()[source]

Return a dict containing ResourceType metadata for the user object.

to_dict()[source]

Return a dict conforming to the SCIM User Schema, ready for conversion to a JSON object.