Role joining is not model agnostic
See original GitHub issueWe tried replacing flask-security in our project, however our project’s User model does not have a sqlalchemy relationship for roles, it’s a hybrid_property method on the class.
The changes from https://github.com/jwag956/flask-security/commit/32968e593d2f7c82ed2767b1e0d7927f3edfffaa assumes that if roles
is defined as an attribute on the User class that it must be a relationship and thus joinable, which isn’t always a safe assumption.
I’m not sure what the best option here is outside of testing to see if the roles
attribute is specifically a sqlalchemy.orm.relationship
prior to forcing the relationship to be joined or if in our case we need to not have a roles
attribute and override something somewhere on how the datastore gets roles for a user.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
I’ll put in a PR for it here in a bit.
Yup - easy. Do you want to issue a PR - otherwise I’ll get to it in a few days…