use of io.lumeer.engine.api.event.CreateOrUpdateUser in project engine by Lumeer.
the class UserFacade method createUserAndSendNotification.
private User createUserAndSendNotification(String organizationId, User user) {
User created = userDao.createUser(user);
if (this.createOrUpdateUserEvent != null) {
this.createOrUpdateUserEvent.fire(new CreateOrUpdateUser(organizationId, created));
}
if (authenticatedUser.getUserEmail() == null || !authenticatedUser.getUserEmail().equals(user.getEmail())) {
emailFacade.sendInvitation(user.getEmail());
// do not send further org/proj shared notifications for this HTTP request
userNotificationFacade.muteUpdateResourceNotifications(created.getId());
}
return created;
}
use of io.lumeer.engine.api.event.CreateOrUpdateUser in project engine by Lumeer.
the class PusherFacade method createAddOrUpdateUserNotification.
public void createAddOrUpdateUserNotification(@Observes final CreateOrUpdateUser createOrUpdateUser) {
if (isEnabled()) {
try {
Organization organization = organizationDao.getOrganizationById(createOrUpdateUser.getOrganizationId());
ObjectWithParent object = new ObjectWithParent(getAppId(), cleanUserFromUserEvent(createOrUpdateUser), organization.getId());
Set<String> users = resourceAdapter.getOrganizationReaders(organization);
List<Event> events = users.stream().map(userId -> createEventForObjectWithParent(object, UPDATE_EVENT_SUFFIX, userId)).collect(Collectors.toList());
sendNotificationsBatch(events);
} catch (Exception e) {
log.log(Level.WARNING, "Unable to send push notification: ", e);
}
}
}
Aggregations