15five / django-scim2

A SCIM 2.0 Service Provider Implementation (for Django)
http://django-scim2.readthedocs.io/
Other
77 stars 27 forks source link

Cannot resolve keyword 'scim_id' into field #32

Closed guy-vulcan closed 5 years ago

guy-vulcan commented 5 years ago

Describe the bug When doing an API call to GET /scim/v2/Users, getting a Cannot resolve keyword 'scim_id' into field. Looks like the user model does not go through the SCIMUSer adapter. any ideas?

Using python 3.7 django 2.1.7

Stacktrace

2019-06-05T10:18:43 local app: ERROR /venv/app/lib/python3.7/site-packages/django_scim/views.py func:dispatch line:94 - Unable to complete SCIM call. Traceback (most recent call last): File "/venv/app/lib/python3.7/site-packages/django_scim/views.py", line 91, in dispatch return super(SCIMView, self).dispatch(request, *args, kwargs) File "/venv/app/lib/python3.7/site-packages/django/views/generic/base.py", line 88, in dispatch return handler(request, *args, *kwargs) File "/venv/app/lib/python3.7/site-packages/django_scim/views.py", line 257, in get return self.get_many(request) File "/venv/app/lib/python3.7/site-packages/django_scim/views.py", line 281, in get_many return self._build_response(request, qs, self._page(request)) File "/venv/app/lib/python3.7/site-packages/django_scim/views.py", line 201, in _build_response totalcount = sum(1 for in qs) File "/venv/app/lib/python3.7/site-packages/django/db/models/query.py", line 268, in iter self._fetch_all() File "/venv/app/lib/python3.7/site-packages/django/db/models/query.py", line 1186, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/venv/app/lib/python3.7/site-packages/django/db/models/query.py", line 54, in iter results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/venv/app/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1052, in execute_sql sql, params = self.as_sql() File "/venv/app/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 449, in as_sql extra_select, order_by, group_by = self.pre_sql_setup() File "/venv/app/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 51, in pre_sql_setup order_by = self.get_order_by() File "/venv/app/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 315, in get_order_by field, self.query.get_meta(), default_order=asc)) File "/venv/app/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 668, in find_ordering_name field, targets, alias, joins, path, opts, transform_function = self._setup_joins(pieces, opts, alias) File "/venv/app/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 698, in _setup_joins field, targets, opts, joins, path, transform_function = self.query.setup_joins(pieces, opts, alias) File "/venv/app/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1473, in setup_joins names[:pivot], opts, allow_many, fail_on_missing=True, File "/venv/app/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1389, in names_to_path "Choices are: %s" % (name, ", ".join(available))) django.core.exceptions.FieldError: Cannot resolve keyword 'scim_id' into field. Choices are: auth_token, date_joined, email, first_name, groups, id, is_active, is_staff, is_superuser, last_login, last_name, logentry, oauth2_provider_accesstoken, oauth2_provider_application, oauth2_provider_grant, oauth2_provider_refreshtoken, password, user_permissions, user_settings, username, appcomments, appuser** 2019-06-05T10:18:43 local app: ERROR /venv/app/lib/python3.7/site-packages/django/utils/log.py func:log_response line:228 - Internal Server Error: /api/scim/v2/Users [05/Jun/2019 10:18:44] "GET /api/scim/v2/Users HTTP/1.1" 500 289

logston commented 5 years ago

Hi @guy-vulcan! Sorry for the delay. I can get to this as work allows.

Looks like you need to have your User model inherit from AbstractSCIMUserMixin and then run migrations.

https://github.com/15five/django-scim2/blob/master/src/django_scim/models.py#L159

Feel free to reopen if that did no answer your question.