Skip to content

Edits to contact email address do not update permissions #363

Open

Description

@blakenan-bellese

Describe the bug
When a contact is associated with facility created we create a Casbin policy to allow that contact to view that the associated facility. This, coupled with short lived tokens, enable the self check-in functionality. Currently, any edits to an email address do not result in updates to the policy.

To Reproduce
Steps to reproduce the behavior:

  1. Perform self check in with an existing contact that has an email address
  2. Update the email address of that contact
  3. Attempt another self check in

Expected behavior
The self checkin after email update should succeed.

Environment
n/a

Additional context
The fix should also include removal of the policy associated with the old email address.

Here's the code that was used to create the policy when linking the entity and contact:

   if (typeof contact.email !== 'undefined' && contact.email.length > 0) {
      for (const email of contact.email) {
        const p = [email.address, `/entity/${ec.entityId}`, '(GET)|(POST)']
        await e.addPolicy(...p)
      }

Activity

  1. added
    bug
    tech debt
    on Feb 26, 2021
  2. added a commit that references this issue on Mar 25, 2021
    ac1b9dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtech debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions