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 a permission for supervisor to edit contacts #750

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mythilytm
Copy link
Contributor

@mythilytm mythilytm commented Sep 27, 2024

Description

This PR adds a permission check for supervisors to edit in-progress contacts

  • Defined new SUPERVISOR_EDIT_CONTACT action in actionsMaps and updated canPerformActionOnContact to include SUPERVISOR_EDIT_CONTACT permission check.

Checklist

  • Corresponding issue has been opened
  • New tests added
  • Feature flags / configuration added

Other Related Issues

None

Verification steps

AFTER YOU MERGE

  1. Cut a release tag using the GitHub workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P

Copy link
Collaborator

@stephenhand stephenhand left a comment

Choose a reason for hiding this comment

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

I thought we were going to add an extra permission action to the framework rather than just hardcoding supervisors having permission? Then we would do a can(...) check on this permission, and if that passes OR one of the existing hardcoded checks passes, then they can edit

@@ -93,7 +93,8 @@ const canPerformActionOnContact = (
// Transferred tasks need to be edited by an owner that didn't create them.
if (
contactObj.createdBy === user.workerSid ||
contactObj.twilioWorkerId === user.workerSid
contactObj.twilioWorkerId === user.workerSid ||
user.roles.map(role => role === 'supervisor')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
user.roles.map(role => role === 'supervisor')
Boolean(user.roles.find(role => role === 'supervisor'))

@mythilytm mythilytm marked this pull request as ready for review October 3, 2024 18:15
Copy link
Collaborator

@stephenhand stephenhand left a comment

Choose a reason for hiding this comment

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

LGTM after the tests are fixed

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.

2 participants