Automatically add new users to default groups
Review Request #7165 — Created April 4, 2015 and submitted — Latest diff uploaded
This change is to make a new user to be a member of default groups, when the user is registered or added to a local-site.
Works done are:
1. handle newly registered user
1) catch user_registered djblets.auth.signals.user_registered signal invoked when a new user is registered
2) add the new user to default groups
2. handle new LocalSite-User relation
1) catch m2m_changed (many-to-many relation changed) signal invoked when a LocalSite-User relation changed
2) invoke local_site_user_added for new relations between LocalSite and User
3) make a receiver of local_site_user_added, to add this newly added user to the LocalSite's default groups
Browser tests done:
- make new local site
- make new group, addign local the local site to it, and make it a default group
- make new group and addign local the local site to it (do not make it default group)
- add a user to the local site
- see if the user is added to group created in #2
- see if the user is not added to group created in #3
Unit Tests done:
- check if _add_default_groups signal handler is called properly when a user is registered
- check if _add_default_groups signal handler is called properly when local_site.users.add(user)
- check if _add_default_groups signal handler is called properly when user.local_site.add(local_site)
- check if _add_default_groups adds global default review_groups when a user is registered
- check if _add_default_groups adds a local_site's default groups when local_site.users.add(user) or user.local_site.add(local_site)
Edge cases:
- there's no default group
- there's no non-default group
Diff Revision 5
This is not the most recent revision of the diff. The latest diff is revision 9. See what's changed.
reviewboard/accounts/models.py |
---|
reviewboard/reviews/admin.py |
---|
reviewboard/reviews/tests.py |
---|
reviewboard/reviews/evolutions/__init__.py |
---|
reviewboard/reviews/evolutions/is_default_group.py |
---|
reviewboard/reviews/models/group.py |
---|
reviewboard/site/models.py |
---|
reviewboard/site/signals.py |
---|
reviewboard/testing/testcase.py |
---|