Skip to content

Edits to contact email address do not update permissions #363

@blakenan-bellese

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)
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtech debtRemediation work implied by intentional partial or sub-optimal implmentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions