Skip to content

Conversation

meinac
Copy link
Contributor

@meinac meinac commented Oct 6, 2017

The issue is, if you try to revoke the permission of a user from an
object, all the permissions on this object get removed. The fix is
assigning filtered query object to it's own reference.

According to SQLAlchemy documentation, filter method applies to
the copy of the query object which means calling filter doesn't
affect the object receiving filter call. For more information;
http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.filter

The issue is, if you try to revoke the permission of a user from an
object, all the permissions on this object get removed. The fix is
assigning filtered query object to it's own reference.

According to SQLAlchemy documentation, `filter` method applies to
the **copy** of the query object which means calling filter doesn't
affect the object receiving filter call. For more information;
http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.filter
@arikfr arikfr merged commit 9d3ae2c into getredash:master Oct 9, 2017
@arikfr
Copy link
Member

arikfr commented Oct 9, 2017

Nice catch! Thanks.

@meinac meinac deleted the fix_revoke_permissons_bug branch October 9, 2017 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants