-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
member_list returns deleted datasets and users #3078
Conversation
The members table is stateful, ie it has a state=active/deleted field which was not updated when deleting a dataset or user. This commit sets the state of all user/dataset memberships to deleted and adds some tests
model.Member.table_id == user_id).all() | ||
|
||
for membership in user_memberships: | ||
membership.delete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this delete
doing something special in one of the three superclasses? Otherwise we could just use:
user_memberships = model.Session.query(
model.Member
).filter(
model.Member.table_id == user_id
).delete()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the member table is versioned with VDM (the custom revision library CKAN uses), so we need to call the domain object delete
method to create the revision on member_revision
and set the state automatically (plus any other voodoo that VDM does)
@amercader looks good to me! Do you want me to merge this? |
Also how do you backport changes? I would be very much interested to learn how that process works. |
The members table is stateful, ie it has a state=active/deleted field which was not updated when deleting a dataset or user. This commit sets the state of all user/dataset memberships to deleted and adds some tests Conflicts: ckan/tests/logic/action/test_get.py
The members table is stateful, ie it has a state=active/deleted field which was not updated when deleting a dataset or user. This commit sets the state of all user/dataset memberships to deleted and adds some tests Conflicts: ckan/new_tests/logic/action/test_get.py
The members table is stateful, ie it has a state=active/deleted field which was not updated when deleting a dataset or user. This commit sets the state of all user/dataset memberships to deleted and adds some tests
Visiting a Group or Org Members page will show deleted users.
Also calling
member_list
on a Group or Org will return deleted datasets (although this is not used on the frontend).This is because the members table is stateful, ie it has a
state=active/deleted
field which is not updated when deleting a dataset or user.This PR sets the state of all user/dataset memberships to
deleted
and adds some tests