WIPACrepo / keycloak-rest-services

Services surrounding KeyCloak, that use the REST API to read/update state
MIT License
1 stars 1 forks source link

Missing Boolean Casting for Institution Info #43

Open ric-evans opened 2 years ago

ric-evans commented 2 years ago

There looks to be a missing out-cast from the database on boolean fields. For example, this is from institutions.list_insts_flat:

 'Washington': {'abbreviation': 'UWa',
                'authorlist': 'false',
                'cite': 'University of Washington',
                'has_mou': 'false',
                'is_US': 'true',
                'name': 'University of Washington',
                'region': 'North America'},

I saw this issue when writing a filter_func and got "false" results for filter_func=lambda _, attrs: attrs.get('has_mou', False).

dsschult commented 2 years ago

So currently the code doesn't do any casting, other than if something is a list. Note that you can't write a bool to keycloak either, you need to write strings.

I guess the code could do conversions internally, which would be a feature request.

ric-evans commented 2 years ago

I'm fine with kicking this to the responsibility of the client since this isn't a bug. I'm not sure if this would affect anything outside of the mou dash.