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

Feat: field/add permissions for ClaimsProvider model #2671

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lalver1
Copy link
Member

@lalver1 lalver1 commented Feb 6, 2025

Closes #2663

This PR sets visible/nonvisible and editable/readonly permissions on the fields of ClaimsProvider for superuser and Cal-ITP group members, and lets Cal-ITP group members add instances of the ClaimsProvider model.

Reviewing

Set DJANGO_ALLOWED_HOSTS=benefits.calitp.org,localhost in your .env file (and don't forget to source .env in the dev container's terminal) so that you can see the add ClaimsProvider model behavior as it would run on prod. Otherwise, you will always be able to add the ClaimsProvider model because of

def has_add_permission(self, request):
        if settings.RUNTIME_ENVIRONMENT() != settings.RUNTIME_ENVS.PROD:
            return True

Log in to the admin interface as a superuser and verify the checklist for superuser shown below.

Log in to the admin interface as a Cal-ITP group member (the easiest way to set up a Cal-ITP group member is to remove the superuser attribute from the benefits-admin user and to add it to the Cal-ITP group) and verify the checklist for Cal-ITP group member shown below.

For the verification, ensure model and field permissions match the permissions in the Benefits admin configuration spreadsheet for model/field permissions for each user level (Admin, Cal-ITP, Transit agency). Note that in this spreadsheet, each field indicate the lowest level user type, e.g. if a field is marked as readable by Cal-ITP, then it should also be readable by a superuser.

superuser

  • Confirm all fields of ClaimsProvider are visible and editable as before
  • Confirm ClaimsProvider can be added as before

Cal-ITP group member

  • Confirm correct fields are visible/nonvisible, and editable/readonly
  • Confirm new instances of the ClaimsProvider model can be added AND saved

@lalver1 lalver1 self-assigned this Feb 6, 2025
@github-actions github-actions bot added tests Related to automated testing (unit, UI, integration, etc.) deployment-dev [auto] Changes that will trigger a deploy if merged to dev back-end Django views, sessions, middleware, models, migrations etc. and removed tests Related to automated testing (unit, UI, integration, etc.) labels Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/core/admin
  claims.py 39
Project Total  

This report was generated by python-coverage-comment-action

Copy link

github-actions bot commented Feb 6, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/core/admin
  claims.py
Project Total  

This report was generated by python-coverage-comment-action

@lalver1 lalver1 force-pushed the feat/permissions-claimsprovider branch 2 times, most recently from 5083597 to cc4b27b Compare February 6, 2025 15:07
@lalver1 lalver1 marked this pull request as ready for review February 6, 2025 15:42
@lalver1 lalver1 requested a review from a team as a code owner February 6, 2025 15:42
@lalver1 lalver1 force-pushed the feat/permissions-claimsprovider branch from cc4b27b to 19c2767 Compare February 6, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end Django views, sessions, middleware, models, migrations etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admin: Cal-ITP Benefits staff user can add Claims models
2 participants