From 1bc5e71f385c004cf50f462fbc76a7e1050f8394 Mon Sep 17 00:00:00 2001 From: Jason Anton Date: Fri, 26 Feb 2021 22:18:47 -0500 Subject: [PATCH] moving casbin to load only if we have email --- src/models/entity-contact.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/entity-contact.js b/src/models/entity-contact.js index c56ed1f7..5ceb4b52 100644 --- a/src/models/entity-contact.js +++ b/src/models/entity-contact.js @@ -51,9 +51,9 @@ const entityContact = (sequelize, DataTypes) => { // Grant perms on checkins const contact = await models.Contact.findById(ec.contactId) - const e = await utils.loadCasbin() if (typeof contact.email !== 'undefined' && contact.email.length > 0) { + const e = await utils.loadCasbin() for (const email of contact.email) { const p = [email.address, `/entity/${ec.entityId}`, '(GET)|(POST)'] await e.addPolicy(...p)