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

Add errors related to "leave team" feature #2442

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

smcmurtry
Copy link
Contributor

Summary | Résumé

This PR:

  • adds a method on the service object get_users_with_permission - this returns a list of active users who belong to the service who have the permission you pass in as an argument
  • adds 2 new error responses that are returned when you try to delete a user. SERVICE_CANNOT_HAVE_LT_2_MEMBERS and SERVICE_NEEDS_USER_W_MANAGE_SETTINGS_PERM. This is to support the "leave team" feature in notification admin

Related Issues | Cartes liées

Test instructions | Instructions pour tester la modification

  1. run this branch locally
  2. run the feat/remove-yourself branch of notification-admin locally
  3. set up a service with 2 members, one member with all permissions, and the other member missing the "manage settings and team" permission
  4. click "leave team" from the "team members" page, confirm, and observe that you get an error about not being able to leave a team with only 2 members
  5. add another user to the team who does not have the "manage settings and team" permission, bringing the total to 3 team members.
  6. from your user account who does have "manage settings and team" permission, click "leave team" and confirm. You should now see an error about the service needing at least 1 user who can manage settings and team

Release Instructions | Instructions pour le déploiement

None.

Reviewer checklist | Liste de vérification du réviseur

  • This PR does not break existing functionality.
  • This PR does not violate GCNotify's privacy policies.
  • This PR does not raise new security concerns. Refer to our GC Notify Risk Register document on our Google drive.
  • This PR does not significantly alter performance.
  • Additional required documentation resulting of these changes is covered (such as the README, setup instructions, a related ADR or the technical documentation).

⚠ If boxes cannot be checked off before merging the PR, they should be moved to the "Release Instructions" section with appropriate steps required to verify before release. For example, changes to celery code may require tests on staging to verify that performance has not been affected.

@smcmurtry smcmurtry changed the title got it working Add errors related to "leave team" feature Feb 5, 2025
@@ -645,6 +645,12 @@
"research_mode": self.research_mode,
}

def get_users_with_permission(self, permission):
from app.dao.permissions_dao import permission_dao

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
app.dao.permissions_dao
begins an import cycle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant