educloudalliance / eca-auth-data

Common gateway of user data to all other services.
MIT License
0 stars 1 forks source link

Allow user search with multiple attributes #21

Open tkharju opened 8 years ago

tkharju commented 8 years ago

Currently query /api/1/user?dreamschool=123&foo=bar filters UserAttributes by only picking either of the parameters (randomly).

DoD: User queryset is filtered using all GET parameters

Ref: https://github.com/educloudalliance/eca-auth-data/blob/c37e991c834a37e13e6e5bac52e9e3db907c830a/authdata/views.py#L144

This is the reason why following test failed: https://travis-ci.org/educloudalliance/eca-auth-data/jobs/102996338

derega commented 8 years ago

The documentation for that endpoint says:

Query is made by GET parameters. Only one parameter is allowed. The parameter
consists of an attribute name and an attribute value.

Where and why this endpoint should support more than one query parameter?

derega commented 8 years ago

The failing test: https://github.com/educloudalliance/eca-auth-data/blob/c37e991c834a37e13e6e5bac52e9e3db907c830a/authdata/tests/test_views.py#L289

tkharju commented 8 years ago

We discussed about this with @derega and came to the conclusion that it would be better to do the tests at this point only with one attribute. In other words mpass-data works so that /api/1/user?dreamschool=123 is valid but /api/1/user?dreamschool=123&foo=bar is not. Current implementation is not deterministic. If user makes query against the spec by giving two or more attributes, it is possible that at times the results differ, as only the first attribute is used for filtering but the order of get-attributes may change even between similar requests.