-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feat: automatically associate user to agency #2325
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
this lessens the chance that the user will reach the in_person views without an associated TransitAgency.
f0aeef2
to
3f6846c
Compare
specifically, permission to do in-person enrollment. now there are two separate groups representing those concepts instead of one. had to specify a `related_name` to avoid name collision when Django follows relationships "backwards": https://docs.djangoproject.com/en/5.1/ref/models/fields/#django.db.models.ForeignKey.related_name https://docs.djangoproject.com/en/5.1/topics/db/queries/#following-relationships-backward refactored `TransitAgency.for_user` method to loop over user's groups.
3f6846c
to
00c0de3
Compare
Starting to review now |
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.
LGTM! Thanks for the instructions.
(When I first tested this with your instructions, I duh forgot to run source .env
so it didn't work as expected. After I ran source
and confirmed the env vars changed, it worked.)
no functional change, just improving readability
b69153f
to
04d3c19
Compare
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.
Nice 👍
Thank you both! |
Closes #2243
This PR makes it so that users are added to their transit agency's
staff_group
upon login. This is done with the help of a field calledsso_domain
on the transit agency.The user needs to be manually added to their transit agency's
customer_service_group
to see the part of the dashboard for "In-person enrollment".Testing locally
GOOGLE_SSO_STAFF_LIST
environment variable to*
GOOGLE_SSO_ALLOWABLE_DOMAINS
environment variable iscompiler.la
Those two steps make it so your Google account will be seen as a "transit agency staff user" - i.e. not put into the "Cal-ITP" group but still marked as
is_staff
.SSO_SHOW_FORM_ON_ADMIN_PAGE
toTrue
temporarily inbenefits/settings.py
./bin/reset_db.sh
/admin
and login as your superuser (based on yourDJANGO_SUPERUSER_USERNAME
andDJANGO_SUPERUSER_PASSWORD
environment variables)TransitAgency
so that it has ansso_domain
ofcompiler.la
staff_group
for CSTcustomer_service_group
for CSTExpected result: your user has been added to the
staff_group
for CST upon login. When you go to the agency dashboard, you see the transit agency name, but no button or anything for in-person enrollment.To elevate the user to having permission to do in-person enrollment:
Expected result: When you go to the agency dashboard, you see the the transit agency name as well as the in-person enrollment section.
Screenshots
User in CST's
staff_group
but not thecustomer_service_group
User in CST's
staff_group
andcustomer_service_group