when would you want to alert a Portal User of a mention if that user doesn't have access to the parent entity ?
If you look at the source in the core at this method:
Code:
protected function notifyAboutMention(Entity $entity, \Espo\Entities\User $user, Entity $parent = null) { if ($user->isPortal()) return; if ($parent) { if (!$this->getAclManager()->check($user, $parent, 'stream')) return; } $this->getNotificationService()->notifyAboutMentionInPost($user->id, $entity->id); }
The method I wrote bypasses .../Portal/AclManager only because that's the best I could come up with given my skill and the amount of time I had available.
In an ideal world, the method would look something more like this:
Code:
protected function notifyAboutMention(Entity $entity, \Espo\Entities\User $user, Entity $parent = null) { if ($parent) { if ($user->isPortal()) if (!$this->getPortalAclManager()->check($user, $parent, 'stream')) return; elsif { if (!$this->getInternalAclManager()->check($user, $parent, 'stream')) return; } } $this->getNotificationService()->notifyAboutMentionInPost($user->id, $entity->id); }
The more general use case I wanted was just to give customers limited access to different entities in the Portal and then have bi-directional communication scoped to that particular entity. But, since customers don't live in the CRM like we do, I wanted us to be able to 'mention' them and send a notification, so they could reply or log in and respond to our queries.
Not sure if that clarifies or confuses, but that's the logic :-)
Leave a comment: