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

Projects
None yet
4 participants
@amercader
Copy link
Member

commented Jun 1, 2016

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

[#3078] Don't show deleted users/datasets on member_list
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()

This comment has been minimized.

Copy link
@TkTech

TkTech Jun 1, 2016

Member

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

This comment has been minimized.

Copy link
@amercader

amercader Jun 2, 2016

Author Member

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

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2016

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

@k-nut

This comment has been minimized.

Copy link
Contributor

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

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

amercader added a commit that referenced this pull request Aug 25, 2016

[#3078] Don't show deleted users/datasets on member_list
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

[#3078] Don't show deleted users/datasets on member_list
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

[#3078] Don't show deleted users/datasets on member_list
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 Dec 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.