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

Automatically remove Watches, Assignments, etc if user loses access due to being removed as collaborator or from a team #10997

Conversation

6543
Copy link
Member

@6543 6543 commented Apr 7, 2020

continue #5676
fix #5673

Include #11003

@6543 6543 changed the title Remove user as assignee after collaboration removal [WIP] Remove user as assignee after collaboration removal Apr 7, 2020
@6543 6543 changed the title [WIP] Remove user as assignee after collaboration removal Remove user as assignee after collaboration removal Apr 7, 2020
@6543
Copy link
Member Author

6543 commented Apr 7, 2020

THIS is ready for review

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 7, 2020
@codecov-io
Copy link

codecov-io commented Apr 7, 2020

Codecov Report

Merging #10997 into master will decrease coverage by 0.20%.
The diff coverage is 15.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10997      +/-   ##
==========================================
- Coverage   43.60%   43.39%   -0.21%     
==========================================
  Files         597      597              
  Lines       83923    84547     +624     
==========================================
+ Hits        36594    36691      +97     
- Misses      42817    43330     +513     
- Partials     4512     4526      +14     
Impacted Files Coverage Δ
cmd/doctor.go 0.00% <0.00%> (ø)
models/branches.go 41.88% <0.00%> (ø)
models/issue.go 51.41% <ø> (ø)
models/issue_comment.go 46.68% <ø> (ø)
models/lfs.go 17.27% <ø> (ø)
models/migrations/migrations.go 3.50% <0.00%> (-0.67%) ⬇️
modules/lfs/content_store.go 45.33% <ø> (ø)
modules/lfs/server.go 40.35% <ø> (ø)
modules/notification/base/null.go 66.66% <0.00%> (-2.09%) ⬇️
modules/notification/mail/mail.go 27.02% <0.00%> (-1.96%) ⬇️
... and 31 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c54477...e222cbd. Read the comment docs.

Copy link
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is right but I have two questions:

  • The deletecollaboration call just removes watchers etc without checking if the user would still have access, should we check if the user would still have access before doing those?
  • Do we need to do a similar change for removal from team

@6543
Copy link
Member Author

6543 commented Apr 7, 2020

@zeripath

@zeripath
Copy link
Contributor

zeripath commented Apr 7, 2020

It might be better to just move them all in to this. They're all related.

@6543 6543 changed the title Remove user as assignee after collaboration removal impruve reconsidderation of Watches, Asingments, etc .. if user was removed as collaboration or from team Apr 7, 2020
@6543
Copy link
Member Author

6543 commented Apr 7, 2020

@zeripath done

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 7, 2020
@zeripath zeripath changed the title impruve reconsidderation of Watches, Asingments, etc .. if user was removed as collaboration or from team Automatically remove Watches, Assignments, etc if user loses access due to being removed as collaborator or from a team Apr 7, 2020
@lafriks lafriks added this to the 1.12.0 milestone Apr 7, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 7, 2020
@6543
Copy link
Member Author

6543 commented Apr 7, 2020

ping

@zeripath zeripath merged commit 71979d9 into go-gitea:master Apr 7, 2020
@lafriks lafriks deleted the remove_user_as_assignee_after_collaboration_removal branch April 7, 2020 22:08
@adelowo
Copy link
Member

adelowo commented Apr 7, 2020

Thanks a lot mate. Really appreciate you completing this.

ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
…ue to being removed as collaborator or from a team (go-gitea#10997)

* remove a user from being assigned to any issue/PR if (s)he is removed as a collaborator

* fix gender specific comment

* do not remove users that still have access to the repo if they are a member of a team that can access the repo

* add context to errors

* updates

* incorporate review fixes

* Update models/repo_collaboration.go

Co-Authored-By: 6543 <6543@obermui.de>

* Update models/repo_collaboration.go

Co-Authored-By: 6543 <6543@obermui.de>

* Fix Rebase Relict

* Fix & Impruve

* use xorm builder

* all in one session

* generalize reconsiderIssueAssignees

* Only Unwatch if have no access anymore

* prepare for reuse

* Same things if remove User from Team

* fix lint

* let mysql take time to react

* add description

* CI.restart()

* CI.restart()

Co-authored-by: Lanre Adelowo <yo@lanre.wtf>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't unassign removed collaborators
7 participants