Skip to content
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

Merged
merged 1 commit into from
Jun 6, 2016

Conversation

amercader
Copy link
Member

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

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()
Copy link
Member

@TkTech TkTech Jun 1, 2016

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()

Copy link
Member Author

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)

@k-nut
Copy link
Contributor

k-nut commented Jun 3, 2016

@amercader looks good to me! Do you want me to merge this?

@k-nut
Copy link
Contributor

k-nut commented Jun 3, 2016

Also how do you backport changes? I would be very much interested to learn how that process works.

@brew brew merged commit 3d7a567 into master Jun 6, 2016
amercader added a commit that referenced this pull request Aug 25, 2016
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
amercader added a commit that referenced this pull request Aug 25, 2016
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
amercader added a commit that referenced this pull request Aug 25, 2016
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
@smotornyuk smotornyuk deleted the 3078-member_list-shows-deleted branch December 19, 2018 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants